From bc14b01bf8af8f6da9489fb237ec180df41b1f36 Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 20 Sep 2023 19:43:53 +0200 Subject: [PATCH] terminal: Fix certain keys being incorrectly inputted --- terminal/TerminalWidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terminal/TerminalWidget.cpp b/terminal/TerminalWidget.cpp index 792938bb..a55274f9 100644 --- a/terminal/TerminalWidget.cpp +++ b/terminal/TerminalWidget.cpp @@ -88,7 +88,11 @@ Result TerminalWidget::init(char* const* args) Result TerminalWidget::handle_key_event(const ui::KeyEventRequest& request) { + // Avoid handling "key released" events if (!request.pressed) return ui::EventResult::DidNotHandle; + // Non-printable key or key that has no special character (unlike Tab or Enter). We exit early to avoid inserting an + // invalid zero byte into the terminal input (this would also happen on Shift or Ctrl keypresses). + if (request.letter == '\0') return ui::EventResult::DidNotHandle; query_termios();