terminal: Fix certain keys being incorrectly inputted

This commit is contained in:
apio 2023-09-20 19:43:53 +02:00
parent 0cb21c2e90
commit bc14b01bf8
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -88,7 +88,11 @@ Result<void> TerminalWidget::init(char* const* args)
Result<ui::EventResult> TerminalWidget::handle_key_event(const ui::KeyEventRequest& request) Result<ui::EventResult> TerminalWidget::handle_key_event(const ui::KeyEventRequest& request)
{ {
// Avoid handling "key released" events
if (!request.pressed) return ui::EventResult::DidNotHandle; 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(); query_termios();