diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-05-07 20:01:16 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-07 20:01:16 +0100 |
commit | 249591057b4840785c50e41dd850efb8a8faf435 (patch) | |
tree | e9ba171529cf753e7aab0ec9adf5be3fedc17d00 /src/vim.h | |
parent | 9ff7d717aa3176de5c61de340deb93f41c7780fc (diff) |
patch 8.2.4911: the mode #defines are not clearly namedv8.2.4911
Problem: The mode #defines are not clearly named.
Solution: Prepend MODE_. Renumber them to put the mapped modes first.
Diffstat (limited to 'src/vim.h')
-rw-r--r-- | src/vim.h | 69 |
1 files changed, 35 insertions, 34 deletions
@@ -667,44 +667,46 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); #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. + * 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 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 +#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 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 TERMINAL 0x2000 // Terminal mode +#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_ALL 0xffff -#define MODE_MAX_LENGTH 4 // max mode length returned in mode() - -// all mode bits used for mapping -#define MAP_ALL_MODES (0x3f | SELECTMODE | TERMINAL) +#define MODE_MAX_LENGTH 4 // max mode length used by get_mode(), + // including the terminating NUL // directions #define FORWARD 1 @@ -2484,7 +2486,6 @@ typedef enum { /* * Avoid clashes between Perl and Vim namespace. */ -# undef NORMAL # undef STRLEN # undef FF # undef OP_DELETE |