patch 8.2.4911: the mode #defines are not clearly named

Problem:    The mode #defines are not clearly named.
Solution:   Prepend MODE_.  Renumber them to put the mapped modes first.
This commit is contained in:
Bram Moolenaar
2022-05-07 20:01:16 +01:00
parent 9ff7d717aa
commit 249591057b
49 changed files with 514 additions and 490 deletions

View File

@ -828,7 +828,7 @@ get_number_indent(linenr_T lnum)
pos.lnum = 0;
// In format_lines() (i.e. not insert mode), fo+=q is needed too...
if ((State & INSERT) || has_format_option(FO_Q_COMS))
if ((State & MODE_INSERT) || has_format_option(FO_Q_COMS))
lead_len = get_leader_len(ml_get(lnum), NULL, FALSE, TRUE);
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
@ -1276,7 +1276,7 @@ change_indent(
colnr_T orig_col = 0; // init for GCC
char_u *new_line, *orig_line = NULL; // init for GCC
// VREPLACE mode needs to know what the line was like before changing
// MODE_VREPLACE state needs to know what the line was like before changing
if (State & VREPLACE_FLAG)
{
orig_line = vim_strsave(ml_get_curline()); // Deal with NULL below
@ -1318,7 +1318,7 @@ change_indent(
// Avoid being called recursively.
if (State & VREPLACE_FLAG)
State = INSERT;
State = MODE_INSERT;
shift_line(type == INDENT_DEC, round, 1, call_changed_bytes);
State = save_State;
}
@ -1339,7 +1339,7 @@ change_indent(
insstart_less = MAXCOL;
new_cursor_col += curwin->w_cursor.col;
}
else if (!(State & INSERT))
else if (!(State & MODE_INSERT))
new_cursor_col = curwin->w_cursor.col;
else
{
@ -1397,7 +1397,7 @@ change_indent(
changed_cline_bef_curs();
// May have to adjust the start of the insert.
if (State & INSERT)
if (State & MODE_INSERT)
{
if (curwin->w_cursor.lnum == Insstart.lnum && Insstart.col != 0)
{
@ -1412,9 +1412,9 @@ change_indent(
ai_col -= insstart_less;
}
// For REPLACE mode, may have to fix the replace stack, if it's possible.
// If the number of characters before the cursor decreased, need to pop a
// few characters from the replace stack.
// For MODE_REPLACE state, may have to fix the replace stack, if it's
// possible. If the number of characters before the cursor decreased, need
// to pop a few characters from the replace stack.
// If the number of characters before the cursor increased, need to push a
// few NULs onto the replace stack.
if (REPLACE_NORMAL(State) && start_col >= 0)
@ -1436,9 +1436,9 @@ change_indent(
}
}
// For VREPLACE mode, we also have to fix the replace stack. In this case
// it is always possible because we backspace over the whole line and then
// put it back again the way we wanted it.
// For MODE_VREPLACE state, we also have to fix the replace stack. In this
// case it is always possible because we backspace over the whole line and
// then put it back again the way we wanted it.
if (State & VREPLACE_FLAG)
{
// If orig_line didn't allocate, just return. At least we did the job,
@ -1894,7 +1894,7 @@ get_expr_indent(void)
// Pretend to be in Insert mode, allow cursor past end of line for "o"
// command.
save_State = State;
State = INSERT;
State = MODE_INSERT;
curwin->w_cursor = save_pos;
curwin->w_curswant = save_curswant;
curwin->w_set_curswant = save_set_curswant;