aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/vim.h
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-05-10 07:58:58 +0800
committerGitHub <noreply@github.com>2022-05-10 07:58:58 +0800
commit9aa5647e686e5420e5b9b51828ec7d55631f98ed (patch)
tree81172459aa5b8ac5c1f2e4e0b322e70267712ecd /src/nvim/vim.h
parentc55867b46d6758c4ff2e55d1bfb4cfc163182a12 (diff)
downloadrneovim-9aa5647e686e5420e5b9b51828ec7d55631f98ed.tar.gz
rneovim-9aa5647e686e5420e5b9b51828ec7d55631f98ed.tar.bz2
rneovim-9aa5647e686e5420e5b9b51828ec7d55631f98ed.zip
vim-patch:8.2.4911: the mode #defines are not clearly named (#18499)
Problem: The mode #defines are not clearly named. Solution: Prepend MODE_. Renumber them to put the mapped modes first. https://github.com/vim/vim/commit/249591057b4840785c50e41dd850efb8a8faf435 A hunk from the patch depends on patch 8.2.4861, which hasn't been ported yet, but that should be easy to notice.
Diffstat (limited to 'src/nvim/vim.h')
-rw-r--r--src/nvim/vim.h70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 3c8a865fb1..4e269bc9d4 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -38,42 +38,42 @@ enum { NUMBUFLEN = 65, };
#define MSG_HIST 0x1000
-// values for State
+// Values for State
//
-// The lower bits up to 0x20 are used to distinguish normal/visual/op_pending
-// and cmdline/insert+replace mode. This is used for mapping. If none of
-// these bits are set, no mapping is done.
-// The upper bits are used to distinguish between other states.
-
-#define NORMAL 0x01 // Normal mode, command expected
-#define VISUAL 0x02 // Visual mode - use get_real_state()
-#define OP_PENDING 0x04 // Normal mode, operator is pending - use
- // get_real_state()
-#define CMDLINE 0x08 // Editing command line
-#define INSERT 0x10 // Insert mode
-#define LANGMAP 0x20 // Language mapping, can be combined with
- // INSERT and CMDLINE
-
-#define REPLACE_FLAG 0x40 // Replace mode flag
-#define REPLACE (REPLACE_FLAG + INSERT)
-#define VREPLACE_FLAG 0x80 // Virtual-replace mode flag
-#define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT)
-#define LREPLACE (REPLACE_FLAG + LANGMAP)
-
-#define NORMAL_BUSY (0x100 + NORMAL) // Normal mode, busy with a command
-#define HITRETURN (0x200 + NORMAL) // waiting for return or command
-#define ASKMORE 0x300 // Asking if you want --more--
-#define SETWSIZE 0x400 // window size has changed
-#define ABBREV 0x500 // abbreviation instead of mapping
-#define EXTERNCMD 0x600 // executing an external command
-#define SHOWMATCH (0x700 + INSERT) // show matching paren
-#define CONFIRM 0x800 // ":confirm" prompt
-#define SELECTMODE 0x1000 // Select mode, only for mappings
-#define TERM_FOCUS 0x2000 // Terminal focus mode
-#define CMDPREVIEW 0x4000 // Showing 'inccommand' command "live" preview.
-
-// all mode bits used for mapping
-#define MAP_ALL_MODES (0x3f | SELECTMODE | TERM_FOCUS)
+// The lower bits up to 0x80 are used to distinguish normal/visual/op_pending
+// /cmdline/insert/replace/terminal mode. This is used for mapping. If none
+// of these bits are set, no mapping is done. See the comment above do_map().
+// The upper bits are used to distinguish between other states and variants of
+// the base modes.
+
+#define MODE_NORMAL 0x01 // Normal mode, command expected
+#define MODE_VISUAL 0x02 // Visual mode - use get_real_state()
+#define MODE_OP_PENDING 0x04 // Normal mode, operator is pending - use
+ // get_real_state()
+#define MODE_CMDLINE 0x08 // Editing the command line
+#define MODE_INSERT 0x10 // Insert mode, also for Replace mode
+#define MODE_LANGMAP 0x20 // Language mapping, can be combined with
+ // MODE_INSERT and MODE_CMDLINE
+#define MODE_SELECT 0x40 // Select mode, use get_real_state()
+#define MODE_TERMINAL 0x80 // Terminal mode
+
+#define MAP_ALL_MODES 0xff // all mode bits used for mapping
+
+#define REPLACE_FLAG 0x100 // Replace mode flag
+#define MODE_REPLACE (REPLACE_FLAG | MODE_INSERT)
+#define VREPLACE_FLAG 0x200 // Virtual-replace mode flag
+#define MODE_VREPLACE (REPLACE_FLAG | VREPLACE_FLAG | MODE_INSERT)
+#define MODE_LREPLACE (REPLACE_FLAG | MODE_LANGMAP)
+
+#define MODE_NORMAL_BUSY (0x1000 | MODE_NORMAL) // Normal mode, busy with a command
+#define MODE_HITRETURN (0x2000 | MODE_NORMAL) // waiting for return or command
+#define MODE_ASKMORE 0x3000 // Asking if you want --more--
+#define MODE_SETWSIZE 0x4000 // window size has changed
+#define MODE_EXTERNCMD 0x5000 // executing an external command
+#define MODE_SHOWMATCH (0x6000 | MODE_INSERT) // show matching paren
+#define MODE_CONFIRM 0x7000 // ":confirm" prompt
+#define MODE_CMDPREVIEW 0x8000 // Showing 'inccommand' command "live" preview.
+
/// Directions.
typedef enum {