terminal_ui: restore termios settings before suspending Kakoune.
TerminalUI::suspend() is responsible for undoing all Kakoune's modifications to the terminal state, actually suspending the process, then re-applying all the modifications after Kakoune wakes back up. Previously, the "undo" and "reapply" steps for termios settings were both after the suspend point, so on some platforms they were incorrect when the user arrived back at the shell prompt. Now, the termios "undo" step is back before the suspend point, and the undo and reapply steps should be in exactly reversed order. Fixes #3488.
This commit is contained in:
parent
e760f2df6b
commit
de065dad2d
|
@ -398,6 +398,7 @@ void TerminalUI::suspend()
|
|||
{
|
||||
bool mouse_enabled = m_mouse_enabled;
|
||||
enable_mouse(false);
|
||||
tcsetattr(STDIN_FILENO, TCSAFLUSH, &m_original_termios);
|
||||
restore_terminal();
|
||||
|
||||
auto current = set_signal_handler(SIGTSTP, SIG_DFL);
|
||||
|
@ -408,7 +409,6 @@ void TerminalUI::suspend()
|
|||
|
||||
raise(SIGTSTP); // suspend here
|
||||
|
||||
tcsetattr(STDIN_FILENO, TCSAFLUSH, &m_original_termios);
|
||||
set_signal_handler(SIGTSTP, current);
|
||||
sigprocmask(SIG_SETMASK, &old_mask, nullptr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user