Mercurial > vim
diff src/misc1.c @ 28773:d770568e6c98 v8.2.4911
patch 8.2.4911: the mode #defines are not clearly named
Commit: https://github.com/vim/vim/commit/249591057b4840785c50e41dd850efb8a8faf435
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 7 20:01:16 2022 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 07 May 2022 21:15:06 +0200 |
parents | 5be5151ad510 |
children | d0241e74bfdb |
line wrap: on
line diff
--- a/src/misc1.c +++ b/src/misc1.c @@ -455,13 +455,13 @@ plines_win_col(win_T *wp, linenr_T lnum, /* * 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();