summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--src/autocmd.c4
-rw-r--r--src/buffer.c16
-rw-r--r--src/change.c59
-rw-r--r--src/charset.c2
-rw-r--r--src/cindent.c2
-rw-r--r--src/clipboard.c12
-rw-r--r--src/debugger.c2
-rw-r--r--src/digraph.c4
-rw-r--r--src/drawline.c4
-rw-r--r--src/drawscreen.c16
-rw-r--r--src/edit.c84
-rw-r--r--src/evalfunc.c2
-rw-r--r--src/ex_cmds.c18
-rw-r--r--src/ex_docmd.c6
-rw-r--r--src/ex_getln.c20
-rw-r--r--src/fileio.c5
-rw-r--r--src/fold.c4
-rw-r--r--src/getchar.c64
-rw-r--r--src/globals.h12
-rw-r--r--src/gui.c70
-rw-r--r--src/gui_gtk.c2
-rw-r--r--src/gui_w32.c9
-rw-r--r--src/gui_xim.c23
-rw-r--r--src/indent.c24
-rw-r--r--src/insexpand.c2
-rw-r--r--src/macros.h2
-rw-r--r--src/main.c4
-rw-r--r--src/map.c189
-rw-r--r--src/menu.c17
-rw-r--r--src/message.c30
-rw-r--r--src/misc1.c35
-rw-r--r--src/misc2.c32
-rw-r--r--src/mouse.c30
-rw-r--r--src/netbeans.c6
-rw-r--r--src/normal.c28
-rw-r--r--src/ops.c8
-rw-r--r--src/option.c4
-rw-r--r--src/os_unix.c2
-rw-r--r--src/os_win32.c2
-rw-r--r--src/popupmenu.c10
-rw-r--r--src/screen.c16
-rw-r--r--src/search.c2
-rw-r--r--src/tag.c2
-rw-r--r--src/term.c32
-rw-r--r--src/terminal.c6
-rw-r--r--src/textformat.c10
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h69
-rw-r--r--src/window.c4
49 files changed, 516 insertions, 492 deletions
diff --git a/src/autocmd.c b/src/autocmd.c
index 223f92cf6a..4b30c1f530 100644
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1758,7 +1758,7 @@ apply_autocmds_retval(
static int
has_cursorhold(void)
{
- return (first_autopat[(int)(get_real_state() == NORMAL_BUSY
+ return (first_autopat[(int)(get_real_state() == MODE_NORMAL_BUSY
? EVENT_CURSORHOLD : EVENT_CURSORHOLDI)] != NULL);
}
@@ -1777,7 +1777,7 @@ trigger_cursorhold(void)
&& !ins_compl_active())
{
state = get_real_state();
- if (state == NORMAL_BUSY || (state & INSERT) != 0)
+ if (state == MODE_NORMAL_BUSY || (state & MODE_INSERT) != 0)
return TRUE;
}
return FALSE;
diff --git a/src/buffer.c b/src/buffer.c
index da0555e86f..17b1493800 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1774,7 +1774,7 @@ set_curbuf(buf_T *buf, int action)
// another window, might be a timer doing something in another
// window.
if (prevbuf == curbuf
- && ((State & INSERT) == 0 || curbuf->b_nwindows <= 1))
+ && ((State & MODE_INSERT) == 0 || curbuf->b_nwindows <= 1))
u_sync(FALSE);
close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf,
unload ? action : (action == DOBUF_GOTO
@@ -4700,8 +4700,8 @@ build_stl_str_hl(
break;
case STL_COLUMN:
- num = !(State & INSERT) && empty_line
- ? 0 : (int)wp->w_cursor.col + 1;
+ num = (State & MODE_INSERT) == 0 && empty_line
+ ? 0 : (int)wp->w_cursor.col + 1;
break;
case STL_VIRTCOL:
@@ -4709,8 +4709,8 @@ build_stl_str_hl(
virtcol = wp->w_virtcol + 1;
// Don't display %V if it's the same as %c.
if (opt == STL_VIRTCOL_ALT
- && (virtcol == (colnr_T)(!(State & INSERT) && empty_line
- ? 0 : (int)wp->w_cursor.col + 1)))
+ && (virtcol == (colnr_T)((State & MODE_INSERT) == 0
+ && empty_line ? 0 : (int)wp->w_cursor.col + 1)))
break;
num = (long)virtcol;
break;
@@ -4755,9 +4755,9 @@ build_stl_str_hl(
case STL_OFFSET:
#ifdef FEAT_BYTEOFF
l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL);
- num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) || l < 0 ?
- 0L : l + 1 + (!(State & INSERT) && empty_line ?
- 0 : (int)wp->w_cursor.col);
+ num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) || l < 0
+ ? 0L : l + 1 + ((State & MODE_INSERT) == 0 && empty_line
+ ? 0 : (int)wp->w_cursor.col);
#endif
break;
diff --git a/src/change.c b/src/change.c
index bebfaabff8..1facaededa 100644
--- a/src/change.c
+++ b/src/change.c
@@ -988,7 +988,7 @@ ins_bytes_len(char_u *p, int len)
/*
* Insert or replace a single character at the cursor position.
- * When in REPLACE or VREPLACE mode, replace any existing character.
+ * When in MODE_REPLACE or MODE_VREPLACE state, replace any existing character.
* Caller must have prepared for undo.
* For multi-byte characters we get the whole character, the caller must
* convert bytes to a character.
@@ -1119,7 +1119,7 @@ ins_char_bytes(char_u *buf, int charlen)
// If we're in Insert or Replace mode and 'showmatch' is set, then briefly
// show the match for right parens and braces.
- if (p_sm && (State & INSERT)
+ if (p_sm && (State & MODE_INSERT)
&& msg_silent == 0
&& !ins_compl_active())
{
@@ -1342,10 +1342,10 @@ del_bytes(
/*
* open_line: Add a new line below or above the current line.
*
- * For VREPLACE mode, we only add a new line when we get to the end of the
- * file, otherwise we just start replacing the next line.
+ * For MODE_VREPLACE state, we only add a new line when we get to the end of
+ * the file, otherwise we just start replacing the next line.
*
- * Caller must take care of undo. Since VREPLACE may affect any number of
+ * Caller must take care of undo. Since MODE_VREPLACE may affect any number of
* lines however, it may call u_save_cursor() again when starting to change a
* new line.
* "flags": OPENLINE_DELSPACES delete spaces after cursor
@@ -1416,7 +1416,7 @@ open_line(
if (State & VREPLACE_FLAG)
{
- // With VREPLACE we make a copy of the next line, which we will be
+ // With MODE_VREPLACE we make a copy of the next line, which we will be
// starting to replace. First make the new line empty and let vim play
// with the indenting and comment leader to its heart's content. Then
// we grab what it ended up putting on the new line, put back the
@@ -1430,11 +1430,11 @@ open_line(
if (next_line == NULL) // out of memory!
goto theend;
- // In VREPLACE mode, a NL replaces the rest of the line, and starts
- // replacing the next line, so push all of the characters left on the
- // line onto the replace stack. We'll push any other characters that
- // might be replaced at the start of the next line (due to autoindent
- // etc) a bit later.
+ // In MODE_VREPLACE state, a NL replaces the rest of the line, and
+ // starts replacing the next line, so push all of the characters left
+ // on the line onto the replace stack. We'll push any other characters
+ // that might be replaced at the start of the next line (due to
+ // autoindent etc) a bit later.
replace_push(NUL); // Call twice because BS over NL expects it
replace_push(NUL);
p = saved_line + curwin->w_cursor.col;
@@ -1448,7 +1448,7 @@ open_line(
saved_line[curwin->w_cursor.col] = NUL;
}
- if ((State & INSERT) && !(State & VREPLACE_FLAG))
+ if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0)
{
p_extra = saved_line + curwin->w_cursor.col;
#ifdef FEAT_SMARTINDENT
@@ -2077,7 +2077,7 @@ open_line(
}
}
- // (State == INSERT || State == REPLACE), only when dir == FORWARD
+ // (State == MODE_INSERT || State == MODE_REPLACE), only when dir == FORWARD
if (p_extra != NULL)
{
*p_extra = saved_char; // restore char that NUL replaced
@@ -2085,8 +2085,9 @@ open_line(
// When 'ai' set or "flags" has OPENLINE_DELSPACES, skip to the first
// non-blank.
//
- // When in REPLACE mode, put the deleted blanks on the replace stack,
- // preceded by a NUL, so they can be put back when a BS is entered.
+ // When in MODE_REPLACE state, put the deleted blanks on the replace
+ // stack, preceded by a NUL, so they can be put back when a BS is
+ // entered.
if (REPLACE_NORMAL(State))
replace_push(NUL); // end of extra blanks
if (curbuf->b_p_ai || (flags & OPENLINE_DELSPACES))
@@ -2156,7 +2157,7 @@ open_line(
mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
did_append = TRUE;
#ifdef FEAT_PROP_POPUP
- if ((State & INSERT) && !(State & VREPLACE_FLAG))
+ if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0)
// properties after the split move to the next line
adjust_props_for_split(curwin->w_cursor.lnum, curwin->w_cursor.lnum,
curwin->w_cursor.col + 1, 0);
@@ -2164,7 +2165,7 @@ open_line(
}
else
{
- // In VREPLACE mode we are starting to replace the next line.
+ // In MODE_VREPLACE state we are starting to replace the next line.
curwin->w_cursor.lnum++;
if (curwin->w_cursor.lnum >= Insstart.lnum + vr_lines_changed)
{
@@ -2212,8 +2213,8 @@ open_line(
ai_col = curwin->w_cursor.col;
- // In REPLACE mode, for each character in the new indent, there must
- // be a NUL on the replace stack, for when it is deleted with BS
+ // In MODE_REPLACE state, for each character in the new indent, there
+ // must be a NUL on the replace stack, for when it is deleted with BS
if (REPLACE_NORMAL(State))
for (n = 0; n < (int)curwin->w_cursor.col; ++n)
replace_push(NUL);
@@ -2224,8 +2225,8 @@ open_line(
#endif
}
- // In REPLACE mode, for each character in the extra leader, there must be
- // a NUL on the replace stack, for when it is deleted with BS.
+ // In MODE_REPLACE state, for each character in the extra leader, there
+ // must be a NUL on the replace stack, for when it is deleted with BS.
if (REPLACE_NORMAL(State))
while (lead_len-- > 0)
replace_push(NUL);
@@ -2234,7 +2235,7 @@ open_line(
if (dir == FORWARD)
{
- if (trunc_line || (State & INSERT))
+ if (trunc_line || (State & MODE_INSERT))
{
// truncate current line at cursor
saved_line[curwin->w_cursor.col] = NUL;
@@ -2270,13 +2271,13 @@ open_line(
curwin->w_cursor.coladd = 0;
#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
- // In VREPLACE mode, we are handling the replace stack ourselves, so stop
- // fixthisline() from doing it (via change_indent()) by telling it we're in
- // normal INSERT mode.
+ // In MODE_VREPLACE state, we are handling the replace stack ourselves, so
+ // stop fixthisline() from doing it (via change_indent()) by telling it
+ // we're in normal MODE_INSERT state.
if (State & VREPLACE_FLAG)
{
vreplace_mode = State; // So we know to put things right later
- State = INSERT;
+ State = MODE_INSERT;
}
else
vreplace_mode = 0;
@@ -2305,9 +2306,9 @@ open_line(
State = vreplace_mode;
#endif
- // Finally, VREPLACE gets the stuff on the new line, then puts back the
- // original line, and inserts the new stuff char by char, pushing old stuff
- // onto the replace stack (via ins_char()).
+ // Finally, MODE_VREPLACE gets the stuff on the new line, then puts back
+ // the original line, and inserts the new stuff char by char, pushing old
+ // stuff onto the replace stack (via ins_char()).
if (State & VREPLACE_FLAG)
{
// Put new line in p_extra
diff --git a/src/charset.c b/src/charset.c
index 657ab85f4d..6fd8b6b54f 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1300,7 +1300,7 @@ getvcol(
if (cursor != NULL)
{
if (*ptr == TAB
- && (State & NORMAL)
+ && (State & MODE_NORMAL)
&& !wp->w_p_list
&& !virtual_active()
&& !(VIsual_active
diff --git a/src/cindent.c b/src/cindent.c
index 57add394b0..dc9c20320f 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -2114,7 +2114,7 @@ get_c_indent(void)
// inserting new stuff.
// For unknown reasons the cursor might be past the end of the line, thus
// check for that.
- if ((State & INSERT)
+ if ((State & MODE_INSERT)
&& curwin->w_cursor.col < (colnr_T)STRLEN(linecopy)
&& linecopy[curwin->w_cursor.col] == ')')
linecopy[curwin->w_cursor.col] = NUL;
diff --git a/src/clipboard.c b/src/clipboard.c
index fbeee72518..e7854d0454 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -77,7 +77,7 @@ clip_update_selection(Clipboard_T *clip)
pos_T start, end;
// If visual mode is only due to a redo command ("."), then ignore it
- if (!redo_VIsual_busy && VIsual_active && (State & NORMAL))
+ if (!redo_VIsual_busy && VIsual_active && (State & MODE_NORMAL))
{
if (LT_POS(VIsual, curwin->w_cursor))
{
@@ -142,8 +142,8 @@ clip_own_selection(Clipboard_T *cbd)
// selected area. There is no specific redraw command for this,
// just redraw all windows on the current buffer.
if (cbd->owned
- && (get_real_state() == VISUAL
- || get_real_state() == SELECTMODE)
+ && (get_real_state() == MODE_VISUAL
+ || get_real_state() == MODE_SELECT)
&& (cbd == &clip_star ? clip_isautosel_star()
: clip_isautosel_plus())
&& HL_ATTR(HLF_V) != HL_ATTR(HLF_VNC))
@@ -195,8 +195,8 @@ clip_lose_selection(Clipboard_T *cbd)
// area. There is no specific redraw command for this, just redraw all
// windows on the current buffer.
if (was_owned
- && (get_real_state() == VISUAL
- || get_real_state() == SELECTMODE)
+ && (get_real_state() == MODE_VISUAL
+ || get_real_state() == MODE_SELECT)
&& (cbd == &clip_star ?
clip_isautosel_star() : clip_isautosel_plus())
&& HL_ATTR(HLF_V) != HL_ATTR(HLF_VNC)
@@ -214,7 +214,7 @@ clip_lose_selection(Clipboard_T *cbd)
static void
clip_copy_selection(Clipboard_T *clip)
{
- if (VIsual_active && (State & NORMAL) && clip->available)
+ if (VIsual_active && (State & MODE_NORMAL) && clip->available)
{
clip_update_selection(clip);
clip_free_selection(clip);
diff --git a/src/debugger.c b/src/debugger.c
index 6c38e5a3d3..87cd398bc8 100644
--- a/src/debugger.c
+++ b/src/debugger.c
@@ -88,7 +88,7 @@ do_debug(char_u *cmd)
emsg_silent = FALSE; // display error messages
redir_off = TRUE; // don't redirect debug commands
- State = NORMAL;
+ State = MODE_NORMAL;
debug_mode = TRUE;
if (!debug_did_msg)
diff --git a/src/digraph.c b/src/digraph.c
index 9fdd0b3f4e..cfffc192d4 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -2566,7 +2566,7 @@ ex_loadkeymap(exarg_T *eap)
vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s %s",
((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from,
((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to);
- (void)do_map(2, buf, LANGMAP, FALSE);
+ (void)do_map(2, buf, MODE_LANGMAP, FALSE);
}
p_cpo = save_cpo;
@@ -2597,7 +2597,7 @@ keymap_unload(void)
for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
{
vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from);
- (void)do_map(1, buf, LANGMAP, FALSE);
+ (void)do_map(1, buf, MODE_LANGMAP, FALSE);
}
keymap_clear(&curbuf->b_kmap_ga);
diff --git a/src/drawline.c b/src/drawline.c
index 679e4cae4e..caff9abc70 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1963,7 +1963,7 @@ win_line(
// In Insert mode only highlight a word that
// doesn't touch the cursor.
if (spell_hlf != HLF_COUNT
- && (State & INSERT) != 0
+ && (State & MODE_INSERT)
&& wp->w_cursor.lnum == lnum
&& wp->w_cursor.col >=
(colnr_T)(prev_ptr - line)
@@ -2595,7 +2595,7 @@ win_line(
if (p_imst == IM_ON_THE_SPOT
&& xic != NULL
&& lnum == wp->w_cursor.lnum
- && (State & INSERT)
+ && (State & MODE_INSERT)
&& !p_imdisable
&& im_is_preediting()
&& draw_state == WL_LINE)
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 135df1ea5c..2838bf88cf 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -686,7 +686,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
/*
* Check if not in Insert mode and the line is empty (will show "0-1").
*/
- if (!(State & INSERT)
+ if ((State & MODE_INSERT) == 0
&& *ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, FALSE) == NUL)
empty_line = TRUE;
@@ -2834,7 +2834,7 @@ update_debug_sign(buf_T *buf, linenr_T lnum)
// Return when there is nothing to do, screen updating is already
// happening (recursive call), messages on the screen or still starting up.
if (!doit || updating_screen
- || State == ASKMORE || State == HITRETURN
+ || State == MODE_ASKMORE || State == MODE_HITRETURN
|| msg_scrolled
#ifdef FEAT_GUI
|| gui.starting
@@ -2925,7 +2925,8 @@ redraw_asap(int type)
schar_T *screenline2 = NULL; // copy from ScreenLines2[]
redraw_later(type);
- if (msg_scrolled || (State != NORMAL && State != NORMAL_BUSY) || exiting)
+ if (msg_scrolled || (State != MODE_NORMAL && State != MODE_NORMAL_BUSY)
+ || exiting)
return ret;
// Allocate space to save the text displayed in the command line area.
@@ -3049,13 +3050,14 @@ redraw_after_callback(int call_update_screen, int do_message)
{
++redrawing_for_callback;
- if (State == HITRETURN || State == ASKMORE || State == SETWSIZE
- || State == EXTERNCMD || State == CONFIRM || exmode_active)
+ if (State == MODE_HITRETURN || State == MODE_ASKMORE
+ || State == MODE_SETWSIZE || State == MODE_EXTERNCMD
+ || State == MODE_CONFIRM || exmode_active)
{
if (do_message)
repeat_message();
}
- else if (State & CMDLINE)
+ else if (State & MODE_CMDLINE)
{
#ifdef FEAT_WILDMENU
if (pum_visible())
@@ -3078,7 +3080,7 @@ redraw_after_callback(int call_update_screen, int do_message)
redrawcmdline_ex(FALSE);
}
}
- else if (State & (NORMAL | INSERT | TERMINAL))
+ else if (State & (MODE_NORMAL | MODE_INSERT | MODE_TERMINAL))
{
update_topline();
validate_cursor();
diff --git a/src/edit.c b/src/edit.c
index 40717826bf..9457d25c11 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -142,7 +142,7 @@ edit(
int old_topfill = -1;
#endif
int inserted_space = FALSE; // just inserted a space
- int replaceState = REPLACE;
+ int replaceState = MODE_REPLACE;
int nomove = FALSE; // don't move cursor on return
#ifdef FEAT_JOB_CHANNEL
int cmdchar_todo = cmdchar;
@@ -218,7 +218,7 @@ edit(
int save_state = State;
curwin->w_cursor = save_cursor;
- State = INSERT;
+ State = MODE_INSERT;
check_cursor_col();
State = save_state;
}
@@ -272,17 +272,17 @@ edit(
if (cmdchar == 'R')
{
- State = REPLACE;
+ State = MODE_REPLACE;
}
else if (cmdchar == 'V' || cmdchar == 'v')
{
- State = VREPLACE;
- replaceState = VREPLACE;
+ State = MODE_VREPLACE;
+ replaceState = MODE_VREPLACE;
orig_line_count = curbuf->b_ml.ml_line_count;
vr_lines_changed = 1;
}
else
- State = INSERT;
+ State = MODE_INSERT;
may_trigger_modechanged();
stop_insert_mode = FALSE;
@@ -304,7 +304,7 @@ edit(
* when hitting <Esc>.
*/
if (curbuf->b_p_iminsert == B_IMODE_LMAP)
- State |= LANGMAP;
+ State |= MODE_LANGMAP;
#ifdef HAVE_INPUT_METHOD
im_set_active(curbuf->b_p_iminsert == B_IMODE_IM);
#endif
@@ -315,7 +315,7 @@ edit(
#endif
#ifdef FEAT_RIGHTLEFT
// there is no reverse replace mode
- revins_on = (State == INSERT && p_ri);
+ revins_on = (State == MODE_INSERT && p_ri);
if (revins_on)
undisplay_dollar();
revins_chars = 0;
@@ -1802,8 +1802,8 @@ undisplay_dollar(void)
/*
* Truncate the space at the end of a line. This is to be used only in an
- * insert mode. It handles fixing the replace stack for REPLACE and VREPLACE
- * modes.
+ * insert mode. It handles fixing the replace stack for MODE_REPLACE and
+ * MODE_VREPLACE modes.
*/
void
truncate_spaces(char_u *line)
@@ -1820,9 +1820,9 @@ truncate_spaces(char_u *line)
}
/*
- * Backspace the cursor until the given column. Handles REPLACE and VREPLACE
- * modes correctly. May also be used when not in insert mode at all.
- * Will attempt not to go before "col" even when there is a composing
+ * Backspace the cursor until the given column. Handles MODE_REPLACE and
+ * MODE_VREPLACE modes correctly. May also be used when not in insert mode at
+ * all. Will attempt not to go before "col" even when there is a composing
* character.
*/
void
@@ -1924,7 +1924,7 @@ get_literal(int noReduceKeys)
break;
#ifdef FEAT_CMDL_INFO
- if (!(State & CMDLINE) && MB_BYTE2LEN_CHECK(nc) == 1)
+ if ((State & MODE_CMDLINE) == 0 && MB_BYTE2LEN_CHECK(nc) == 1)
add_to_showcmd(nc);
#endif
if (nc == 'x' || nc == 'X')
@@ -2099,7 +2099,7 @@ insertchar(
* - Otherwise:
* - Don't do this if inserting a blank
* - Don't do this if an existing character is being replaced, unless
- * we're in VREPLACE mode.
+ * we're in MODE_VREPLACE state.
* - Do this if the cursor is not on the line where insert started
* or - 'formatoptions' doesn't have 'l' or the line was not too long
* before the insert.
@@ -2810,7 +2810,7 @@ cursor_up(
// If we entered a fold, move to the beginning, unless in
// Insert mode or when 'foldopen' contains "all": it will open
// in a moment.
- if (n > 0 || !((State & INSERT) || (fdo_flags & FDO_ALL)))
+ if (n > 0 || !((State & MODE_INSERT) || (fdo_flags & FDO_ALL)))
(void)hasFolding(lnum, &lnum, NULL);
}
if (lnum < 1)
@@ -3107,7 +3107,7 @@ replace_join(
/*
* Pop bytes from the replace stack until a NUL is found, and insert them
- * before the cursor. Can only be used in REPLACE or VREPLACE mode.
+ * before the cursor. Can only be used in MODE_REPLACE or MODE_VREPLACE state.
*/
static void
replace_pop_ins(void)
@@ -3115,7 +3115,7 @@ replace_pop_ins(void)
int cc;
int oldState = State;
- State = NORMAL; // don't want REPLACE here
+ State = MODE_NORMAL; // don't want MODE_REPLACE here
while ((cc = replace_pop()) > 0)
{
mb_replace_pop_ins(cc);
@@ -3545,18 +3545,18 @@ ins_ctrl_g(void)
static void
ins_ctrl_hat(void)
{
- if (map_to_exists_mode((char_u *)"", LANGMAP, FALSE))
+ if (map_to_exists_mode((char_u *)"", MODE_LANGMAP, FALSE))
{
// ":lmap" mappings exists, Toggle use of ":lmap" mappings.
- if (State & LANGMAP)
+ if (State & MODE_LANGMAP)
{
curbuf->b_p_iminsert = B_IMODE_NONE;
- State &= ~LANGMAP;
+ State &= ~MODE_LANGMAP;
}
else
{
curbuf->b_p_iminsert = B_IMODE_LMAP;
- State |= LANGMAP;
+ State |= MODE_LANGMAP;
#ifdef HAVE_INPUT_METHOD
im_set_active(FALSE);
#endif
@@ -3574,7 +3574,7 @@ ins_ctrl_hat(void)
else
{
curbuf->b_p_iminsert = B_IMODE_IM;
- State &= ~LANGMAP;
+ State &= ~MODE_LANGMAP;
im_set_active(TRUE);
}
}
@@ -3704,12 +3704,12 @@ ins_esc(
// Disable IM to allow typing English directly for Normal mode commands.
// When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
// well).
- if (!(State & LANGMAP))
+ if (!(State & MODE_LANGMAP))
im_save_status(&curbuf->b_p_iminsert);
im_set_active(FALSE);
#endif
- State = NORMAL;
+ State = MODE_NORMAL;
may_trigger_modechanged();
// need to position cursor again when on a TAB
if (gchar_cursor() == TAB)
@@ -3760,7 +3760,7 @@ ins_ctrl_(void)
++curwin->w_cursor.col;
}
p_ri = !p_ri;
- revins_on = (State == INSERT && p_ri);
+ revins_on = (State == MODE_INSERT && p_ri);
if (revins_on)
{
revins_scol = curwin->w_cursor.col;
@@ -3839,14 +3839,14 @@ ins_insert(int replaceState)
#ifdef FEAT_EVAL
set_vim_var_string(VV_INSERTMODE,
(char_u *)((State & REPLACE_FLAG) ? "i"
- : replaceState == VREPLACE ? "v"
+ : replaceState == MODE_VREPLACE ? "v"
: "r"), 1);
#endif
ins_apply_autocmds(EVENT_INSERTCHANGE);
if (State & REPLACE_FLAG)
- State = INSERT | (State & LANGMAP);
+ State = MODE_INSERT | (State & MODE_LANGMAP);
else
- State = replaceState | (State & LANGMAP);
+ State = replaceState | (State & MODE_LANGMAP);
may_trigger_modechanged();
AppendCharToRedobuff(K_INS);
showmode();
@@ -4119,20 +4119,20 @@ ins_bs(
dec_cursor();
/*
- * In REPLACE mode we have to put back the text that was replaced
- * by the NL. On the replace stack is first a NUL-terminated
- * sequence of characters that were deleted and then the
- * characters that NL replaced.
+ * In MODE_REPLACE mode we have to put back the text that was
+ * replaced by the NL. On the replace stack is first a
+ * NUL-terminated sequence of characters that were deleted and then
+ * the characters that NL replaced.
*/
if (State & REPLACE_FLAG)
{
/*
- * Do the next ins_char() in NORMAL state, to
+ * Do the next ins_char() in MODE_NORMAL state, to
* prevent ins_char() from replacing characters and
* avoiding showmatch().
*/
oldState = State;
- State = NORMAL;
+ State = MODE_NORMAL;
/*