terminal-unix: enable the cursor after ctrl+z

24270b8587 disabled the cursor while mpv is running, but if you send mpv
to the background, it is not re-enabled until you run bg, and not even
after that if mpv is paused. Fix this by enabling the cursor from the
SIGTSTP handler.
This commit is contained in:
Guido Cella 2023-12-15 17:02:18 +01:00 committed by Dudemanguy
parent b563b2aed0
commit 17be6e1990
1 changed files with 2 additions and 0 deletions

View File

@ -358,6 +358,8 @@ static void stop_sighandler(int signum)
{ {
int saved_errno = errno; int saved_errno = errno;
(void)write(stop_cont_pipe[1], &(char){PIPE_STOP}, 1); (void)write(stop_cont_pipe[1], &(char){PIPE_STOP}, 1);
(void)write(STDERR_FILENO, TERM_ESC_RESTORE_CURSOR,
sizeof(TERM_ESC_RESTORE_CURSOR) - 1);
errno = saved_errno; errno = saved_errno;
// note: for this signal, we use SA_RESETHAND but do NOT mask signals // note: for this signal, we use SA_RESETHAND but do NOT mask signals