aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-07-13 20:54:52 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-07-13 20:54:52 +0200
commitfc45c978297b76e76756345798a2c51cbbb909dc (patch)
treea1493dde9df6d3a8786b55cdce33f49e24a07818
parent01570f1ff3c402af9a9a48c2cca2c5a830c08315 (diff)
parenteaf54132f98c6d865a3434799c7348a3edfa98af (diff)
downloadrneovim-fc45c978297b76e76756345798a2c51cbbb909dc.tar.gz
rneovim-fc45c978297b76e76756345798a2c51cbbb909dc.tar.bz2
rneovim-fc45c978297b76e76756345798a2c51cbbb909dc.zip
Merge #8736 'vim-patch:8.0.0697: stable keymap.h'
-rw-r--r--src/nvim/keymap.h252
-rw-r--r--test/functional/api/command_spec.lua6
2 files changed, 131 insertions, 127 deletions
diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h
index c64691e8ea..baf8963aa8 100644
--- a/src/nvim/keymap.h
+++ b/src/nvim/keymap.h
@@ -115,135 +115,139 @@
KS_ZERO ? K_ZERO : TERMCAP2KEY(a, b))
// Codes for keys that do not have a termcap name.
+// The numbers are fixed to make sure that recorded key sequences remain valid.
+// Add new entries at the end, not halfway.
//
// K_SPECIAL KS_EXTRA KE_xxx
//
// Entries must be in the range 0x02-0x7f (see comment at K_SPECIAL).
enum key_extra {
- KE_NAME = 3 /* name of this terminal entry */
-
- , KE_S_UP /* shift-up */
- , KE_S_DOWN /* shift-down */
-
- , KE_S_F1 /* shifted function keys */
- , KE_S_F2
- , KE_S_F3
- , KE_S_F4
- , KE_S_F5
- , KE_S_F6
- , KE_S_F7
- , KE_S_F8
- , KE_S_F9
- , KE_S_F10
-
- , KE_S_F11
- , KE_S_F12
- , KE_S_F13
- , KE_S_F14
- , KE_S_F15
- , KE_S_F16
- , KE_S_F17
- , KE_S_F18
- , KE_S_F19
- , KE_S_F20
-
- , KE_S_F21
- , KE_S_F22
- , KE_S_F23
- , KE_S_F24
- , KE_S_F25
- , KE_S_F26
- , KE_S_F27
- , KE_S_F28
- , KE_S_F29
- , KE_S_F30
-
- , KE_S_F31
- , KE_S_F32
- , KE_S_F33
- , KE_S_F34
- , KE_S_F35
- , KE_S_F36
- , KE_S_F37
-
- , KE_MOUSE /* mouse event start */
-
- /*
- * Symbols for pseudo keys which are translated from the real key symbols
- * above.
- */
- , KE_LEFTMOUSE /* Left mouse button click */
- , KE_LEFTDRAG /* Drag with left mouse button down */
- , KE_LEFTRELEASE /* Left mouse button release */
- , KE_MIDDLEMOUSE /* Middle mouse button click */
- , KE_MIDDLEDRAG /* Drag with middle mouse button down */
- , KE_MIDDLERELEASE /* Middle mouse button release */
- , KE_RIGHTMOUSE /* Right mouse button click */
- , KE_RIGHTDRAG /* Drag with right mouse button down */
- , KE_RIGHTRELEASE /* Right mouse button release */
-
- , KE_IGNORE /* Ignored mouse drag/release */
-
- , KE_TAB /* unshifted TAB key */
- , KE_S_TAB_OLD /* shifted TAB key (no longer used) */
-
- , KE_XF1 /* extra vt100 function keys for xterm */
- , KE_XF2
- , KE_XF3
- , KE_XF4
- , KE_XEND /* extra (vt100) end key for xterm */
- , KE_ZEND /* extra (vt100) end key for xterm */
- , KE_XHOME /* extra (vt100) home key for xterm */
- , KE_ZHOME /* extra (vt100) home key for xterm */
- , KE_XUP /* extra vt100 cursor keys for xterm */
- , KE_XDOWN
- , KE_XLEFT
- , KE_XRIGHT
-
- , KE_LEFTMOUSE_NM /* non-mappable Left mouse button click */
- , KE_LEFTRELEASE_NM /* non-mappable left mouse button release */
-
- , KE_S_XF1 /* extra vt100 shifted function keys for xterm */
- , KE_S_XF2
- , KE_S_XF3
- , KE_S_XF4
-
- /* NOTE: The scroll wheel events are inverted: i.e. UP is the same as
- * moving the actual scroll wheel down, LEFT is the same as moving the
- * scroll wheel right. */
- , KE_MOUSEDOWN /* scroll wheel pseudo-button Down */
- , KE_MOUSEUP /* scroll wheel pseudo-button Up */
- , KE_MOUSELEFT /* scroll wheel pseudo-button Left */
- , KE_MOUSERIGHT /* scroll wheel pseudo-button Right */
-
- , KE_KINS /* keypad Insert key */
- , KE_KDEL /* keypad Delete key */
-
- , KE_CSI /* CSI typed directly */
- , KE_SNR /* <SNR> */
- , KE_PLUG /* <Plug> */
- , KE_CMDWIN /* open command-line window from Command-line Mode */
-
- , KE_C_LEFT /* control-left */
- , KE_C_RIGHT /* control-right */
- , KE_C_HOME /* control-home */
- , KE_C_END /* control-end */
-
- , KE_X1MOUSE /* X1/X2 mouse-buttons */
- , KE_X1DRAG
- , KE_X1RELEASE
- , KE_X2MOUSE
- , KE_X2DRAG
- , KE_X2RELEASE
-
- , KE_DROP /* DnD data is available */
- , KE_NOP /* doesn't do something */
- , KE_FOCUSGAINED /* focus gained */
- , KE_FOCUSLOST /* focus lost */
- , KE_EVENT // event
- , KE_PASTE // special key to toggle the 'paste' option.
- // sent only by UIs
- , KE_COMMAND // special key to execute command in any mode
+ KE_NAME = 3 // name of this terminal entry
+
+ , KE_S_UP = 4 // shift-up
+ , KE_S_DOWN = 5 // shift-down
+
+ , KE_S_F1 = 6 // shifted function keys
+ , KE_S_F2 = 7
+ , KE_S_F3 = 8
+ , KE_S_F4 = 9
+ , KE_S_F5 = 10
+ , KE_S_F6 = 11
+ , KE_S_F7 = 12
+ , KE_S_F8 = 13
+ , KE_S_F9 = 14
+ , KE_S_F10 = 15
+
+ , KE_S_F11 = 16
+ , KE_S_F12 = 17
+ , KE_S_F13 = 18
+ , KE_S_F14 = 19
+ , KE_S_F15 = 20
+ , KE_S_F16 = 21
+ , KE_S_F17 = 22
+ , KE_S_F18 = 23
+ , KE_S_F19 = 24
+ , KE_S_F20 = 25
+
+ , KE_S_F21 = 26
+ , KE_S_F22 = 27
+ , KE_S_F23 = 28
+ , KE_S_F24 = 29
+ , KE_S_F25 = 30
+ , KE_S_F26 = 31
+ , KE_S_F27 = 32
+ , KE_S_F28 = 33
+ , KE_S_F29 = 34
+ , KE_S_F30 = 35
+
+ , KE_S_F31 = 36
+ , KE_S_F32 = 37
+ , KE_S_F33 = 38
+ , KE_S_F34 = 39
+ , KE_S_F35 = 40
+ , KE_S_F36 = 41
+ , KE_S_F37 = 42
+
+ , KE_MOUSE = 43 // mouse event start
+
+ // Symbols for pseudo keys which are translated from the real key symbols
+ // above.
+ , KE_LEFTMOUSE = 44 // Left mouse button click
+ , KE_LEFTDRAG = 45 // Drag with left mouse button down
+ , KE_LEFTRELEASE = 46 // Left mouse button release
+ , KE_MIDDLEMOUSE = 47 // Middle mouse button click
+ , KE_MIDDLEDRAG = 48 // Drag with middle mouse button down
+ , KE_MIDDLERELEASE = 49 // Middle mouse button release
+ , KE_RIGHTMOUSE = 50 // Right mouse button click
+ , KE_RIGHTDRAG = 51 // Drag with right mouse button down
+ , KE_RIGHTRELEASE = 52 // Right mouse button release
+
+ , KE_IGNORE = 53 // Ignored mouse drag/release
+
+ , KE_TAB = 54 // unshifted TAB key
+ , KE_S_TAB_OLD = 55 // shifted TAB key (no longer used)
+
+ // , KE_SNIFF_UNUSED = 56 // obsolete
+ , KE_XF1 = 57 // extra vt100 function keys for xterm
+ , KE_XF2 = 58
+ , KE_XF3 = 59
+ , KE_XF4 = 60
+ , KE_XEND = 61 // extra (vt100) end key for xterm
+ , KE_ZEND = 62 // extra (vt100) end key for xterm
+ , KE_XHOME = 63 // extra (vt100) home key for xterm
+ , KE_ZHOME = 64 // extra (vt100) home key for xterm
+ , KE_XUP = 65 // extra vt100 cursor keys for xterm
+ , KE_XDOWN = 66
+ , KE_XLEFT = 67
+ , KE_XRIGHT = 68
+
+ , KE_LEFTMOUSE_NM = 69 // non-mappable Left mouse button click
+ , KE_LEFTRELEASE_NM = 70 // non-mappable left mouse button release
+
+ , KE_S_XF1 = 71 // vt100 shifted function keys for xterm
+ , KE_S_XF2 = 72
+ , KE_S_XF3 = 73
+ , KE_S_XF4 = 74
+
+ // NOTE: The scroll wheel events are inverted: i.e. UP is the same as
+ // moving the actual scroll wheel down, LEFT is the same as moving the
+ // scroll wheel right.
+ , KE_MOUSEDOWN = 75 // scroll wheel pseudo-button Down
+ , KE_MOUSEUP = 76 // scroll wheel pseudo-button Up
+ , KE_MOUSELEFT = 77 // scroll wheel pseudo-button Left
+ , KE_MOUSERIGHT = 78 // scroll wheel pseudo-button Right
+
+ , KE_KINS = 79 // keypad Insert key
+ , KE_KDEL = 80 // keypad Delete key
+
+ , KE_CSI = 81 // CSI typed directly
+ , KE_SNR = 82 // <SNR>
+ , KE_PLUG = 83 // <Plug>
+ , KE_CMDWIN = 84 // open command-line window from Command-line Mode
+
+ , KE_C_LEFT = 85 // control-left
+ , KE_C_RIGHT = 86 // control-right
+ , KE_C_HOME = 87 // control-home
+ , KE_C_END = 88 // control-end
+
+ , KE_X1MOUSE = 89 // X1/X2 mouse-buttons
+ , KE_X1DRAG = 90
+ , KE_X1RELEASE = 91
+ , KE_X2MOUSE = 92
+ , KE_X2DRAG = 93
+ , KE_X2RELEASE = 94
+
+ , KE_DROP = 95 // DnD data is available
+ // , KE_CURSORHOLD = 96 // CursorHold event
+ , KE_NOP = 97 // doesn't do something
+ , KE_FOCUSGAINED = 98 // focus gained
+ , KE_FOCUSLOST = 99 // focus lost
+ // , KE_MOUSEMOVE = 100 // mouse moved with no button down
+ // , KE_CANCEL = 101 // return from vgetc
+ , KE_EVENT = 102 // event
+ , KE_PASTE = 103 // special key to toggle the 'paste' option.
+ // sent only by UIs
+ , KE_COMMAND = 104 // <Cmd> special key
};
/*
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index f3f9f93649..b7520235b7 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -55,9 +55,9 @@ describe('nvim_get_commands', function()
it('gets various command attributes', function()
local cmd0 = { addr='arguments', bang=false, bar=false, complete='dir', complete_arg=NIL, count='10', definition='pwd <args>', name='TestCmd', nargs='0', range='10', register=false, script_id=0, }
local cmd1 = { addr=NIL, bang=false, bar=false, complete='custom', complete_arg='ListUsers', count=NIL, definition='!finger <args>', name='Finger', nargs='+', range=NIL, register=false, script_id=1, }
- local cmd2 = { addr=NIL, bang=true, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253Q2_foo(<q-args>)', name='Cmd2', nargs='*', range=NIL, register=false, script_id=2, }
- local cmd3 = { addr=NIL, bang=false, bar=true, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253Q3_ohyeah()', name='Cmd3', nargs='0', range=NIL, register=false, script_id=3, }
- local cmd4 = { addr=NIL, bang=false, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253Q4_just_great()', name='Cmd4', nargs='0', range=NIL, register=true, script_id=4, }
+ local cmd2 = { addr=NIL, bang=true, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253R2_foo(<q-args>)', name='Cmd2', nargs='*', range=NIL, register=false, script_id=2, }
+ local cmd3 = { addr=NIL, bang=false, bar=true, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253R3_ohyeah()', name='Cmd3', nargs='0', range=NIL, register=false, script_id=3, }
+ local cmd4 = { addr=NIL, bang=false, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253R4_just_great()', name='Cmd4', nargs='0', range=NIL, register=true, script_id=4, }
source([[
command -complete=custom,ListUsers -nargs=+ Finger !finger <args>
]])