summaryrefslogtreecommitdiffstats
path: root/src/gui.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/gui.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/gui.c')
-rw-r--r--src/gui.c70
1 files changed, 36 insertions, 34 deletions
diff --git a/src/gui.c b/src/gui.c
index 2d59ea27a7..2544c53b24 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1207,7 +1207,7 @@ gui_update_cursor(
else
#endif
shape = &shape_table[get_shape_idx(FALSE)];
- if (State & LANGMAP)
+ if (State & MODE_LANGMAP)
id = shape->id_lm;
else
id = shape->id;
@@ -1580,7 +1580,7 @@ again:
* At the "more" and ":confirm" prompt there is no redraw, put the cursor
* at the last line here (why does it have to be one row too low?).
*/
- if (State == ASKMORE || State == CONFIRM)
+ if (State == MODE_ASKMORE || State == MODE_CONFIRM)
gui.row = gui.num_rows;
// Only comparing Rows and Columns may be sufficient, but let's stay on
@@ -3192,22 +3192,23 @@ button_set:
// Determine which mouse settings to look for based on the current mode
switch (get_real_state())
{
- case NORMAL_BUSY:
- case OP_PENDING:
+ case MODE_NORMAL_BUSY:
+ case MODE_OP_PENDING:
# ifdef FEAT_TERMINAL
- case TERMINAL:
+ case MODE_TERMINAL:
# endif
- case NORMAL: checkfor = MOUSE_NORMAL; break;
- case VISUAL: checkfor = MOUSE_VISUAL; break;
- case SELECTMODE: checkfor = MOUSE_VISUAL; break;
- case REPLACE:
- case REPLACE+LANGMAP:
- case VREPLACE:
- case VREPLACE+LANGMAP:
- case INSERT:
- case INSERT+LANGMAP: checkfor = MOUSE_INSERT; break;
- case ASKMORE:
- case HITRETURN: // At the more- and hit-enter prompt pass the
+ case MODE_NORMAL: checkfor = MOUSE_NORMAL; break;
+ case MODE_VISUAL: checkfor = MOUSE_VISUAL; break;
+ case MODE_SELECT: checkfor = MOUSE_VISUAL; break;
+ case MODE_REPLACE:
+ case MODE_REPLACE | MODE_LANGMAP:
+ case MODE_VREPLACE:
+ case MODE_VREPLACE | MODE_LANGMAP:
+ case MODE_INSERT:
+ case MODE_INSERT | MODE_LANGMAP:
+ checkfor = MOUSE_INSERT; break;
+ case MODE_ASKMORE:
+ case MODE_HITRETURN: // At the more- and hit-enter prompt pass the
// mouse event for a click on or below the
// message line.
if (Y_2_ROW(y) >= msg_row)
@@ -3220,8 +3221,8 @@ button_set:
* On the command line, use the clipboard selection on all lines
* but the command line. But not when pasting.
*/
- case CMDLINE:
- case CMDLINE+LANGMAP:
+ case MODE_CMDLINE:
+ case MODE_CMDLINE | MODE_LANGMAP:
if (Y_2_ROW(y) < cmdline_row && button != MOUSE_MIDDLE)
checkfor = MOUSE_NONE;
else
@@ -3238,7 +3239,8 @@ button_set:
* modes. Don't do this when dragging the status line, or extending a
* Visual selection.
*/
- if ((State == NORMAL || State == NORMAL_BUSY || (State & INSERT))
+ if ((State == MODE_NORMAL || State == MODE_NORMAL_BUSY
+ || (State & MODE_INSERT))
&& Y_2_ROW(y) >= topframe->fr_height + firstwin->w_winrow
&& button != MOUSE_DRAG
# ifdef FEAT_MOUSESHAPE
@@ -3270,7 +3272,7 @@ button_set:
if (!mouse_has(checkfor) || checkfor == MOUSE_COMMAND)
{
// Don't do modeless selection in Visual mode.
- if (checkfor != MOUSE_NONEF && VIsual_active && (State & NORMAL))
+ if (checkfor != MOUSE_NONEF && VIsual_active && (State & MODE_NORMAL))
return;
/*
@@ -3291,7 +3293,7 @@ button_set:
{
if (clip_star.state == SELECT_CLEARED)
{
- if (State & CMDLINE)
+ if (State & MODE_CMDLINE)
{
col = msg_col;
row = msg_row;
@@ -4086,17 +4088,17 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
#ifdef USE_ON_FLY_SCROLL
current_scrollbar = sb_num;
scrollbar_value = value;
- if (State & NORMAL)
+ if (State & MODE_NORMAL)
{
gui_do_scroll();
setcursor();
}
- else if (State & INSERT)
+ else if (State & MODE_INSERT)
{
ins_scroll();
setcursor();
}
- else if (State & CMDLINE)
+ else if (State & MODE_CMDLINE)
{
if (msg_scrolled == 0)
{
@@ -4131,11 +4133,11 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
#ifdef USE_ON_FLY_SCROLL
scrollbar_value = value;
- if (State & NORMAL)
+ if (State & MODE_NORMAL)
gui_do_horiz_scroll(scrollbar_value, FALSE);
- else if (State & INSERT)
+ else if (State & MODE_INSERT)
ins_horscroll();
- else if (State & CMDLINE)
+ else if (State & MODE_CMDLINE)
{
if (msg_scrolled == 0)
{
@@ -4890,8 +4892,8 @@ gui_mouse_focus(int x, int y)
// Only handle this when 'mousefocus' set and ...
if (p_mousef
&& !hold_gui_events // not holding events
- && (State & (NORMAL|INSERT))// Normal/Visual/Insert mode
- && State != HITRETURN // but not hit-return prompt
+ && (State & (MODE_NORMAL | MODE_INSERT))// Normal/Visual/Insert mode
+ && State != MODE_HITRETURN // but not hit-return prompt
&& msg_scrolled == 0 // no scrolled message
&& !need_mouse_correct // not moving the pointer
&& gui.in_focus) // gvim in focus
@@ -5022,7 +5024,7 @@ xy2win(int x, int y, mouse_find_T popup)
if (wp == NULL)
return NULL;
#ifdef FEAT_MOUSESHAPE
- if (State == HITRETURN || State == ASKMORE)
+ if (State == MODE_HITRETURN || State == MODE_ASKMORE)
{
if (Y_2_ROW(y) >= msg_row)
update_mouseshape(SHAPE_IDX_MOREL);
@@ -5031,10 +5033,10 @@ xy2win(int x, int y, mouse_find_T popup)
}
else if (row > wp->w_height) // below status line
update_mouseshape(SHAPE_IDX_CLINE);
- else if (!(State & CMDLINE) && wp->w_vsep_width > 0 && col == wp->w_width
+ else if (!(State & MODE_CMDLINE) && wp->w_vsep_width > 0 && col == wp->w_width
&& (row != wp->w_height || !stl_connected(wp)) && msg_scrolled == 0)
update_mouseshape(SHAPE_IDX_VSEP);
- else if (!(State & CMDLINE) && wp->w_status_height > 0
+ else if (!(State & MODE_CMDLINE) && wp->w_status_height > 0
&& row == wp->w_height && msg_scrolled == 0)
update_mouseshape(SHAPE_IDX_STATUS);
else
@@ -5454,7 +5456,7 @@ gui_do_findrepl(
// syntax HL if we were busy redrawing.
did_emsg = save_did_emsg;
- if (State & (NORMAL | INSERT))
+ if (State & (MODE_NORMAL | MODE_INSERT))
{
gui_update_screen(); // update the screen
msg_didout = 0; // overwrite any message
@@ -5558,7 +5560,7 @@ gui_handle_drop(
* When the cursor is at the command line, add the file names to the
* command line, don't edit the files.
*/
- if (State & CMDLINE)
+ if (State & MODE_CMDLINE)
{
shorten_filenames(fnames, count);
for (i = 0; i < count; ++i)