Merge remote-tracking branch 'greenfork/restore-terminal-when-suspending'

This commit is contained in:
Maxime Coste 2021-07-07 19:14:45 +10:00
commit 7172481db3

View File

@ -380,7 +380,6 @@ void NCursesUI::suspend()
enable_mouse(false); enable_mouse(false);
bool change_color_enabled = m_palette.get_change_colors(); bool change_color_enabled = m_palette.get_change_colors();
m_palette.set_change_colors(false); m_palette.set_change_colors(false);
endwin();
auto current = set_signal_handler(SIGTSTP, SIG_DFL); auto current = set_signal_handler(SIGTSTP, SIG_DFL);
sigset_t unblock_sigtstp, old_mask; sigset_t unblock_sigtstp, old_mask;
@ -388,6 +387,7 @@ void NCursesUI::suspend()
sigaddset(&unblock_sigtstp, SIGTSTP); sigaddset(&unblock_sigtstp, SIGTSTP);
sigprocmask(SIG_UNBLOCK, &unblock_sigtstp, &old_mask); sigprocmask(SIG_UNBLOCK, &unblock_sigtstp, &old_mask);
restore_terminal_mode(); restore_terminal_mode();
endwin();
raise(SIGTSTP); // suspend here raise(SIGTSTP); // suspend here