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.
diff --git a/src/misc2.c b/src/misc2.c
index 8e46a73..a224631 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -30,8 +30,9 @@
if (virtual_op != MAYBE)
return virtual_op;
return (cur_ve_flags == VE_ALL
- || ((cur_ve_flags & VE_BLOCK) && VIsual_active && VIsual_mode == Ctrl_V)
- || ((cur_ve_flags & VE_INSERT) && (State & INSERT)));
+ || ((cur_ve_flags & VE_BLOCK) && VIsual_active
+ && VIsual_mode == Ctrl_V)
+ || ((cur_ve_flags & VE_INSERT) && (State & MODE_INSERT)));
}
/*
@@ -136,7 +137,7 @@
int head = 0;
#endif
- one_more = (State & INSERT)
+ one_more = (State & MODE_INSERT)
|| restart_edit != NUL
|| (VIsual_active && *p_sel != 'o')
|| ((get_ve_flags() & VE_ONEMORE) && wcol < MAXCOL);
@@ -169,7 +170,7 @@
csize--;
if (wcol / width > (colnr_T)csize / width
- && ((State & INSERT) == 0 || (int)wcol > csize + 1))
+ && ((State & MODE_INSERT) == 0 || (int)wcol > csize + 1))
{
// In case of line wrapping don't move the cursor beyond the
// right screen edge. In Insert mode allow going just beyond
@@ -566,7 +567,7 @@
// - in Insert mode or restarting Insert mode
// - in Visual mode and 'selection' isn't "old"
// - 'virtualedit' is set
- if ((State & INSERT) || restart_edit
+ if ((State & MODE_INSERT) || restart_edit
|| (VIsual_active && *p_sel != 'o')
|| (cur_ve_flags & VE_ONEMORE)
|| virtual_active())
@@ -1836,22 +1837,23 @@
}
/*
- * VISUAL, SELECTMODE and OP_PENDING State are never set, they are equal to
- * NORMAL State with a condition. This function returns the real State.
+ * MODE_VISUAL, MODE_SELECT and MODE_OP_PENDING State are never set, they are
+ * equal to MODE_NORMAL State with a condition. This function returns the real
+ * State.
*/
int
get_real_state(void)
{
- if (State & NORMAL)
+ if (State & MODE_NORMAL)
{
if (VIsual_active)
{
if (VIsual_select)
- return SELECTMODE;
- return VISUAL;
+ return MODE_SELECT;
+ return MODE_VISUAL;
}
else if (finish_op)
- return OP_PENDING;
+ return MODE_OP_PENDING;
}
return State;
}
@@ -2271,7 +2273,7 @@
get_shape_idx(int mouse)
{
#ifdef FEAT_MOUSESHAPE
- if (mouse && (State == HITRETURN || State == ASKMORE))
+ if (mouse && (State == MODE_HITRETURN || State == MODE_ASKMORE))
{
# ifdef FEAT_GUI
int x, y;
@@ -2286,15 +2288,15 @@
if (mouse && drag_sep_line)
return SHAPE_IDX_VDRAG;
#endif
- if (!mouse && State == SHOWMATCH)
+ if (!mouse && State == MODE_SHOWMATCH)
return SHAPE_IDX_SM;
if (State & VREPLACE_FLAG)
return SHAPE_IDX_R;
if (State & REPLACE_FLAG)
return SHAPE_IDX_R;
- if (State & INSERT)
+ if (State & MODE_INSERT)
return SHAPE_IDX_I;
- if (State & CMDLINE)
+ if (State & MODE_CMDLINE)
{
if (cmdline_at_end())
return SHAPE_IDX_C;