]> git.ozlabs.org Git - petitboot/commitdiff
ui/ncurses: Always provide a key definition for backtab
authorJeremy Kerr <jk@ozlabs.org>
Tue, 15 Apr 2014 03:48:00 +0000 (11:48 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 16 Apr 2014 01:08:45 +0000 (09:08 +0800)
Petitboot environments will probably want a basic terminfo defintion
(eg, vt220) rather than a full linux or xterm, but vt220 and friends
don't define a backtab key. Backtab can be useful for proper form
navigation, and without a key definition, we just get an escape, which
exits the current screen.

This change provides a static definition for KEY_BTAB, so we should
always have one available.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/ncurses/nc-cui.c

index 18604c9e04a06a2435f956a6b1b89bc897d05986..5f5640975c2356b00d2d3a71a8585af5974ef54a 100644 (file)
@@ -58,6 +58,11 @@ static void cui_start(void)
        define_key("\x7f", KEY_BACKSPACE);
        define_key("\x08", KEY_BACKSPACE);
 
        define_key("\x7f", KEY_BACKSPACE);
        define_key("\x08", KEY_BACKSPACE);
 
+       /* we need backtab too, for form navigation. vt220 doesn't include
+        * this (kcbt), but we don't want to require a full linux/xterm termcap
+        */
+       define_key("\x1b[Z", KEY_BTAB);
+
        while (getch() != ERR)          /* flush stdin */
                (void)0;
 }
        while (getch() != ERR)          /* flush stdin */
                (void)0;
 }