summaryrefslogtreecommitdiffstats
path: root/src/misc1.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-07 20:01:16 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-07 20:01:16 +0100
commit249591057b4840785c50e41dd850efb8a8faf435 (patch)
treee9ba171529cf753e7aab0ec9adf5be3fedc17d00 /src/misc1.c
parent9ff7d717aa3176de5c61de340deb93f41c7780fc (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/misc1.c')
-rw-r--r--src/misc1.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/misc1.c b/src/misc1.c
index 2d41e358be..7a5fecd104 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -455,13 +455,13 @@ plines_win_col(win_T *wp, linenr_T lnum, long column)
/*
* If *s is a TAB, and the TAB is not displayed as ^I, and we're not in
- * INSERT mode, then col must be adjusted so that it represents the last
- * screen position of the TAB. This only fixes an error when the TAB wraps
- * from one screen line to the next (when 'columns' is not a multiple of
- * 'ts') -- webb.
+ * MODE_INSERT state, then col must be adjusted so that it represents the
+ * last screen position of the TAB. This only fixes an error when the TAB
+ * wraps from one screen line to the next (when 'columns' is not a multiple
+ * of 'ts') -- webb.
*/
- if (*s == TAB && (State & NORMAL) && (!wp->w_p_list ||
- wp->w_lcs_chars.tab1))
+ if (*s == TAB && (State & MODE_NORMAL)
+ && (!wp->w_p_list || wp->w_lcs_chars.tab1))
col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL) - 1;
/*
@@ -595,7 +595,7 @@ ask_yesno(char_u *str, int direct)
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; // disallow scrolling here
#endif
- State = CONFIRM; // mouse behaves like with :confirm
+ State = MODE_CONFIRM; // mouse behaves like with :confirm
setmouse(); // disables mouse for xterm
++no_mapping;
++allow_keys; // no mapping here, but recognize keys
@@ -656,18 +656,19 @@ get_mode(char_u *buf)
buf[i++] = 's';
}
}
- else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE
- || State == CONFIRM)
+ else if (State == MODE_HITRETURN || State == MODE_ASKMORE
+ || State == MODE_SETWSIZE
+ || State == MODE_CONFIRM)
{
buf[i++] = 'r';
- if (State == ASKMORE)
+ if (State == MODE_ASKMORE)
buf[i++] = 'm';
- else if (State == CONFIRM)
+ else if (State == MODE_CONFIRM)
buf[i++] = '?';
}
- else if (State == EXTERNCMD)
+ else if (State == MODE_EXTERNCMD)
buf[i++] = '!';
- else if (State & INSERT)
+ else if (State & MODE_INSERT)
{
if (State & VREPLACE_FLAG)
{
@@ -687,7 +688,7 @@ get_mode(char_u *buf)
else if (ctrl_x_mode_not_defined_yet())
buf[i++] = 'x';
}
- else if ((State & CMDLINE) || exmode_active)
+ else if ((State & MODE_CMDLINE) || exmode_active)
{
buf[i++] = 'c';
if (exmode_active == EXMODE_VIM)
@@ -861,8 +862,8 @@ get_keystroke(void)
if (n == KEYLEN_REMOVED) // key code removed
{
- if (must_redraw != 0 && !need_wait_return
- && (State & (CMDLINE|HITRETURN|ASKMORE)) == 0)
+ if (must_redraw != 0 && !need_wait_return && (State
+ & (MODE_CMDLINE | MODE_HITRETURN | MODE_ASKMORE)) == 0)
{
// Redrawing was postponed, do it now.
update_screen(0);
@@ -1014,7 +1015,7 @@ prompt_for_number(int *mouse_used)
save_cmdline_row = cmdline_row;
cmdline_row = 0;
save_State = State;
- State = CMDLINE;
+ State = MODE_CMDLINE;
// May show different mouse shape.
setmouse();