summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-01 21:41:28 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-01 21:41:28 +0100
commit217e1b8359447f5550dcb0d1ee43380a90c253c5 (patch)
tree137e8b7d6f27848c95caa47e2fc13a4dc4c50d29 /src/ex_getln.c
parent5d18efecfd6c45d69f55268948a22cd0465bb955 (diff)
patch 8.1.2379: using old C style commentsv8.1.2379
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c663
1 files changed, 332 insertions, 331 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 4a4d76ec9d..25f409b743 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -23,15 +23,15 @@
static cmdline_info_T ccline;
#ifdef FEAT_EVAL
-static int new_cmdpos; /* position set by set_cmdline_pos() */
+static int new_cmdpos; // position set by set_cmdline_pos()
#endif
-static int extra_char = NUL; /* extra character to display when redrawing
- * the command line */
+static int extra_char = NUL; // extra character to display when redrawing
+ // the command line
static int extra_char_shift;
#ifdef FEAT_RIGHTLEFT
-static int cmd_hkmap = 0; /* Hebrew mapping during command line */
+static int cmd_hkmap = 0; // Hebrew mapping during command line
#endif
static char_u *getcmdline_int(int firstc, long count, int indent, int init_ccline);
@@ -90,7 +90,7 @@ empty_pattern(char_u *p)
{
size_t n = STRLEN(p);
- /* remove trailing \v and the like */
+ // remove trailing \v and the like
while (n >= 2 && p[n - 2] == '\\'
&& vim_strchr((char_u *)"mMvVcCZ", p[n - 1]) != NULL)
n -= 2;
@@ -359,7 +359,7 @@ finish_incsearch_highlighting(
p_magic = is_state->magic_save;
- validate_cursor(); /* needed for TAB */
+ validate_cursor(); // needed for TAB
redraw_all_later(SOME_VALID);
if (call_update_screen)
update_screen(SOME_VALID);
@@ -794,22 +794,22 @@ getcmdline_int(
int c;
int i;
int j;
- int gotesc = FALSE; /* TRUE when <ESC> just typed */
- int do_abbr; /* when TRUE check for abbr. */
- char_u *lookfor = NULL; /* string to match */
- int hiscnt; /* current history line in use */
- int histype; /* history type to be used */
+ int gotesc = FALSE; // TRUE when <ESC> just typed
+ int do_abbr; // when TRUE check for abbr.
+ char_u *lookfor = NULL; // string to match
+ int hiscnt; // current history line in use
+ int histype; // history type to be used
#ifdef FEAT_SEARCH_EXTRA
incsearch_state_T is_state;
#endif
- int did_wild_list = FALSE; /* did wild_list() recently */
- int wim_index = 0; /* index in wim_flags[] */
+ int did_wild_list = FALSE; // did wild_list() recently
+ int wim_index = 0; // index in wim_flags[]
int res;
int save_msg_scroll = msg_scroll;
- int save_State = State; /* remember State when called */
- int some_key_typed = FALSE; /* one of the keys was typed */
- /* mouse drag and release events are ignored, unless they are
- * preceded with a mouse down event */
+ int save_State = State; // remember State when called
+ int some_key_typed = FALSE; // one of the keys was typed
+ // mouse drag and release events are ignored, unless they are
+ // preceded with a mouse down event
int ignore_drag_release = TRUE;
#ifdef FEAT_EVAL
int break_ctrl_c = FALSE;
@@ -838,12 +838,12 @@ getcmdline_int(
}
#endif
#ifdef FEAT_RIGHTLEFT
- /* start without Hebrew mapping for a command line */
+ // start without Hebrew mapping for a command line
if (firstc == ':' || firstc == '=' || firstc == '>')
cmd_hkmap = 0;
#endif
- ccline.overstrike = FALSE; /* always start in insert mode */
+ ccline.overstrike = FALSE; // always start in insert mode
#ifdef FEAT_SEARCH_EXTRA
init_incsearch_state(&is_state);
@@ -855,7 +855,7 @@ getcmdline_int(
ccline.cmdfirstc = (firstc == '@' ? 0 : firstc);
ccline.cmdindent = (firstc > 0 ? indent : 0);
- /* alloc initial ccline.cmdbuff */
+ // alloc initial ccline.cmdbuff
alloc_cmdbuff(exmode_active ? 250 : indent + 1);
if (ccline.cmdbuff == NULL)
goto theend; // out of memory
@@ -863,7 +863,7 @@ getcmdline_int(
ccline.cmdbuff[0] = NUL;
sb_text_start_cmdline();
- /* autoindent for :insert and :append */
+ // autoindent for :insert and :append
if (firstc <= 0)
{
vim_memset(ccline.cmdbuff, ' ', indent);
@@ -884,14 +884,14 @@ getcmdline_int(
cmdmsg_rl = FALSE;
#endif
- redir_off = TRUE; /* don't redirect the typed command */
+ redir_off = TRUE; // don't redirect the typed command
if (!cmd_silent)
{
i = msg_scrolled;
- msg_scrolled = 0; /* avoid wait_return message */
+ msg_scrolled = 0; // avoid wait_return message
gotocmdline(TRUE);
msg_scrolled += i;
- redrawcmdprompt(); /* draw prompt or indent */
+ redrawcmdprompt(); // draw prompt or indent
set_cmdspos();
}
xpc.xp_context = EXPAND_NOTHING;
@@ -919,7 +919,7 @@ getcmdline_int(
if (firstc == '/' || firstc == '?' || firstc == '@')
{
- /* Use ":lmap" mappings for search pattern and input(). */
+ // Use ":lmap" mappings for search pattern and input().
if (curbuf->b_p_imsearch == B_IMODE_USE_INSERT)
b_im_ptr = &curbuf->b_p_iminsert;
else
@@ -937,27 +937,27 @@ getcmdline_int(
setmouse();
#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
- /* When inside an autocommand for writing "exiting" may be set and
- * terminal mode set to cooked. Need to set raw mode here then. */
+ // When inside an autocommand for writing "exiting" may be set and
+ // terminal mode set to cooked. Need to set raw mode here then.
settmode(TMODE_RAW);
- /* Trigger CmdlineEnter autocommands. */
+ // Trigger CmdlineEnter autocommands.
cmdline_type = firstc == NUL ? '-' : firstc;
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINEENTER);
init_history();
- hiscnt = get_hislen(); /* set hiscnt to impossible history value */
+ hiscnt = get_hislen(); // set hiscnt to impossible history value
histype = hist_char2type(firstc);
#ifdef FEAT_DIGRAPHS
- do_digraph(-1); /* init digraph typeahead */
+ do_digraph(-1); // init digraph typeahead
#endif
- /* If something above caused an error, reset the flags, we do want to type
- * and execute commands. Display may be messed up a bit. */
+ // If something above caused an error, reset the flags, we do want to type
+ // and execute commands. Display may be messed up a bit.
if (did_emsg)
redrawcmd();
did_emsg = FALSE;
@@ -968,25 +968,25 @@ getcmdline_int(
*/
for (;;)
{
- redir_off = TRUE; /* Don't redirect the typed command.
- Repeated, because a ":redir" inside
- completion may switch it on. */
+ redir_off = TRUE; // Don't redirect the typed command.
+ // Repeated, because a ":redir" inside
+ // completion may switch it on.
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = FALSE; /* allow scrolling here */
+ dont_scroll = FALSE; // allow scrolling here
#endif
- quit_more = FALSE; /* reset after CTRL-D which had a more-prompt */
+ quit_more = FALSE; // reset after CTRL-D which had a more-prompt
- did_emsg = FALSE; /* There can't really be a reason why an error
- that occurs while typing a command should
- cause the command not to be executed. */
+ did_emsg = FALSE; // There can't really be a reason why an error
+ // that occurs while typing a command should
+ // cause the command not to be executed.
// Trigger SafeState if nothing is pending.
may_trigger_safestate(xpc.xp_numfiles <= 0);
- cursorcmd(); /* set the cursor on the right spot */
+ cursorcmd(); // set the cursor on the right spot
- /* Get a character. Ignore K_IGNORE and K_NOP, they should not do
- * anything, such as stop completion. */
+ // Get a character. Ignore K_IGNORE and K_NOP, they should not do
+ // anything, such as stop completion.
do
c = safe_vgetc();
while (c == K_IGNORE || c == K_NOP);
@@ -999,9 +999,9 @@ getcmdline_int(
c = hkmap(c);
if (cmdmsg_rl && !KeyStuffed)
{
- /* Invert horizontal movements and operations. Only when
- * typed by the user directly, not when the result of a
- * mapping. */
+ // Invert horizontal movements and operations. Only when
+ // typed by the user directly, not when the result of a
+ // mapping.
switch (c)
{
case K_RIGHT: c = K_LEFT; break;
@@ -1054,7 +1054,7 @@ getcmdline_int(
c = Ctrl_P;
#ifdef FEAT_WILDMENU
- /* Special translations for 'wildmenu' */
+ // Special translations for 'wildmenu'
if (did_wild_list && p_wmnu)
{
if (c == K_LEFT)
@@ -1062,7 +1062,7 @@ getcmdline_int(
else if (c == K_RIGHT)
c = Ctrl_N;
}
- /* Hitting CR after "emenu Name.": complete submenu */
+ // Hitting CR after "emenu Name.": complete submenu
if (xpc.xp_context == EXPAND_MENUNAMES && p_wmnu
&& ccline.cmdpos > 1
&& ccline.cmdbuff[ccline.cmdpos - 1] == '.'
@@ -1071,7 +1071,7 @@ getcmdline_int(
c = K_DOWN;
#endif
- /* free expanded names when finished walking through matches */
+ // free expanded names when finished walking through matches
if (xpc.xp_numfiles != -1
&& !(c == p_wc && KeyTyped) && c != p_wcm
&& c != Ctrl_N && c != Ctrl_P && c != Ctrl_A
@@ -1095,17 +1095,17 @@ getcmdline_int(
if (wild_menu_showing == WM_SCROLLED)
{
- /* Entered command line, move it up */
+ // Entered command line, move it up
cmdline_row--;
redrawcmd();
}
else if (save_p_ls != -1)
{
- /* restore 'laststatus' and 'winminheight' */
+ // restore 'laststatus' and 'winminheight'
p_ls = save_p_ls;
p_wmh = save_p_wmh;
last_status(FALSE);
- update_screen(VALID); /* redraw the screen NOW */
+ update_screen(VALID); // redraw the screen NOW
redrawcmd();
save_p_ls = -1;
}
@@ -1123,31 +1123,31 @@ getcmdline_int(
}
#ifdef FEAT_WILDMENU
- /* Special translations for 'wildmenu' */
+ // Special translations for 'wildmenu'
if (xpc.xp_context == EXPAND_MENUNAMES && p_wmnu)
{
- /* Hitting <Down> after "emenu Name.": complete submenu */
+ // Hitting <Down> after "emenu Name.": complete submenu
if (c == K_DOWN && ccline.cmdpos > 0
&& ccline.cmdbuff[ccline.cmdpos - 1] == '.')
c = p_wc;
else if (c == K_UP)
{
- /* Hitting <Up>: Remove one submenu name in front of the
- * cursor */
+ // Hitting <Up>: Remove one submenu name in front of the
+ // cursor
int found = FALSE;
j = (int)(xpc.xp_pattern - ccline.cmdbuff);
i = 0;
while (--j > 0)
{
- /* check for start of menu name */
+ // check for start of menu name
if (ccline.cmdbuff[j] == ' '
&& ccline.cmdbuff[j - 1] != '\\')
{
i = j + 1;
break;
}
- /* check for start of submenu name */
+ // check for start of submenu name
if (ccline.cmdbuff[j] == '.'
&& ccline.cmdbuff[j - 1] != '\\')
{
@@ -1185,12 +1185,12 @@ getcmdline_int(
|| ccline.cmdbuff[ccline.cmdpos - 2] != '.'
|| ccline.cmdbuff[ccline.cmdpos - 3] != '.'))
{
- /* go down a directory */
+ // go down a directory
c = p_wc;
}
else if (STRNCMP(xpc.xp_pattern, upseg + 1, 3) == 0 && c == K_DOWN)
{
- /* If in a direct ancestor, strip off one ../ to go down */
+ // If in a direct ancestor, strip off one ../ to go down
int found = FALSE;
j = ccline.cmdpos;
@@ -1216,7 +1216,7 @@ getcmdline_int(
}
else if (c == K_UP)
{
- /* go up a directory */
+ // go up a directory
int found = FALSE;
j = ccline.cmdpos - 1;
@@ -1253,25 +1253,25 @@ getcmdline_int(
j = 0;
if (j > 0)
{
- /* TODO this is only for DOS/UNIX systems - need to put in
- * machine-specific stuff here and in upseg init */
+ // TODO this is only for DOS/UNIX systems - need to put in
+ // machine-specific stuff here and in upseg init
cmdline_del(j);
put_on_cmdline(upseg + 1, 3, FALSE);
}
else if (ccline.cmdpos > i)
cmdline_del(i);
- /* Now complete in the new directory. Set KeyTyped in case the
- * Up key came from a mapping. */
+ // Now complete in the new directory. Set KeyTyped in case the
+ // Up key came from a mapping.
c = p_wc;
KeyTyped = TRUE;
}
}
-#endif /* FEAT_WILDMENU */
+#endif // FEAT_WILDMENU
- /* CTRL-\ CTRL-N goes to Normal mode, CTRL-\ CTRL-G goes to Insert
- * mode when 'insertmode' is set, CTRL-\ e prompts for an expression. */
+ // CTRL-\ CTRL-N goes to Normal mode, CTRL-\ CTRL-G goes to Insert
+ // mode when 'insertmode' is set, CTRL-\ e prompts for an expression.
if (c == Ctrl_BSL)
{
++no_mapping;
@@ -1279,8 +1279,8 @@ getcmdline_int(
c = plain_vgetc();
--no_mapping;
--allow_keys;
- /* CTRL-\ e doesn't work when obtaining an expression, unless it
- * is in a mapping. */
+ // CTRL-\ e doesn't work when obtaining an expression, unless it
+ // is in a mapping.
if (c != Ctrl_N && c != Ctrl_G && (c != 'e'
|| (ccline.cmdfirstc == '=' && KeyTyped)
#ifdef FEAT_EVAL
@@ -1303,16 +1303,16 @@ getcmdline_int(
* able to enter a new one...
*/
if (ccline.cmdpos == ccline.cmdlen)
- new_cmdpos = 99999; /* keep it at the end */
+ new_cmdpos = 99999; // keep it at the end
else
new_cmdpos = ccline.cmdpos;
c = get_expr_register();
if (c == '=')
{
- /* Need to save and restore ccline. And set "textlock"
- * to avoid nasty things like going to another buffer when
- * evaluating an expression. */
+ // Need to save and restore ccline. And set "textlock"
+ // to avoid nasty things like going to another buffer when
+ // evaluating an expression.
++textlock;
p = get_expr_line();
--textlock;
@@ -1326,14 +1326,14 @@ getcmdline_int(
STRCPY(ccline.cmdbuff, p);
vim_free(p);
- /* Restore the cursor or use the position set with
- * set_cmdline_pos(). */
+ // Restore the cursor or use the position set with
+ // set_cmdline_pos().
if (new_cmdpos > ccline.cmdlen)
ccline.cmdpos = ccline.cmdlen;
else
ccline.cmdpos = new_cmdpos;
- KeyTyped = FALSE; /* Don't do p_wc completion. */
+ KeyTyped = FALSE; // Don't do p_wc completion.
redrawcmd();
goto cmdline_changed;
}
@@ -1341,7 +1341,7 @@ getcmdline_int(
}
}
beep_flush();
- got_int = FALSE; /* don't abandon the command line */
+ got_int = FALSE; // don't abandon the command line
did_emsg = FALSE;
emsg_on_display = FALSE;
redrawcmd();
@@ -1352,9 +1352,9 @@ getcmdline_int(
{
if (c == Ctrl_G && p_im && restart_edit == 0)
restart_edit = 'a';
- gotesc = TRUE; /* will free ccline.cmdbuff after putting it
- in history */
- goto returncmd; /* back to Normal mode */
+ gotesc = TRUE; // will free ccline.cmdbuff after putting it
+ // in history
+ goto returncmd; // back to Normal mode
}
}
@@ -1381,7 +1381,7 @@ getcmdline_int(
if (c == '\n' || c == '\r' || c == K_KENTER || (c == ESC
&& (!KeyTyped || vim_strchr(p_cpo, CPO_ESC) != NULL)))
{
- /* In Ex mode a backslash escapes a newline. */
+ // In Ex mode a backslash escapes a newline.
if (exmode_active
&& c != ESC
&& ccline.cmdpos == ccline.cmdlen
@@ -1393,8 +1393,8 @@ getcmdline_int(
}
else
{
- gotesc = FALSE; /* Might have typed ESC previously, don't
- truncate the cmdline now. */
+ gotesc = FALSE; // Might have typed ESC previously, don't
+ // truncate the cmdline now.
if (ccheck_abbr(c + ABBR_OFF))
goto cmdline_changed;
if (!cmd_silent)
@@ -1417,9 +1417,9 @@ getcmdline_int(
int options = WILD_NO_BEEP;
if (wim_flags[wim_index] & WIM_BUFLASTUSED)
options |= WILD_BUFLASTUSED;
- if (xpc.xp_numfiles > 0) /* typed p_wc at least twice */
+ if (xpc.xp_numfiles > 0) // typed p_wc at least twice
{
- /* if 'wildmode' contains "list" may still need to list */
+ // if 'wildmode' contains "list" may still need to list
if (xpc.xp_numfiles > 1
&& !did_wild_list
&& (wim_flags[wim_index] & WIM_LIST))
@@ -1435,14 +1435,14 @@ getcmdline_int(
res = nextwild(&xpc, WILD_NEXT, options,
firstc != '@');
else
- res = OK; /* don't insert 'wildchar' now */
+ res = OK; // don't insert 'wildchar' now
}
- else /* typed p_wc first time */
+ else // typed p_wc first time
{
wim_index = 0;
j = ccline.cmdpos;
- /* if 'wildmode' first contains "longest", get longest
- * common part */
+ // if 'wildmode' first contains "longest", get longest
+ // common part
if (wim_flags[0] & WIM_LONGEST)
res = nextwild(&xpc, WILD_LONGEST, options,
firstc != '@');
@@ -1450,11 +1450,11 @@ getcmdline_int(
res = nextwild(&xpc, WILD_EXPAND_KEEP, options,
firstc != '@');
- /* if interrupted while completing, behave like it failed */
+ // if interrupted while completing, behave like it failed
if (got_int)
{
- (void)vpeekc(); /* remove <C-C> from input stream */
- got_int = FALSE; /* don't abandon the command line */
+ (void)vpeekc(); // remove <C-C> from input stream
+ got_int = FALSE; // don't abandon the command line
(void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE);
#ifdef FEAT_WILDMENU
xpc.xp_context = EXPAND_NOTHING;
@@ -1462,13 +1462,13 @@ getcmdline_int(
goto cmdline_changed;
}
- /* when more than one match, and 'wildmode' first contains
- * "list", or no change and 'wildmode' contains "longest,list",
- * list all matches */
+ // when more than one match, and 'wildmode' first contains
+ // "list", or no change and 'wildmode' contains "longest,list",
+ // list all matches
if (res == OK && xpc.xp_numfiles > 1)
{
- /* a "longest" that didn't do anything is skipped (but not
- * "list:longest") */
+ // a "longest" that didn't do anything is skipped (but not
+ // "list:longest")
if (wim_flags[0] == WIM_LONGEST && ccline.cmdpos == j)
wim_index = 1;
if ((wim_flags[wim_index] & WIM_LIST)
@@ -1483,7 +1483,7 @@ getcmdline_int(
int p_wmnu_save = p_wmnu;
p_wmnu = 0;
#endif
- /* remove match */
+ // remove match
nextwild(&xpc, WILD_PREV, 0, firstc != '@');
#ifdef FEAT_WILDMENU
p_wmnu = p_wmnu_save;
@@ -1522,7 +1522,7 @@ getcmdline_int(
gotesc = FALSE;
- /* <S-Tab> goes to last match, in a clumsy way */
+ // <S-Tab> goes to last match, in a clumsy way
if (c == K_S_TAB && KeyTyped)
{
if (nextwild(&xpc, WILD_EXPAND_KEEP, 0, firstc != '@') == OK
@@ -1531,10 +1531,10 @@ getcmdline_int(
goto cmdline_changed;
}
- if (c == NUL || c == K_ZERO) /* NUL is stored as NL */
+ if (c == NUL || c == K_ZERO) // NUL is stored as NL
c = NL;
- do_abbr = TRUE; /* default: check for abbreviation */
+ do_abbr = TRUE; // default: check for abbreviation
/*
* Big switch for a typed command line character.
@@ -1595,14 +1595,14 @@ getcmdline_int(
while (i < ccline.cmdlen)
ccline.cmdbuff[i++] = ccline.cmdbuff[j++];
- /* Truncate at the end, required for multi-byte chars. */
+ // Truncate at the end, required for multi-byte chars.
ccline.cmdbuff[ccline.cmdlen] = NUL;
#ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
{
is_state.search_start = is_state.save_cursor;
- /* save view settings, so that the screen
- * won't be restored at the wrong position */
+ // save view settings, so that the screen
+ // won't be restored at the wrong position
is_state.old_viewstate = is_state.init_viewstate;
}
#endif
@@ -1611,7 +1611,7 @@ getcmdline_int(
else if (ccline.cmdlen == 0 && c != Ctrl_W
&& ccline.cmdprompt == NULL && indent == 0)
{
- /* In ex and debug mode it doesn't make sense to return. */
+ // In ex and debug mode it doesn't make sense to return.
if (exmode_active
#ifdef FEAT_EVAL
|| ccline.cmdfirstc == '>'
@@ -1619,7 +1619,7 @@ getcmdline_int(
)
goto cmdline_not_changed;
- VIM_CLEAR(ccline.cmdbuff); /* no commandline to return */
+ VIM_CLEAR(ccline.cmdbuff); // no commandline to return
if (!cmd_silent)
{
#ifdef FEAT_RIGHTLEFT
@@ -1628,14 +1628,14 @@ getcmdline_int(
else
#endif
msg_col = 0;
- msg_putchar(' '); /* delete ':' */
+ msg_putchar(' '); // delete ':'
}
#ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
is_state.search_start = is_state.save_cursor;
#endif
redraw_cmdline = TRUE;
- goto returncmd; /* back to cmd mode */
+ goto returncmd; // back to cmd mode
}
goto cmdline_changed;
@@ -1643,17 +1643,17 @@ getcmdline_int(
case K_KINS:
ccline.overstrike = !ccline.overstrike;
#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
goto cmdline_not_changed;
case Ctrl_HAT:
if (map_to_exists_mode((char_u *)"", LANGMAP, FALSE))
{
- /* ":lmap" mappings exists, toggle use of mappings. */
+ // ":lmap" mappings exists, toggle use of mappings.
State ^= LANGMAP;
#ifdef HAVE_INPUT_METHOD
- im_set_active(FALSE); /* Disable input method */
+ im_set_active(FALSE); // Disable input method
#endif
if (b_im_ptr != NULL)
{
@@ -1666,19 +1666,19 @@ getcmdline_int(
#ifdef HAVE_INPUT_METHOD
else
{
- /* There are no ":lmap" mappings, toggle IM. When
- * 'imdisable' is set don't try getting the status, it's
- * always off. */
+ // There are no ":lmap" mappings, toggle IM. When
+ // 'imdisable' is set don't try getting the status, it's
+ // always off.
if ((p_imdisable && b_im_ptr != NULL)
? *b_im_ptr == B_IMODE_IM : im_get_status())
{
- im_set_active(FALSE); /* Disable input method */
+ im_set_active(FALSE); // Disable input method
if (b_im_ptr != NULL)
*b_im_ptr = B_IMODE_NONE;
}
else
{
- im_set_active(TRUE); /* Enable input method */
+ im_set_active(TRUE); // Enable input method
if (b_im_ptr != NULL)
*b_im_ptr = B_IMODE_IM;
}
@@ -1692,23 +1692,23 @@ getcmdline_int(
set_imsearch_global();
}
#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
#if defined(FEAT_KEYMAP)
- /* Show/unshow value of 'keymap' in status lines later. */
+ // Show/unshow value of 'keymap' in status lines later.
status_redraw_curbuf();
#endif
goto cmdline_not_changed;
-/* case '@': only in very old vi */
+// case '@': only in very old vi
case Ctrl_U:
- /* delete all characters left of the cursor */
+ // delete all characters left of the cursor
j = ccline.cmdpos;
ccline.cmdlen -= j;
i = ccline.cmdpos = 0;
while (i < ccline.cmdlen)
ccline.cmdbuff[i++] = ccline.cmdbuff[j++];
- /* Truncate at the end, required for multi-byte chars. */
+ // Truncate at the end, required for multi-byte chars.
ccline.cmdbuff[ccline.cmdlen] = NUL;
#ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
@@ -1719,7 +1719,7 @@ getcmdline_int(
#ifdef FEAT_CLIPBOARD
case Ctrl_Y:
- /* Copy the modeless selection, if there is one. */
+ // Copy the modeless selection, if there is one.
if (clip_star.state != SELECT_CLEARED)
{
if (clip_star.state == SELECT_DONE)
@@ -1729,30 +1729,30 @@ getcmdline_int(
break;
#endif
- case ESC: /* get here if p_wc != ESC or when ESC typed twice */
+ case ESC: // get here if p_wc != ESC or when ESC typed twice
case Ctrl_C:
- /* In exmode it doesn't make sense to return. Except when
- * ":normal" runs out of characters. */
+ // In exmode it doesn't make sense to return. Except when
+ // ":normal" runs out of characters.
if (exmode_active
&& (ex_normal_busy == 0 || typebuf.tb_len > 0))
goto cmdline_not_changed;
- gotesc = TRUE; /* will free ccline.cmdbuff after
- putting it in history */
- goto returncmd; /* back to cmd mode */
+ gotesc = TRUE; // will free ccline.cmdbuff after
+ // putting it in history
+ goto returncmd; // back to cmd mode
- case Ctrl_R: /* insert register */
+ case Ctrl_R: // insert register
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
+ dont_scroll = TRUE; // disallow scrolling here
#endif
putcmdline('"', TRUE);
++no_mapping;
++allow_keys;
- i = c = plain_vgetc(); /* CTRL-R <char> */
+ i = c = plain_vgetc(); // CTRL-R <char>
if (i == Ctrl_O)
- i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */
+ i = Ctrl_R; // CTRL-R CTRL-O == CTRL-R CTRL-R
if (i == Ctrl_R)
- c = plain_vgetc(); /* CTRL-R CTRL-R <char> */
+ c = plain_vgetc(); // CTRL-R CTRL-R <char>
extra_char = NUL;
--no_mapping;
--allow_keys;
@@ -1775,25 +1775,25 @@ getcmdline_int(
c = get_expr_register();
}
#endif
- if (c != ESC) /* use ESC to cancel inserting register */
+ if (c != ESC) // use ESC to cancel inserting register
{
cmdline_paste(c, i == Ctrl_R, FALSE);
#ifdef FEAT_EVAL
- /* When there was a serious error abort getting the
- * command line. */
+ // When there was a serious error abort getting the
+ // command line.
if (aborting())
{
- gotesc = TRUE; /* will free ccline.cmdbuff after
- putting it in history */
- goto returncmd; /* back to cmd mode */
+ gotesc = TRUE; // will free ccline.cmdbuff after
+ // putting it in history
+ goto returncmd; // back to cmd mode
}
#endif
- KeyTyped = FALSE; /* Don't do p_wc completion. */
+ KeyTyped = FALSE; // Don't do p_wc completion.
#ifdef FEAT_EVAL
if (new_cmdpos >= 0)
{
- /* set_cmdline_pos() was used */
+ // set_cmdline_pos() was used
if (new_cmdpos > ccline.cmdlen)
ccline.cmdpos = ccline.cmdlen;
else
@@ -1806,10 +1806,10 @@ getcmdline_int(
case Ctrl_D:
if (showmatches(&xpc, FALSE) == EXPAND_NOTHING)
- break; /* Use ^D as normal char instead */
+ break; // Use ^D as normal char instead
redrawcmd();
- continue; /* don't do incremental search now */
+ continue; // don't do incremental search now
case K_RIGHT:
case K_S_RIGHT:
@@ -1843,7 +1843,7 @@ getcmdline_int(
do
{
--ccline.cmdpos;
- if (has_mbyte) /* move to first byte of char */
+ if (has_mbyte) // move to first byte of char
ccline.cmdpos -= (*mb_head_off)(ccline.cmdbuff,
ccline.cmdbuff + ccline.cmdpos);
ccline.cmdspos -= cmdline_charsize(ccline.cmdpos);
@@ -1857,16 +1857,16 @@ getcmdline_int(
goto cmdline_not_changed;
case K_IGNORE:
- /* Ignore mouse event or open_cmdwin() result. */
+ // Ignore mouse event or open_cmdwin() result.
goto cmdline_not_changed;
#ifdef FEAT_GUI_MSWIN
- /* On MS-Windows ignore <M-F4>, we get it when closing the window
- * was cancelled. */
+ // On MS-Windows ignore <M-F4>, we get it when closing the window
+ // was cancelled.
case K_F4:
if (mod_mask == MOD_MASK_ALT)
{
- redrawcmd(); /* somehow the cmdline is cleared */
+ redrawcmd(); // somehow the cmdline is cleared
goto cmdline_not_changed;
}
break;
@@ -1874,15 +1874,15 @@ getcmdline_int(
case K_MIDDLEDRAG:
case K_MIDDLERELEASE:
- goto cmdline_not_changed; /* Ignore mouse */
+ goto cmdline_not_changed; // Ignore mouse
case K_MIDDLEMOUSE:
# ifdef FEAT_GUI
- /* When GUI is active, also paste when 'mouse' is empty */
+ // When GUI is active, also paste when 'mouse' is empty
if (!gui.in_use)
# endif
if (!mouse_has(MOUSE_COMMAND))
- goto cmdline_not_changed; /* Ignore mouse */
+ goto cmdline_not_changed; // Ignore mouse
# ifdef FEAT_CLIPBOARD
if (clip_star.available)
cmdline_paste('*', TRUE, TRUE);
@@ -1903,11 +1903,11 @@ getcmdline_int(
case K_LEFTRELEASE:
case K_RIGHTDRAG:
case K_RIGHTRELEASE:
- /* Ignore drag and release events when the button-down wasn't
- * seen before. */
+ // Ignore drag and release events when the button-down wasn't
+ // seen before.
if (ignore_drag_release)
goto cmdline_not_changed;
- /* FALLTHROUGH */
+ // FALLTHROUGH
case K_LEFTMOUSE:
case K_RIGHTMOUSE:
if (c == K_LEFTRELEASE || c == K_RIGHTRELEASE)
@@ -1915,11 +1915,11 @@ getcmdline_int(
else
ignore_drag_release = FALSE;
# ifdef FEAT_GUI
- /* When GUI is active, also move when 'mouse' is empty */
+ // When GUI is active, also move when 'mouse' is empty
if (!gui.in_use)
# endif
if (!mouse_has(MOUSE_COMMAND))
- goto cmdline_not_changed; /* Ignore mouse */
+ goto cmdline_not_changed; // Ignore mouse
# ifdef FEAT_CLIPBOARD
if (mouse_row < cmdline_row && clip_star.available)
{
@@ -1933,7 +1933,7 @@ getcmdline_int(
if (mouse_model_popup() && button == MOUSE_LEFT
&& (mod_mask & MOD_MASK_SHIFT))
{
- /* Translate shift-left to right button. */
+ // Translate shift-left to right button.
button = MOUSE_RIGHT;
mod_mask &= ~MOD_MASK_SHIFT;
}
@@ -1952,7 +1952,7 @@ getcmdline_int(
break;
if (has_mbyte)
{
- /* Count ">" for double-wide char that doesn't fit. */
+ // Count ">" for double-wide char that doesn't fit.
correct_cmdspos(ccline.cmdpos, i);
ccline.cmdpos += (*mb_ptr2len)(ccline.cmdbuff
+ ccline.cmdpos) - 1;
@@ -1961,12 +1961,12 @@ getcmdline_int(
}
goto cmdline_not_changed;
- /* Mouse scroll wheel: ignored here */
+ // Mouse scroll wheel: ignored here
case K_MOUSEDOWN:
case K_MOUSEUP:
case K_MOUSELEFT:
case K_MOUSERIGHT:
- /* Alternate buttons ignored here */
+ // Alternate buttons ignored here
case K_X1MOUSE:
case K_X1DRAG:
case K_X1RELEASE:
@@ -1977,7 +1977,7 @@ getcmdline_int(
goto cmdline_not_changed;
#ifdef FEAT_GUI
- case K_LEFTMOUSE_NM: /* mousefocus click, ignored */
+ case K_LEFTMOUSE_NM: // mousefocus click, ignored
case K_LEFTRELEASE_NM:
goto cmdline_not_changed;
@@ -2000,17 +2000,17 @@ getcmdline_int(
#ifdef FEAT_GUI_TABLINE
case K_TABLINE:
case K_TABMENU:
- /* Don't want to change any tabs here. Make sure the same tab
- * is still selected. */
+ // Don't want to change any tabs here. Make sure the same tab
+ // is still selected.
if (gui_use_tabline())
gui_mch_set_curtab(tabpage_index(curtab));
goto cmdline_not_changed;
#endif
- case K_SELECT: /* end of Select mode mapping - ignore */
+ case K_SELECT: // end of Select mode mapping - ignore
goto cmdline_not_changed;
- case Ctrl_B: /* begin of command line */
+ case Ctrl_B: // begin of command line
case K_HOME:
case K_KHOME:
case K_S_HOME:
@@ -2019,7 +2019,7 @@ getcmdline_int(
set_cmdspos();
goto cmdline_not_changed;
- case Ctrl_E: /* end of command line */
+ case Ctrl_E: // end of command line
case K_END:
case K_KEND:
case K_S_END:
@@ -2028,7 +2028,7 @@ getcmdline_int(
set_cmdspos_cursor();
goto cmdline_not_changed;
- case Ctrl_A: /* all matches */
+ case Ctrl_A: // all matches
if (nextwild(&xpc, WILD_ALL, 0, firstc != '@') == FAIL)
break;
goto cmdline_changed;
@@ -2039,13 +2039,13 @@ getcmdline_int(
goto cmdline_not_changed;
#endif
- /* completion: longest common part */
+ // completion: longest common part
if (nextwild(&xpc, WILD_LONGEST, 0, firstc != '@') == FAIL)
break;
goto cmdline_changed;
- case Ctrl_N: /* next match */
- case Ctrl_P: /* previous match */
+ case Ctrl_N: // next match
+ case Ctrl_P: // previous match
if (xpc.xp_numfiles > 0)
{
if (nextwild(&xpc, (c == Ctrl_P) ? WILD_PREV : WILD_NEXT,
@@ -2053,7 +2053,7 @@ getcmdline_int(
break;
goto cmdline_not_changed;
}
- /* FALLTHROUGH */
+ // FALLTHROUGH
case K_UP:
case K_DOWN:
case K_S_UP:
@@ -2062,12 +2062,12 @@ getcmdline_int(
case K_KPAGEUP:
case K_PAGEDOWN:
case K_KPAGEDOWN:
- if (get_hislen() == 0 || firstc == NUL) /* no history */
+ if (get_hislen() == 0 || firstc == NUL) // no history
goto cmdline_not_changed;
i = hiscnt;
- /* save current command string so it can be restored later */
+ // save current command string so it can be restored later
if (lookfor == NULL)
{
if ((lookfor = vim_strsave(ccline.cmdbuff)) == NULL)
@@ -2078,40 +2078,42 @@ getcmdline_int(
j = (int)STRLEN(lookfor);
for (;;)
{
- /* one step backwards */
+ // one step backwards
if (c == K_UP|| c == K_S_UP || c == Ctrl_P
|| c == K_PAGEUP || c == K_KPAGEUP)
{
- if (hiscnt == get_hislen()) /* first time */
+ if (hiscnt == get_hislen()) // first time
hiscnt = *get_hisidx(histype);
- else if (hiscnt == 0 && *get_hisidx(histype) != get_hislen() - 1)
+ else if (hiscnt == 0 && *get_hisidx(histype)
+ != get_hislen() - 1)
hiscnt = get_hislen() - 1;
else if (hiscnt != *get_hisidx(histype) + 1)
--hiscnt;
- else /* at top of list */
+ else // at top of list
{
hiscnt = i;
break;
}
}
- else /* one step forwards */
+ else // one step forwards
{
- /* on last entry, clear the line */
+ // on last entry, clear the line
if (hiscnt == *get_hisidx(histype))
{
hiscnt = get_hislen();
break;
}
- /* not on a history line, nothing to do */
+ // not on a history line, nothing to do
if (hiscnt == get_hislen())
break;
- if (hiscnt == get_hislen() - 1) /* wrap around */
+ if (hiscnt == get_hislen() - 1) // wrap around
hiscnt = 0;
else
++hiscnt;
}
- if (hiscnt < 0 || get_histentry(histype)[hiscnt].hisstr == NULL)
+ if (hiscnt < 0 || get_histentry(histype)[hiscnt].hisstr
+ == NULL)
{
hiscnt = i;
break;
@@ -2123,7 +2125,7 @@ getcmdline_int(
break;
}
- if (hiscnt != i) /* jumped to other entry */
+ if (hiscnt != i) // jumped to other entry
{
char_u *p;
int len;
@@ -2132,7 +2134,7 @@ getcmdline_int(
VIM_CLEAR(ccline.cmdbuff);
xpc.xp_context = EXPAND_NOTHING;
if (hiscnt == get_hislen())
- p = lookfor; /* back to the old one */
+ p = lookfor; // back to the old one
else
p = get_histentry(histype)[hiscnt].hisstr;
@@ -2140,17 +2142,17 @@ getcmdline_int(
&& p != lookfor
&& (old_firstc = p[STRLEN(p) + 1]) != firstc)
{
- /* Correct for the separator character used when
- * adding the history entry vs the one used now.
- * First loop: count length.
- * Second loop: copy the characters. */
+ // Correct for the separator character used when
+ // adding