From 6d41f1445cd5a48c659a1aedcb02054a15a08d3f Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Mon, 4 Dec 2023 13:36:41 +0000 Subject: [PATCH] Start a proper ignore section in the dictionary of sequences And by "proper ignore section" I simply mean: have the sequences we want to ignore all gathered together in a really obvious location, and with some sort of explanation. --- src/textual/_ansi_sequences.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/textual/_ansi_sequences.py b/src/textual/_ansi_sequences.py index a504ea718d..cfa4cc8328 100644 --- a/src/textual/_ansi_sequences.py +++ b/src/textual/_ansi_sequences.py @@ -170,12 +170,6 @@ # Tmux (Win32 subsystem) sends the following scroll events. "\x1b[62~": (Keys.ScrollUp,), "\x1b[63~": (Keys.ScrollDown,), - # -- - # Sequences generated by numpad 5. Not sure what it means. (It doesn't - # appear in 'infocmp'. Just ignore. - "\x1b[E": (Keys.Ignore,), # Xterm. - "\x1b[G": (Keys.Ignore,), # Linux console. - # -- # Meta/control/escape + pageup/pagedown/insert/delete. "\x1b[3;2~": (Keys.ShiftDelete,), # xterm, gnome-terminal. "\x1b[3$": (Keys.ShiftDelete,), # rxvt @@ -370,6 +364,15 @@ "\x1bOx": "8", "\x1bOy": "9", "\x1bOM": (Keys.Enter,), + ############################################################################ + # The ignore section. Only add sequences here if they are going to be + # ignored. Also, when adding a sequence here, please include a note as + # to why it is being ignored; ideally citing sources if possible. + ############################################################################ + # The following 2 are inherited from prompt toolkit. They relate to a + # press of 5 on the numeric keypad, when *not* in number mode. + "\x1b[E": (Keys.Ignore,), # Xterm. + "\x1b[G": (Keys.Ignore,), # Linux console. } # https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036