From c68f85659f419a59a477c2dc7464a66ab6e67ec5 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 27 Jun 2021 16:56:29 +1000 Subject: [PATCH] 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 encoded in a non pure ascii way. See #4238 --- src/ncurses_ui.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index fb2cb25f..737640cb 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -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 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)