Handle Ctrl+Z key later in the terminal input stack

The previous handling code was at a pretty random location and broke
terminals that could send <c-z> encoded in a non pure ascii way.

See #4238
This commit is contained in:
Maxime Coste 2021-06-27 16:56:29 +10:00
parent 4fd0fc3d80
commit c68f85659f

View File

@ -333,7 +333,12 @@ NCursesUI::NCursesUI()
return;
while (auto key = get_next_key())
m_on_key(*key);
{
if (key == ctrl('z'))
kill(0, SIGTSTP); // We suspend at this line
else
m_on_key(*key);
}
}},
m_assistant(assistant_clippy)
{
@ -640,11 +645,6 @@ Optional<Key> NCursesUI::get_next_key()
auto parse_key = [&convert](unsigned char c) -> Key {
if (Codepoint cp = convert(c); cp > 255)
return Key{cp};
if (c == control('z'))
{
kill(0, SIGTSTP); // We suspend at this line
return {};
}
// Special case: you can type NUL with Ctrl-2 or Ctrl-Shift-2 or
// Ctrl-Backtick, but the most straightforward way is Ctrl-Space.
if (c == 0)