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.
249591057b

A hunk from the patch depends on patch 8.2.4861, which hasn't been
ported yet, but that should be easy to notice.
This commit is contained in:
zeertzjq
2022-05-10 07:58:58 +08:00
committed by GitHub
parent c55867b46d
commit 9aa5647e68
40 changed files with 438 additions and 470 deletions

View File

@@ -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.
// 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
// 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 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 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 MAP_ALL_MODES 0xff // all mode bits used for mapping
#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.
#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.
// all mode bits used for mapping
#define MAP_ALL_MODES (0x3f | SELECTMODE | TERM_FOCUS)
/// Directions.
typedef enum {