From 430bd238706fefd03206b1b2b72e90e47ffc4ea2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 7 Oct 2022 11:35:38 +0530 Subject: [PATCH] Fix decoding of letter trailer CSI key event --- tools/tui/loop/key-encoding.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/tui/loop/key-encoding.go b/tools/tui/loop/key-encoding.go index 5c1fbe745..d9a854005 100644 --- a/tools/tui/loop/key-encoding.go +++ b/tools/tui/loop/key-encoding.go @@ -154,9 +154,14 @@ func KeyEventFromCSI(csi string) *KeyEvent { third_section = get_sub_sections(sections[2]) } var ans = KeyEvent{Type: PRESS} - keynum := first_section[0] + var keynum int if val, ok := letter_trailer_to_csi_number_map[last_char]; ok { keynum = val + } else { + if len(first_section) == 0 { + return nil + } + keynum = first_section[0] } key_name := func(keynum int) string {