File: KEYPAD

package info (click to toggle)
kbtin 1.0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,212 kB
  • ctags: 1,149
  • sloc: ansic: 18,124; sh: 7,640; perl: 142; makefile: 137
file content (72 lines) | stat: -rw-r--r-- 2,471 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Unfortunately, while most terminals claim vt100 compatibility, they
lot of them lack the so-called "application cursor mode".  This is
the only reasonable portable to use the keypad arrows, so #keypad won't
work on those terminals.

Terminals I checked:

* Linux console:
    works just fine

* PuTTY:
    works just fine

* aterm:
    works just fine

* rxvt:
    newer versions work fine, older ones have a bug that causes the
    down arrow to be misreported as the diagonal up-left one.  This
    bug is hard-coded in rxvt -- so the only option that doesn't
    involve patching the source is upgrading to a newer version.

* wterm:
    it's based on old rxvt code, and I'm not aware of a fixed version.
    Of course, you can just get the sources and apply this patch:
--- command.c~  2003-09-29 00:16:49.000000000 -0400
+++ command.c   2003-09-29 00:30:21.000000000 -0400
@@ -1562,11 +1562,11 @@
            case XK_KP_Left:    /* \033Ot or standard */
            case XK_KP_Up:      /* \033Ox or standard */
            case XK_KP_Right:   /* \033Ov or standard */
-           case XK_KP_Down:    /* \033Ow or standard */
+           case XK_KP_Down:    /* \033Or or standard */
                if ((PrivateModes && PrivMode_aplKP) ? !shft : shft) {
                    len = 3;
                    STRCPY(kbuf, "\033OZ");
-                   kbuf[2] = ("txvw"[keysym - XK_KP_Left]);
+                   kbuf[2] = ("txvr"[keysym - XK_KP_Left]);
                    break;
                } else {
                /* translate to std. cursor key */

* Eterm:
    works just fine

* gnome-terminal:
    in recent versions, the keypad is available in gnome-terminal's vt220
    mode.  Thus, KBtin will attempt to switch to it.  Too bad, a few of
    the key codes are wrong -- KpadDivide is reported as KpadMinus, and
    KpadMinus as ESCOm.

* konsole:
    doesn't work, and I'm not aware of a workaround

* xterm:
    in many cases, it can be switched to an appropriate mode, with same
    problems as with gnome-terminal.  Otherwise, it requires some tinkering
    with xmodmap.  It seems that feeding the following to xmodmap will make
    #keypad work (making the NumLock key stuck as a side effect, though).

keycode  79 = KP_7
keycode  80 = KP_8
keycode  81 = KP_9
keycode  83 = KP_4
keycode  84 = KP_5
keycode  85 = KP_6
keycode  87 = KP_1
keycode  88 = KP_2
keycode  89 = KP_3
keycode  90 = KP_0
keycode  91 = KP_Decimal
(thanks Elariel for this solution!)