summaryrefslogtreecommitdiff
path: root/i386/i386at/kd.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-07-06 18:46:22 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-07-06 18:46:22 +0200
commit02356436fc183e0b8ef357cde5196c493ab33d15 (patch)
tree104e7dd238b3b524d5a2a4da192550751e019877 /i386/i386at/kd.c
parentc031b41b783cc99c0bd5aac7d14c1d6e34520397 (diff)
parent0ab9ef8ab8c57ab83cb01bef37ca6d30395a43a2 (diff)
Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumach
Diffstat (limited to 'i386/i386at/kd.c')
-rw-r--r--i386/i386at/kd.c60
1 files changed, 42 insertions, 18 deletions
diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
index 9f9faf4..7339767 100644
--- a/i386/i386at/kd.c
+++ b/i386/i386at/kd.c
@@ -240,8 +240,7 @@ unsigned char key_map[NUMKEYS][WIDTH_KMAP] = {
{K_LBRKT,NC,NC, K_LBRACE,NC,NC, K_ESC,NC,NC, 0x1b,K_LBRKT,NC, 0x1b,0x4e,K_LBRACE},
{K_RBRKT,NC,NC, K_RBRACE,NC,NC, K_GS,NC,NC, 0x1b,K_RBRKT,NC, 0x1b,0x4e,K_RBRACE},
{K_CR,NC,NC, K_CR,NC,NC, K_CR,NC,NC, 0x1b,K_CR,NC, K_CR,NC,NC},
-{K_SCAN,K_CTLSC,NC, K_SCAN,K_CTLSC,NC, K_SCAN,K_CTLSC,NC, K_SCAN,K_CTLSC,NC,
- K_SCAN,K_CTLSC,NC},
+{K_SCAN,K_CTLSC,NC, K_SCAN,K_CTLSC,NC, K_SCAN,K_CTLSC,NC, K_SCAN,K_CTLSC,NC, K_SCAN,K_CTLSC,NC},
{K_a,NC,NC, K_A,NC,NC, K_SOH,NC,NC, 0x1b,K_a,NC, 0x1b,0x4e,K_A},
{K_s,NC,NC, K_S,NC,NC, K_DC3,NC,NC, 0x1b,K_s,NC, 0x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RSHSC,NC, K_SCAN,K_RSHSC,NC, K_SCAN,K_RSHSC,NC, K_SCAN,K_RSHSC,NC,
- K_SCAN,K_RSHSC,NC},
+{K_SCAN,K_RSHSC,NC, K_SCAN,K_RSHSC,NC, K_SCAN,K_RSHSC,NC, K_SCAN,K_RSHSC,NC, K_SCAN,K_RSHSC,NC},
{K_ASTER,NC,NC, K_ASTER,NC,NC, K_ASTER,NC,NC, 0x1b,K_ASTER,NC, 0x1b,0x4e,K_ASTER},
-{K_SCAN,K_ALTSC,NC, K_SCAN,K_ALTSC,NC, K_SCAN,K_ALTSC,NC, K_SCAN,K_ALTSC,NC,
- K_SCAN,K_ALTSC,NC},
+{K_SCAN,K_ALTSC,NC, K_SCAN,K_ALTSC,NC, K_SCAN,K_ALTSC,NC, K_SCAN,K_ALTSC,NC, K_SCAN,K_ALTSC,NC},
{K_SPACE,NC,NC, K_SPACE,NC,NC, K_NUL,NC,NC, 0x1b,K_SPACE,NC, K_SPACE,NC,NC},
-{K_SCAN,K_CLCKSC,NC, K_SCAN,K_CLCKSC,NC, K_SCAN,K_CLCKSC,NC,
- K_SCAN,K_CLCKSC,NC, K_SCAN,K_CLCKSC,NC},
+{K_SCAN,K_CLCKSC,NC, K_SCAN,K_CLCKSC,NC, K_SCAN,K_CLCKSC,NC, K_SCAN,K_CLCKSC,NC, K_SCAN,K_CLCKSC,NC},
{K_F1, K_F1S, K_F1, K_F1A, K_F1S},
{K_F2, K_F2S, K_F2, K_F2A, K_F2S},
{K_F3, K_F3S, K_F3, K_F3A, K_F3S},
@@ -285,20 +280,16 @@ unsigned char key_map[NUMKEYS][WIDTH_KMAP] = {
{K_F8, K_F8S, K_F8, K_F8A, K_F8S},
{K_F9, K_F9S, K_F9, K_F9A, K_F9S},
{K_F10, K_F10S, K_F10, K_F10A, K_F10S},
-{K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC,
- K_SCAN,K_NLCKSC,NC, K_SCAN,K_N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etc(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)