Mercurial > vim
annotate src/libvterm/src/keyboard.c @ 31192:dcde141f2d1e v9.0.0930
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Commit: https://github.com/vim/vim/commit/63a2e360cca2c70ab0a85d14771d3259d4b3aafa
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 23 20:20:18 2022 +0000
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Problem: Cannot debug the Kitty keyboard protocol with TermDebug.
Solution: Add Kitty keyboard protocol support to the libvterm fork.
Recognize the escape sequences that the protocol generates. Add
the 'keyprotocol' option to allow the user to specify for which
terminal what protocol is to be used, instead of hard-coding this.
Add recognizing the kitty keyboard protocol status.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 23 Nov 2022 21:30:04 +0100 |
parents | 0ecb16d5f86f |
children |
rev | line source |
---|---|
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 #include "vterm_internal.h" |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 #include <stdio.h> |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 #include "utf8.h" |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
7 // VIM: added |
18279
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
8 int vterm_is_modify_other_keys(VTerm *vt) |
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
9 { |
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
10 return vt->state->mode.modify_other_keys; |
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
11 } |
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
12 |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
13 // VIM: added |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
14 int vterm_is_kitty_keyboard(VTerm *vt) |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
15 { |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
16 return vt->state->mode.kitty_keyboard; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
17 } |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
18 |
18279
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
19 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 { |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
22 // VIM: added modifyOtherKeys support |
31156
0ecb16d5f86f
patch 9.0.0912: libvterm with modifyOtherKeys level 2 does not match xterm
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
23 if (vterm_is_modify_other_keys(vt) && mod != 0) { |
18279
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
24 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "27;%d;%d~", mod+1, c); |
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
25 return; |
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
26 } |
e8d1f3209dcd
patch 8.1.2134: modifier keys are not always recognized
Bram Moolenaar <Bram@vim.org>
parents:
17777
diff
changeset
|
27 |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
28 // VIM: added kitty keyboard protocol support |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
29 if (vterm_is_kitty_keyboard(vt) && mod != 0) { |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
30 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", c, mod+1); |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
31 return; |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
32 } |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
33 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
34 /* The shift modifier is never important for Unicode characters |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
35 * apart from Space |
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
36 */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 if(c != ' ') |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 mod &= ~VTERM_MOD_SHIFT; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 if(mod == 0) { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
41 // Normal text - ignore just shift |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 char str[6]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 int seqlen = fill_utf8(c, str); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 vterm_push_output_bytes(vt, str, seqlen); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
48 int needs_CSIu; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 switch(c) { |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
50 /* Special Ctrl- letters that can't be represented elsewise */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 case 'i': case 'j': case 'm': case '[': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 needs_CSIu = 1; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 break; |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
54 /* Ctrl-\ ] ^ _ don't need CSUu */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 case '\\': case ']': case '^': case '_': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 needs_CSIu = 0; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 break; |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
58 /* Shift-space needs CSIu */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 case ' ': |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 needs_CSIu = !!(mod & VTERM_MOD_SHIFT); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 break; |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
62 /* All other characters needs CSIu except for letters a-z */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 default: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 needs_CSIu = (c < 'a' || c > 'z'); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
67 /* ALT we can just prefix with ESC; anything else requires CSI u */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 if(needs_CSIu && (mod & ~VTERM_MOD_ALT)) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", c, mod+1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 if(mod & VTERM_MOD_CTRL) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 c &= 0x1f; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 vterm_push_output_sprintf(vt, "%s%c", mod & VTERM_MOD_ALT ? ESC_S : "", c); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 typedef struct { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 enum { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 KEYCODE_NONE, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 KEYCODE_LITERAL, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 KEYCODE_TAB, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 KEYCODE_ENTER, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 KEYCODE_SS3, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 KEYCODE_CSI, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 KEYCODE_CSI_CURSOR, |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 KEYCODE_CSINUM, |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
89 KEYCODE_KEYPAD, |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 } type; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 char literal; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 int csinum; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 } keycodes_s; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 |
17777
811a12a78164
patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
13770
diff
changeset
|
95 // Order here must be exactly the same as VTermKey enum! |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 static keycodes_s keycodes[] = { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
97 { KEYCODE_NONE, 0, 0 }, // NONE |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
99 { KEYCODE_ENTER, '\r', 0 }, // ENTER |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
100 { KEYCODE_TAB, '\t', 0 }, // TAB |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
101 { KEYCODE_LITERAL, '\x7f', 0 }, // BACKSPACE == ASCII DEL |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
102 { KEYCODE_LITERAL, '\x1b', 0 }, // ESCAPE |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
104 { KEYCODE_CSI_CURSOR, 'A', 0 }, // UP |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
105 { KEYCODE_CSI_CURSOR, 'B', 0 }, // DOWN |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
106 { KEYCODE_CSI_CURSOR, 'D', 0 }, // LEFT |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
107 { KEYCODE_CSI_CURSOR, 'C', 0 }, // RIGHT |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
109 { KEYCODE_CSINUM, '~', 2 }, // INS |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
110 { KEYCODE_CSINUM, '~', 3 }, // DEL |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
111 { KEYCODE_CSI_CURSOR, 'H', 0 }, // HOME |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
112 { KEYCODE_CSI_CURSOR, 'F', 0 }, // END |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
113 { KEYCODE_CSINUM, '~', 5 }, // PAGEUP |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
114 { KEYCODE_CSINUM, '~', 6 }, // PAGEDOWN |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 static keycodes_s keycodes_fn[] = { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
118 { KEYCODE_NONE, 0, 0 }, // F0 - shouldn't happen |
20458
ffadba5f898c
patch 8.2.0783: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
119 { KEYCODE_SS3, 'P', 0 }, // F1 |
ffadba5f898c
patch 8.2.0783: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
120 { KEYCODE_SS3, 'Q', 0 }, // F2 |
ffadba5f898c
patch 8.2.0783: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
121 { KEYCODE_SS3, 'R', 0 }, // F3 |
ffadba5f898c
patch 8.2.0783: libvterm code lags behind the upstream version
Bram Moolenaar <Bram@vim.org>
parents:
18279
diff
changeset
|
122 { KEYCODE_SS3, 'S', 0 }, // F4 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
123 { KEYCODE_CSINUM, '~', 15 }, // F5 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
124 { KEYCODE_CSINUM, '~', 17 }, // F6 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
125 { KEYCODE_CSINUM, '~', 18 }, // F7 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
126 { KEYCODE_CSINUM, '~', 19 }, // F8 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
127 { KEYCODE_CSINUM, '~', 20 }, // F9 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
128 { KEYCODE_CSINUM, '~', 21 }, // F10 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
129 { KEYCODE_CSINUM, '~', 23 }, // F11 |
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
130 { KEYCODE_CSINUM, '~', 24 }, // F12 |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 static keycodes_s keycodes_kp[] = { |
13770
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
134 { KEYCODE_KEYPAD, '0', 'p' }, // KP_0 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
135 { KEYCODE_KEYPAD, '1', 'q' }, // KP_1 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
136 { KEYCODE_KEYPAD, '2', 'r' }, // KP_2 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
137 { KEYCODE_KEYPAD, '3', 's' }, // KP_3 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
138 { KEYCODE_KEYPAD, '4', 't' }, // KP_4 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
139 { KEYCODE_KEYPAD, '5', 'u' }, // KP_5 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
140 { KEYCODE_KEYPAD, '6', 'v' }, // KP_6 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
141 { KEYCODE_KEYPAD, '7', 'w' }, // KP_7 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
142 { KEYCODE_KEYPAD, '8', 'x' }, // KP_8 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
143 { KEYCODE_KEYPAD, '9', 'y' }, // KP_9 |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
144 { KEYCODE_KEYPAD, '*', 'j' }, // KP_MULT |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
145 { KEYCODE_KEYPAD, '+', 'k' }, // KP_PLUS |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
146 { KEYCODE_KEYPAD, ',', 'l' }, // KP_COMMA |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
147 { KEYCODE_KEYPAD, '-', 'm' }, // KP_MINUS |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
148 { KEYCODE_KEYPAD, '.', 'n' }, // KP_PERIOD |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
149 { KEYCODE_KEYPAD, '/', 'o' }, // KP_DIVIDE |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
150 { KEYCODE_KEYPAD, '\n', 'M' }, // KP_ENTER |
2449b6ce1456
patch 8.0.1757: unnecessary changes in libvterm
Christian Brabandt <cb@256bit.org>
parents:
11761
diff
changeset
|
151 { KEYCODE_KEYPAD, '=', 'X' }, // KP_EQUAL |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 }; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 if(key == VTERM_KEY_NONE) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 |
30880
82336c3b679d
patch 9.0.0774: the libvterm code is outdated
Bram Moolenaar <Bram@vim.org>
parents:
20518
diff
changeset
|
159 keycodes_s k; |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 if(key < VTERM_KEY_FUNCTION_0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 if(key >= sizeof(keycodes)/sizeof(keycodes[0])) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 k = keycodes[key]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 else if(key >= VTERM_KEY_FUNCTION_0 && key <= VTERM_KEY_FUNCTION_MAX) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 if((key - VTERM_KEY_FUNCTION_0) >= sizeof(keycodes_fn)/sizeof(keycodes_fn[0])) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 k = keycodes_fn[key - VTERM_KEY_FUNCTION_0]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 else if(key >= VTERM_KEY_KP_0) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 if((key - VTERM_KEY_KP_0) >= sizeof(keycodes_kp)/sizeof(keycodes_kp[0])) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 return; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 k = keycodes_kp[key - VTERM_KEY_KP_0]; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 switch(k.type) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 case KEYCODE_NONE: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 case KEYCODE_TAB: |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
181 if (vterm_is_kitty_keyboard(vt) && mod != 0) |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
182 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "9;%du", mod+1); |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
183 /* Shift-Tab is CSI Z but plain Tab is 0x09 */ |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
184 else if(mod == VTERM_MOD_SHIFT) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "Z"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 else if(mod & VTERM_MOD_SHIFT) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "1;%dZ", mod+1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 goto case_LITERAL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 case KEYCODE_ENTER: |
20518
a4652d7ec99f
patch 8.2.0813: libvterm code is slightly different from upstream
Bram Moolenaar <Bram@vim.org>
parents:
20458
diff
changeset
|
193 /* Enter is CRLF in newline mode, but just LF in linefeed */ |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 if(vt->state->mode.newline) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 vterm_push_output_sprintf(vt, "\r\n"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 goto case_LITERAL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 case KEYCODE_LITERAL: case_LITERAL: |
31156
0ecb16d5f86f
patch 9.0.0912: libvterm with modifyOtherKeys level 2 does not match xterm
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
201 if (vterm_is_modify_other_keys(vt) && mod != 0) |
0ecb16d5f86f
patch 9.0.0912: libvterm with modifyOtherKeys level 2 does not match xterm
Bram Moolenaar <Bram@vim.org>
parents:
30880
diff
changeset
|
202 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "27;%d;%d~", mod+1, k.literal); |
31192
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
203 else if (vterm_is_kitty_keyboard(vt) && mod == 0 && k.literal == '\x1b') |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
204 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%du", k.literal); |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
205 else if ((vterm_is_kitty_keyboard(vt) && mod != 0) |
dcde141f2d1e
patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebug
Bram Moolenaar <Bram@vim.org>
parents:
31156
diff
changeset
|
206 || (mod & (VTERM_MOD_SHIFT|VTERM_MOD_CTRL))) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", k.literal, mod+1); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 vterm_push_output_sprintf(vt, mod & VTERM_MOD_ALT ? ESC_S "%c" : "%c", k.literal); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 case KEYCODE_SS3: case_SS3: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 if(mod == 0) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 vterm_push_output_sprintf_ctrl(vt, C1_SS3, "%c", k.literal); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 goto case_CSI; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 case KEYCODE_CSI: case_CSI: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 if(mod == 0) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%c", k.literal); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "1;%d%c", mod + 1, k.literal); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 case KEYCODE_CSINUM: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 if(mod == 0) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d%c", k.csinum, k.literal); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%d%c", k.csinum, mod + 1, k.literal); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 break; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 case KEYCODE_CSI_CURSOR: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 if(vt->state->mode.cursor) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 goto case_SS3; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 goto case_CSI; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 case KEYCODE_KEYPAD: |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 if(vt->state->mode.keypad) { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 k.literal = k.csinum; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 goto case_SS3; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 else |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 goto case_LITERAL; |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
246 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 void vterm_keyboard_start_paste(VTerm *vt) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
251 if(vt->state->mode.bracketpaste) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "200~"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 } |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 void vterm_keyboard_end_paste(VTerm *vt) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 { |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 if(vt->state->mode.bracketpaste) |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 vterm_push_output_sprintf_ctrl(vt, C1_CSI, "201~"); |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 } |