summaryrefslogtreecommitdiff
path: root/i386/i386at/kd.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-06-09 18:15:47 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-06-11 10:34:25 +0200
commitd18f4890ffb8d407a9c94c251f01712ecef767ca (patch)
treee52ca7f9564e560b81c244682dc1477dd2bdf2d8 /i386/i386at/kd.c
parent24367e94ccb1e1b74b865d27ec31184184cd98e7 (diff)
i386: remap some keys
As a convenience for the nice people using our debugger, remap some keys to the readline-like shortcuts supported by dde. * i386/i386at/kd.c (kdcnmaygetc): Remap some keys.
Diffstat (limited to 'i386/i386at/kd.c')
-rw-r--r--i386/i386at/kd.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
index 5371fb2..7339767 100644
--- a/i386/i386at/kd.c
+++ b/i386/i386at/kd.c
@@ -3029,6 +3029,39 @@ kdcnmaygetc(void)
#ifdef notdef
cnsetleds(state2leds(kd_state));
#endif
+ } else if (! up
+ && c == K_ESC
+ && key_map[scancode][char_idx+1] == 0x5b) {
+ /* As a convenience for the nice
+ people using our debugger, remap
+ some keys to the readline-like
+ shortcuts supported by dde.
+
+ XXX This is a workaround for the
+ limited kernel getchar interface.
+ It is only used by the debugger. */
+ c = key_map[scancode][char_idx+2];
+ switch (c) {
+#define _MAP(A,B,C) (C)
+#define MAP(T) _MAP(T)
+#define CTRL(c) ((c) & 0x1f)
+ case MAP(K_HOME): c = CTRL('a'); break;
+ case MAP(K_UA): c = CTRL('p'); break;
+ case MAP(K_LA): c = CTRL('b'); break;
+ case MAP(K_RA): c = CTRL('f'); break;
+ case MAP(K_DA): c = CTRL('n'); break;
+ case MAP(K_END): c = CTRL('e'); break;
+ /* delete */
+ case 0x39: c = CTRL('d'); break;
+#undef CTRL
+#undef MAP
+#undef _MAP
+ default:
+ /* Retain the old behavior. */
+ c = K_ESC;
+ }
+
+ return(c);
} else if (!up) {
/* regular key-down */
if (c == K_CR)