@b0rk one trick as an application programmer to avoid this is to always make sure the hide/show are provided in the same buffer and sent in the same syscall. This way, the process being killed for whatever reason will not leave the terminal in a bad state