diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2017-11-20 12:59:26 +1100 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2017-11-21 14:46:18 +1100 |
commit | 3af2c04787af928b296079a7e10388fe5958bd8b (patch) | |
tree | e8070661411a319b72eb4583531561994a626a11 /ui | |
parent | bc8b183fbea66e41b23cfd5e7e5e7204a76b0629 (diff) | |
download | talos-petitboot-3af2c04787af928b296079a7e10388fe5958bd8b.tar.gz talos-petitboot-3af2c04787af928b296079a7e10388fe5958bd8b.zip |
ui/ncurses: Handle arrow key variantsv1.6.4
In the vt100 'application' cursor mode arrow keys produce ^[Ox rather
than the usual ^[[x. Add this pattern to our defined keys so we don't
accidentally catch the escape key.
For reference:
http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-21.html
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
(cherry picked from commit 33a0f544151f44bb58924ad281aaca2dc58fe561)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ncurses/nc-cui.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c index 8060510..64b1f64 100644 --- a/ui/ncurses/nc-cui.c +++ b/ui/ncurses/nc-cui.c @@ -98,8 +98,18 @@ static void cui_start(void) define_key("\x1b\x4f\x46", KEY_END); define_key("OH", KEY_HOME); define_key("OF", KEY_END); + + /* Arrow keys in normal cursor mode */ define_key("\x1b\x5b\x41", KEY_UP); define_key("\x1b\x5b\x42", KEY_DOWN); + define_key("\x1b\x5b\x43", KEY_RIGHT); + define_key("\x1b\x5b\x44", KEY_LEFT); + /* Arrow keys in "application" cursor mode */ + define_key("\x1b\x4f\x41", KEY_UP); + define_key("\x1b\x4f\x42", KEY_DOWN); + define_key("\x1b\x4f\x43", KEY_RIGHT); + define_key("\x1b\x4f\x44", KEY_LEFT); + define_key("\x1b\x5b\x33\x7e", KEY_DC); while (getch() != ERR) /* flush stdin */ |