diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-05 20:12:41 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-05 20:12:41 +0100 |
commit | 6e0ce171e19d0118ecd7c2b16e2a1bd50aa76013 (patch) | |
tree | 5446531fc72732454fef2eb38b5f86532c1b9340 /src/normal.c | |
parent | c95e8d649045add4e77b423bc159dc0d845af559 (diff) | |
download | vim-git-6e0ce171e19d0118ecd7c2b16e2a1bd50aa76013.tar.gz |
patch 8.1.2392: using old C style commentsv8.1.2392
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
Diffstat (limited to 'src/normal.c')
-rw-r--r-- | src/normal.c | 1222 |
1 files changed, 608 insertions, 614 deletions
diff --git a/src/normal.c b/src/normal.c index ca2a48c08..c4963e621 100644 --- a/src/normal.c +++ b/src/normal.c @@ -137,18 +137,18 @@ static char *e_noident = N_("E349: No identifier under cursor"); */ typedef void (*nv_func_T)(cmdarg_T *cap); -/* Values for cmd_flags. */ -#define NV_NCH 0x01 /* may need to get a second char */ -#define NV_NCH_NOP (0x02|NV_NCH) /* get second char when no operator pending */ -#define NV_NCH_ALW (0x04|NV_NCH) /* always get a second char */ -#define NV_LANG 0x08 /* second char needs language adjustment */ +// Values for cmd_flags. +#define NV_NCH 0x01 // may need to get a second char +#define NV_NCH_NOP (0x02|NV_NCH) // get second char when no operator pending +#define NV_NCH_ALW (0x04|NV_NCH) // always get a second char +#define NV_LANG 0x08 // second char needs language adjustment -#define NV_SS 0x10 /* may start selection */ -#define NV_SSS 0x20 /* may start selection with shift modifier */ -#define NV_STS 0x40 /* may stop selection without shift modif. */ -#define NV_RL 0x80 /* 'rightleft' modifies command */ -#define NV_KEEPREG 0x100 /* don't clear regname */ -#define NV_NCW 0x200 /* not allowed in command-line window */ +#define NV_SS 0x10 // may start selection +#define NV_SSS 0x20 // may start selection with shift modifier +#define NV_STS 0x40 // may stop selection without shift modif. +#define NV_RL 0x80 // 'rightleft' modifies command +#define NV_KEEPREG 0x100 // don't clear regname +#define NV_NCW 0x200 // not allowed in command-line window /* * Generally speaking, every Normal mode command should either clear any @@ -167,10 +167,10 @@ typedef void (*nv_func_T)(cmdarg_T *cap); */ static const struct nv_cmd { - int cmd_char; /* (first) command character */ - nv_func_T cmd_func; /* function for this command */ - short_u cmd_flags; /* NV_ flags */ - short cmd_arg; /* value for ca.arg */ + int cmd_char; // (first) command character + nv_func_T cmd_func; // function for this command + short_u cmd_flags; // NV_ flags + short cmd_arg; // value for ca.arg } nv_cmds[] = { {NUL, nv_error, 0, 0}, @@ -301,7 +301,7 @@ static const struct nv_cmd {'}', nv_findpar, 0, FORWARD}, {'~', nv_tilde, 0, 0}, - /* pound sign */ + // pound sign {POUND, nv_ident, 0, 0}, {K_MOUSEUP, nv_mousescroll, 0, MSCR_UP}, {K_MOUSEDOWN, nv_mousescroll, 0, MSCR_DOWN}, @@ -377,14 +377,14 @@ static const struct nv_cmd {K_PS, nv_edit, 0, 0}, }; -/* Number of commands in nv_cmds[]. */ +// Number of commands in nv_cmds[]. #define NV_CMDS_SIZE (sizeof(nv_cmds) / sizeof(struct nv_cmd)) -/* Sorted index of commands in nv_cmds[]. */ +// Sorted index of commands in nv_cmds[]. static short nv_cmd_idx[NV_CMDS_SIZE]; -/* The highest index for which - * nv_cmds[idx].cmd_char == nv_cmd_idx[nv_cmds[idx].cmd_char] */ +// The highest index for which +// nv_cmds[idx].cmd_char == nv_cmd_idx[nv_cmds[idx].cmd_char] static int nv_max_linear; /* @@ -396,7 +396,7 @@ nv_compare(const void *s1, const void *s2) { int c1, c2; - /* The commands are sorted on absolute value. */ + // The commands are sorted on absolute value. c1 = nv_cmds[*(const short *)s1].cmd_char; c2 = nv_cmds[*(const short *)s2].cmd_char; if (c1 < 0) @@ -414,14 +414,14 @@ init_normal_cmds(void) { int i; - /* Fill the index table with a one to one relation. */ + // Fill the index table with a one to one relation. for (i = 0; i < (int)NV_CMDS_SIZE; ++i) nv_cmd_idx[i] = i; - /* Sort the commands by the command character. */ + // Sort the commands by the command character. qsort((void *)&nv_cmd_idx, (size_t)NV_CMDS_SIZE, sizeof(short), nv_compare); - /* Find the first entry that can't be indexed by the command character. */ + // Find the first entry that can't be indexed by the command character. for (i = 0; i < (int)NV_CMDS_SIZE; ++i) if (i != nv_cmds[nv_cmd_idx[i]].cmd_char) break; @@ -440,21 +440,21 @@ find_command(int cmdchar) int top, bot; int c; - /* A multi-byte character is never a command. */ + // A multi-byte character is never a command. if (cmdchar >= 0x100) return -1; - /* We use the absolute value of the character. Special keys have a - * negative value, but are sorted on their absolute value. */ + // We use the absolute value of the character. Special keys have a + // negative value, but are sorted on their absolute value. if (cmdchar < 0) cmdchar = -cmdchar; - /* If the character is in the first part: The character is the index into - * nv_cmd_idx[]. */ + // If the character is in the first part: The character is the index into + // nv_cmd_idx[]. if (cmdchar <= nv_max_linear) return nv_cmd_idx[cmdchar]; - /* Perform a binary search. */ + // Perform a binary search. bot = nv_max_linear + 1; top = NV_CMDS_SIZE - 1; idx = -1; @@ -483,16 +483,16 @@ find_command(int cmdchar) void normal_cmd( oparg_T *oap, - int toplevel UNUSED) /* TRUE when called from main() */ + int toplevel UNUSED) // TRUE when called from main() { - cmdarg_T ca; /* command arguments */ + cmdarg_T ca; // command arguments int c; - int ctrl_w = FALSE; /* got CTRL-W command */ + int ctrl_w = FALSE; // got CTRL-W command int old_col = curwin->w_curswant; #ifdef FEAT_CMDL_INFO - int need_flushbuf; /* need to call out_flush() */ + int need_flushbuf; // need to call out_flush() #endif - pos_T old_pos; /* cursor position before command */ + pos_T old_pos; // cursor position before command int mapped_len; static int old_mapped_len = 0; int idx; @@ -500,12 +500,12 @@ normal_cmd( int set_prevcount = FALSE; #endif - vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */ + vim_memset(&ca, 0, sizeof(ca)); // also resets ca.retval ca.oap = oap; - /* Use a count remembered from before entering an operator. After typing - * "3d" we return from normal_cmd() and come back here, the "3" is - * remembered in "opcount". */ + // Use a count remembered from before entering an operator. After typing + // "3d" we return from normal_cmd() and come back here, the "3" is + // remembered in "opcount". ca.opcount = opcount; /* @@ -520,15 +520,15 @@ normal_cmd( #ifdef CURSOR_SHAPE if (finish_op != c) { - ui_cursor_shape(); /* may show different cursor shape */ + ui_cursor_shape(); // may show different cursor shape # ifdef FEAT_MOUSESHAPE update_mouseshape(-1); # endif } #endif - /* When not finishing an operator and no register name typed, reset the - * count. */ + // When not finishing an operator and no register name typed, reset the + // count. if (!finish_op && !oap->regname) { ca.opcount = 0; @@ -537,9 +537,9 @@ normal_cmd( #endif } - /* Restore counts from before receiving K_CURSORHOLD. This means after - * typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not - * "3 * 2". */ + // Restore counts from before receiving K_CURSORHOLD. This means after + // typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not + // "3 * 2". if (oap->prev_opcount > 0 || oap->prev_count0 > 0) { ca.opcount = oap->prev_opcount; @@ -552,13 +552,13 @@ normal_cmd( State = NORMAL_BUSY; #ifdef USE_ON_FLY_SCROLL - dont_scroll = FALSE; /* allow scrolling here */ + dont_scroll = FALSE; // allow scrolling here #endif #ifdef FEAT_EVAL - /* Set v:count here, when called from main() and not a stuffed - * command, so that v:count can be used in an expression mapping - * when there is no count. Do set it for redo. */ + // Set v:count here, when called from main() and not a stuffed + // command, so that v:count can be used in an expression mapping + // when there is no count. Do set it for redo. if (toplevel && readbuf1_empty()) set_vcount_ca(&ca, &set_prevcount); #endif @@ -590,18 +590,18 @@ normal_cmd( && VIsual_select && (vim_isprintc(c) || c == NL || c == CAR || c == K_KENTER)) { - /* Fake a "c"hange command. When "restart_edit" is set (e.g., because - * 'insertmode' is set) fake a "d"elete command, Insert mode will - * restart automatically. - * Insert the typed character in the typeahead buffer, so that it can - * be mapped in Insert mode. Required for ":lmap" to work. */ + // Fake a "c"hange command. When "restart_edit" is set (e.g., because + // 'insertmode' is set) fake a "d"elete command, Insert mode will + // restart automatically. + // Insert the typed character in the typeahead buffer, so that it can + // be mapped in Insert mode. Required for ":lmap" to work. ins_char_typebuf(c); if (restart_edit != 0) c = 'd'; else c = 'c'; - msg_nowait = TRUE; /* don't delay going to insert mode */ - old_mapped_len = 0; /* do go to Insert mode */ + msg_nowait = TRUE; // don't delay going to insert mode + old_mapped_len = 0; // do go to Insert mode } #ifdef FEAT_CMDL_INFO @@ -623,26 +623,26 @@ getcount: { ca.count0 /= 10; #ifdef FEAT_CMDL_INFO - del_from_showcmd(4); /* delete the digit and ~@% */ + del_from_showcmd(4); // delete the digit and ~@% #endif } else ca.count0 = ca.count0 * 10 + (c - '0'); - if (ca.count0 < 0) /* got too large! */ + if (ca.count0 < 0) // got too large! ca.count0 = 999999999L; #ifdef FEAT_EVAL - /* Set v:count here, when called from main() and not a stuffed - * command, so that v:count can be used in an expression mapping - * right after the count. Do set it for redo. */ + // Set v:count here, when called from main() and not a stuffed + // command, so that v:count can be used in an expression mapping + // right after the count. Do set it for redo. if (toplevel && readbuf1_empty()) set_vcount_ca(&ca, &set_prevcount); #endif if (ctrl_w) { ++no_mapping; - ++allow_keys; /* no mapping for nchar, but keys */ + ++allow_keys; // no mapping for nchar, but keys } - ++no_zero_mapping; /* don't map zero here */ + ++no_zero_mapping; // don't map zero here c = plain_vgetc(); LANGMAP_ADJUST(c, TRUE); --no_zero_mapping; @@ -662,25 +662,25 @@ getcount: if (c == Ctrl_W && !ctrl_w && oap->op_type == OP_NOP) { ctrl_w = TRUE; - ca.opcount = ca.count0; /* remember first count */ + ca.opcount = ca.count0; // remember first count ca.count0 = 0; ++no_mapping; - ++allow_keys; /* no mapping for nchar, but keys */ - c = plain_vgetc(); /* get next character */ + ++allow_keys; // no mapping for nchar, but keys + c = plain_vgetc(); // get next character LANGMAP_ADJUST(c, TRUE); --no_mapping; --allow_keys; #ifdef FEAT_CMDL_INFO need_flushbuf |= add_to_showcmd(c); #endif - goto getcount; /* jump back */ + goto getcount; // jump back } } if (c == K_CURSORHOLD) { - /* Save the count values so that ca.opcount and ca.count0 are exactly - * the same when coming back here after handling K_CURSORHOLD. */ + // Save the count values so that ca.opcount and ca.count0 are exactly + // the same when coming back here after handling K_CURSORHOLD. oap->prev_opcount = ca.opcount; oap->prev_count0 = ca.count0; } @@ -733,14 +733,14 @@ getcount: idx = find_command(ca.cmdchar); if (idx < 0) { - /* Not a known command: beep. */ + // Not a known command: beep. clearopbeep(oap); goto normal_end; } if (text_locked() && (nv_cmds[idx].cmd_flags & NV_NCW)) { - /* This command is not allowed while editing a cmdline: beep. */ + // This command is not allowed while editing a cmdline: beep. clearopbeep(oap); text_locked_msg(); goto normal_end; @@ -753,7 +753,7 @@ getcount: */ if (VIsual_active) { - /* when 'keymodel' contains "stopsel" may stop Select/Visual mode */ + // when 'keymodel' contains "stopsel" may stop Select/Visual mode if (km_stopsel && (nv_cmds[idx].cmd_flags & NV_STS) && !(mod_mask & MOD_MASK_SHIFT)) @@ -762,7 +762,7 @@ getcount: redraw_curbuf_later(INVERTED); } - /* Keys that work different when 'keymodel' contains "startsel" */ + // Keys that work different when 'keymodel' contains "startsel" if (km_startsel) { if (nv_cmds[idx].cmd_flags & NV_SS) @@ -771,7 +771,7 @@ getcount: idx = find_command(ca.cmdchar); if (idx < 0) { - /* Just in case */ + // Just in case clearopbeep(oap); goto normal_end; } @@ -786,9 +786,9 @@ getcount: if (curwin->w_p_rl && KeyTyped && !KeyStuffed && (nv_cmds[idx].cmd_flags & NV_RL)) { - /* Invert horizontal movements and operations. Only when typed by the - * user directly, not when the result of a mapping or "x" translated - * to "dl". */ + // Invert horizontal movements and operations. Only when typed by the + // user directly, not when the result of a mapping or "x" translated + // to "dl". switch (ca.cmdchar) { case 'l': ca.cmdchar = 'h'; break; @@ -821,18 +821,18 @@ getcount: && (oap->op_type != OP_NOP || VIsual_active)))) { int *cp; - int repl = FALSE; /* get character for replace mode */ - int lit = FALSE; /* get extra character literally */ - int langmap_active = FALSE; /* using :lmap mappings */ - int lang; /* getting a text character */ + int repl = FALSE; // get character for replace mode + int lit = FALSE; // get extra character literally + int langmap_active = FALSE; // using :lmap mappings + int lang; // getting a text character #ifdef HAVE_INPUT_METHOD - int save_smd; /* saved value of p_smd */ + int save_smd; // saved value of p_smd #endif ++no_mapping; - ++allow_keys; /* no mapping for nchar, but allow key codes */ - /* Don't generate a CursorHold event here, most commands can't handle - * it, e.g., nv_replace(), nv_csearch(). */ + ++allow_keys; // no mapping for nchar, but allow key codes + // Don't generate a CursorHold event here, most commands can't handle + // it, e.g., nv_replace(), nv_csearch(). did_cursorhold = TRUE; if (ca.cmdchar == 'g') { @@ -848,18 +848,18 @@ getcount: if (ca.nchar == 'r' || ca.nchar == '\'' || ca.nchar == '`' || ca.nchar == Ctrl_BSL) { - cp = &ca.extra_char; /* need to get a third character */ + cp = &ca.extra_char; // need to get a third character if (ca.nchar != 'r') - lit = TRUE; /* get it literally */ + lit = TRUE; // get it literally else - repl = TRUE; /* get it in replace mode */ + repl = TRUE; // get it in replace mode } else - cp = NULL; /* no third character needed */ + cp = NULL; // no third character needed } else { - if (ca.cmdchar == 'r') /* get it in replace mode */ + if (ca.cmdchar == 'r') // get it in replace mode repl = TRUE; cp = &ca.nchar; } @@ -872,14 +872,14 @@ getcount: { if (repl) { - State = REPLACE; /* pretend Replace mode */ + State = REPLACE; // pretend Replace mode #ifdef CURSOR_SHAPE - ui_cursor_shape(); /* show different cursor shape */ + ui_cursor_shape(); // show different cursor shape #endif } if (lang && curbuf->b_p_iminsert == B_IMODE_LMAP) { - /* Allow mappings defined with ":lmap". */ + // Allow mappings defined with ":lmap". --no_mapping; --allow_keys; if (repl) @@ -890,7 +890,7 @@ getcount: } #ifdef HAVE_INPUT_METHOD save_smd = p_smd; - p_smd = FALSE; /* Don't let the IM code show the mode here */ + p_smd = FALSE; // Don't let the IM code show the mode here if (lang && curbuf->b_p_iminsert == B_IMODE_IM) im_set_active(TRUE); #endif @@ -899,7 +899,7 @@ getcount: if (langmap_active) { - /* Undo the decrement done above */ + // Undo the decrement done above ++no_mapping; ++allow_keys; State = NORMAL_BUSY; @@ -921,7 +921,7 @@ getcount: if (!lit) { #ifdef FEAT_DIGRAPHS - /* Typing CTRL-K gets a digraph. */ + // Typing CTRL-K gets a digraph. if (*cp == Ctrl_K && ((nv_cmds[idx].cmd_flags & NV_LANG) || cp == &ca.extra_char) @@ -932,7 +932,7 @@ getcount: { *cp = c; # ifdef FEAT_CMDL_INFO - /* Guessing how to update showcmd here... */ + // Guessing how to update showcmd here... del_from_showcmd(3); need_flushbuf |= add_to_showcmd(*cp); # endif @@ -940,10 +940,10 @@ getcount: } #endif - /* adjust chars > 127, except after "tTfFr" commands */ + // adjust chars > 127, except after "tTfFr" commands LANGMAP_ADJUST(*cp, !lang); #ifdef FEAT_RIGHTLEFT - /* adjust Hebrew mapped char */ + // adjust Hebrew mapped char if (p_hkmap && lang && KeyTyped) *cp = hkmap(*cp); #endif @@ -967,8 +967,8 @@ getcount: { long towait = (p_ttm >= 0 ? p_ttm : p_tm); - /* There is a busy wait here when typing "f<C-\>" and then - * something different from CTRL-N. Can't be avoided. */ + // There is a busy wait here when typing "f<C-\>" and then + // something different from CTRL-N. Can't be avoided. while ((c = vpeekc()) <= 0 && towait > 0L) { do_sleep(towait > 50L ? 50L : towait); @@ -988,11 +988,11 @@ getcount: } } - /* When getting a text character and the next character is a - * multi-byte character, it could be a composing character. - * However, don't wait for it to arrive. Also, do enable mapping, - * because if it's put back with vungetc() it's too late to apply - * mapping. */ + // When getting a text character and the next character is a + // multi-byte character, it could be a composing character. + // However, don't wait for it to arrive. Also, do enable mapping, + // because if it's put back with vungetc() it's too late to apply + // mapping. --no_mapping; while (enc_utf8 && lang && (c = vpeekc()) > 0 && (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1)) @@ -1000,7 +1000,7 @@ getcount: c = plain_vgetc(); if (!utf_iscomposing(c)) { - vungetc(c); /* it wasn't, put it back */ + vungetc(c); // it wasn't, put it back break; } else if (ca.ncharC1 == 0) @@ -1039,14 +1039,14 @@ getcount: if (ca.cmdchar != K_IGNORE) { - msg_didout = FALSE; /* don't scroll screen up for normal command */ + msg_didout = FALSE; // don't scroll screen up for normal command msg_col = 0; } - old_pos = curwin->w_cursor; /* remember where cursor was */ + old_pos = curwin->w_cursor; // remember where cursor was - /* When 'keymodel' contains "startsel" some keys start Select/Visual - * mode. */ + // When 'keymodel' contains "startsel" some keys start Select/Visual + // mode. if (!VIsual_active && km_startsel) { if (nv_cmds[idx].cmd_flags & NV_SS) @@ -1083,8 +1083,8 @@ getcount: { int regname = 0; - /* Adjust the register according to 'clipboard', so that when - * "unnamed" is present it becomes '*' or '+' instead of '"'. */ + // Adjust the register according to 'clipboard', so that when + // "unnamed" is present it becomes '*' or '+' instead of '"'. # ifdef FEAT_CLIPBOARD adjust_clip_reg(®name); # endif @@ -1093,8 +1093,8 @@ getcount: #endif } - /* Get the length of mapped chars again after typing a count, second - * character or "z333<cr>". */ + // Get the length of mapped chars again after typing a count, second + // character or "z333<cr>". if (old_mapped_len > 0) old_mapped_len = typebuf_maplen(); @@ -1142,12 +1142,12 @@ getcount: { int save_State = State; - /* Draw the cursor with the right shape here */ + // Draw the cursor with the right shape here if (restart_edit != 0) State = INSERT; - /* If need to redraw, and there is a "keep_msg", redraw before the - * delay */ + // If need to redraw, and there is a "keep_msg", redraw before the + // delay if (must_redraw && keep_msg != NULL && !emsg_on_display) { char_u *kmsg; @@ -1170,8 +1170,8 @@ getcount: cursor_on(); out_flush(); if (msg_scroll || emsg_on_display) - ui_delay(1003L, TRUE); /* wait at least one second */ - ui_delay(3003L, FALSE); /* wait up to three seconds */ + ui_delay(1003L, TRUE); // wait at least one second + ui_delay(3003L, FALSE); // wait up to three seconds State = save_State; msg_scroll = FALSE; @@ -1185,17 +1185,17 @@ normal_end: msg_nowait = FALSE; - /* Reset finish_op, in case it was set */ + // Reset finish_op, in case it was set #ifdef CURSOR_SHAPE c = finish_op; #endif finish_op = FALSE; #ifdef CURSOR_SHAPE - /* Redraw the cursor with another shape, if we were in Operator-pending - * mode or did a replace command. */ + // Redraw the cursor with another shape, if we were in Operator-pending + // mode or did a replace command. if (c || ca.cmdchar == 'r') { - ui_cursor_shape(); /* may show different cursor shape */ + ui_cursor_shape(); // may show different cursor shape # ifdef FEAT_MOUSESHAPE update_mouseshape(-1); # endif @@ -1208,7 +1208,7 @@ normal_end: clear_showcmd(); #endif - checkpcmark(); /* check if we moved since setting pcmark */ + checkpcmark(); // check if we moved since setting pcmark vim_free(ca.searchbuf); if (has_mbyte) @@ -1216,18 +1216,18 @@ normal_end: if (curwin->w_p_scb && toplevel) { - validate_cursor(); /* may need to update w_leftcol */ + validate_cursor(); // may need to update w_leftcol do_check_scrollbind(TRUE); } if (curwin->w_p_crb && toplevel) { - validate_cursor(); /* may need to update w_leftcol */ + validate_cursor(); // may need to update w_leftcol do_check_cursorbind(); } #ifdef FEAT_TERMINAL - /* don't go to Insert mode if a terminal has a running job */ + // don't go to Insert mode if a terminal has a running job if (term_job_running(curbuf->b_term)) restart_edit = 0; #endif @@ -1257,7 +1257,7 @@ normal_end: if (restart_VIsual_select == 2) restart_VIsual_select = 1; - /* Save count before an operator for next time. */ + // Save count before an operator for next time. opcount = ca.opcount; } @@ -1271,11 +1271,11 @@ set_vcount_ca(cmdarg_T *cap, int *set_prevcount) { long count = cap->count0; - /* multiply with cap->opcount the same way as above */ + // multiply with cap->opcount the same way as above if (cap->opcount != 0) count = cap->opcount * (count == 0 ? 1 : count); set_vcount(count, count == 0 ? 1 : count, *set_prevcount); - *set_prevcount = FALSE; /* only set v:prevcount once */ + *set_prevcount = FALSE; // only set v:prevcount once } #endif @@ -1319,7 +1319,7 @@ end_visual_mode(void) setmouse(); mouse_dragging = 0; - /* Save the current VIsual area for '< and '> marks, and "gv" */ + // Save the current VIsual area for '< and '> marks, and "gv" curbuf->b_visual.vi_mode = VIsual_mode; curbuf->b_visual.vi_start = VIsual; curbuf->b_visual.vi_end = curwin->w_cursor; @@ -1343,7 +1343,7 @@ reset_VIsual_and_resel(void) if (VIsual_active) { end_visual_mode(); - redraw_curbuf_later(INVERTED); /* delete the inversion later */ + redraw_curbuf_later(INVERTED); // delete the inversion later } VIsual_reselect = FALSE; } @@ -1357,7 +1357,7 @@ reset_VIsual(void) if (VIsual_active) { end_visual_mode(); - redraw_curbuf_later(INVERTED); /* delete the inversion later */ + redraw_curbuf_later(INVERTED); // delete the inversion later VIsual_reselect = FALSE; } } @@ -1387,7 +1387,7 @@ find_is_eval_item( int *bnp, int dir) { - /* Accept everything inside []. */ + // Accept everything inside []. if ((*ptr == ']' && dir == BACKWARD) || (*ptr == '[' && dir == FORWARD)) ++*bnp; if (*bnp > 0) @@ -1397,11 +1397,11 @@ find_is_eval_item( return TRUE; } - /* skip over "s.var" */ + // skip over "s.var" if (*ptr == '.') return TRUE; - /* two-character item: s->var */ + // two-character item: s->var if (ptr[dir == BACKWARD ? 0 : 1] == '>' && ptr[dir == BACKWARD ? -1 : 0] == '-') { @@ -1499,7 +1499,7 @@ find_ident_at_pos( */ if (has_mbyte) { - /* Remember class of character under cursor. */ + // Remember class of character under cursor. if ((find_type & FIND_EVAL) && ptr[col] == ']') this_class = mb_get_class((char_u *)"a"); else @@ -1624,7 +1624,7 @@ prep_redo( int cmd5) { ResetRedobuff(); - if (regname != 0) /* yank from specified buffer */ + if (regname != 0) // yank from specified buffer { AppendCharToRedobuff('"'); AppendCharToRedobuff(regname); @@ -1714,7 +1714,7 @@ unshift_special(cmdarg_T *cap) may_clear_cmdline(void) { if (mode_displayed) - clear_cmdline = TRUE; /* unshow visual mode later */ + clear_cmdline = TRUE; // unshow visual mode later #ifdef FEAT_CMDL_INFO else clear_showcmd(); @@ -1728,7 +1728,7 @@ may_clear_cmdline(void) #define SHOWCMD_BUFLEN SHOWCMD_COLS + 1 + 30 static char_u showcmd_buf[SHOWCMD_BUFLEN]; -static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; /* For push_showcmd() */ +static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; // For push_showcmd() static int showcmd_is_clear = TRUE; static int showcmd_visual = FALSE; @@ -1747,7 +1747,7 @@ clear_showcmd(void) colnr_T leftcol, rightcol; linenr_T top, bot; - /* Show the size of the Visual area. */ + // Show the size of the Visual area. if (cursor_bot) { top = VIsual.lnum; @@ -1759,7 +1759,7 @@ clear_showcmd(void) bot = VIsual.lnum; } # ifdef FEAT_FOLDING - /* Include closed folds as a whole. */ + // Include closed folds as a whole. (void)hasFolding(top, &top, NULL); (void)hasFolding(bot, NULL, &bot); # endif @@ -1771,7 +1771,7 @@ clear_showcmd(void) char_u *saved_sbr = p_sbr; char_u *saved_w_sbr = curwin->w_p_sbr; - /* Make 'sbr' empty for a moment to get the correct size. */ + // Make 'sbr' empty for a moment to get the correct size. p_sbr = empty_option; curwin->w_p_sbr = empty_option; # endif @@ -1809,7 +1809,7 @@ clear_showcmd(void) { ++bytes; ++chars; - break; /* end of line */ + break; // end of line } bytes += l; ++chars; @@ -1820,7 +1820,7 @@ clear_showcmd(void) else sprintf((char *)showcmd_buf, "%d-%d", chars, bytes); } - showcmd_buf[SHOWCMD_COLS] = NUL; /* truncate */ + showcmd_buf[SHOWCMD_COLS] = NUL; // truncate showcmd_visual = TRUE; } else @@ -1828,7 +1828,7 @@ clear_showcmd(void) showcmd_buf[0] = NUL; showcmd_visual = FALSE; - /* Don't actually display something if there is nothing to clear. */ + // Don't actually display something if there is nothing to clear. if (showcmd_is_clear) return; } @@ -1873,7 +1873,7 @@ add_to_showcmd(int c) showcmd_visual = FALSE; } - /* Ignore keys that are scrollbar updates and mouse clicks */ + // Ignore keys that are scrollbar updates and mouse clicks if (IS_SPECIAL(c)) for (i = 0; ignore[i] != 0; ++i) if (ignore[i] == c) @@ -1969,7 +1969,7 @@ display_showcmd(void) */ screen_puts((char_u *)" " + len, (int)Rows - 1, sc_col + len, 0); - setcursor(); /* put cursor back where it belongs */ + setcursor(); // put cursor back where it belongs } #endif @@ -1991,8 +1991,8 @@ do_check_scrollbind(int check) if (check && curwin->w_p_scb) { - /* If a ":syncbind" command was just used, don't scroll, only reset - * the values. */ + // If a ":syncbind" command was just used, don't scroll, only reset + // the values. if (did_syncbind) did_syncbind = FALSE; else if (curwin == old_curwin) @@ -2017,7 +2017,7 @@ do_check_scrollbind(int check) (long)(curwin->w_leftcol - old_leftcol)); } } - else if (vim_strchr(p_sbo, 'j')) /* jump flag set in 'scrollopt' */ + else if (vim_strchr(p_sbo, 'j')) // jump flag set in 'scrollopt' { /* * When switching between windows, make sure that the relative @@ -2077,7 +2077,7 @@ check_scrollbind(linenr_T topline_diff, long leftcol_diff) FOR_ALL_WINDOWS(curwin) { curbuf = curwin->w_buffer; - /* skip original window and windows with 'noscrollbind' */ + // skip original window and windows with 'noscrollbind' if (curwin != old_curwin && curwin->w_p_scb) { /* @@ -2140,7 +2140,7 @@ check_scrollbind(linenr_T topline_diff, long leftcol_diff) static void nv_ignore(cmdarg_T *cap) { - cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ + cap->retval |= CA_COMMAND_BUSY; // don't call edit() now } /* @@ -2205,7 +2205,7 @@ nv_page(cmdarg_T *cap) { if (mod_mask & MOD_MASK_CTRL) { - /* <C-PageUp>: tab page back; <C-PageDown>: tab page forward */ + // <C-PageUp>: tab page back; <C-PageDown>: tab page forward if (cap->arg == BACKWARD) goto_tabpage(-(int)cap->count1); else @@ -2223,7 +2223,7 @@ nv_page(cmdarg_T *cap) nv_gd( oparg_T *oap, int nchar, - int thisblock) /* 1 for "1gd" and "1gD" */ + int thisblock) // 1 for "1gd" and "1gD" { int len; char_u *ptr; @@ -2297,7 +2297,7 @@ find_decl( int len, int locally, int thisblock, - int flags_arg) /* flags passed to searchit() */ + int flags_arg) // flags passed to searchit() { char_u *pat; pos_T old_pos; @@ -2314,15 +2314,15 @@ find_decl( if ((pat = alloc(len + 7)) == NULL) return FAIL; - /* Put "\V" before the pattern to avoid that the special meaning of "." - * and "~" causes trouble. */ + // Put "\V" before the pattern to avoid that the special meaning of "." + // and "~" causes trouble. sprintf((char *)pat, vim_iswordp(ptr) ? "\\V\\<%.*s\\>" : "\\V%.*s", len, ptr); old_pos = curwin->w_cursor; save_p_ws = p_ws; save_p_scs = p_scs; - p_ws = FALSE; /* don't wrap around end of file now */ - p_scs = FALSE; /* don't switch ignorecase off now */ + p_ws = FALSE; // don't wrap around end of file now + p_scs = FALSE; // don't switch ignorecase off now /* * With "gD" go to line 1. @@ -2331,7 +2331,7 @@ find_decl( */ if (!locally || !findpar(&incll, BACKWARD, 1L, '{', FALSE)) { - setpcmark(); /* Set in findpar() otherwise */ + setpcmark(); // Set in findpar() otherwise curwin->w_cursor.lnum = 1; par_pos = curwin->w_cursor; } @@ -2343,27 +2343,27 @@ find_decl( } curwin->w_cursor.col = 0; - /* Search forward for the identifier, ignore comment lines. */ + // Search forward for the identifier, ignore comment lines. CLEAR_POS(&found_pos); for (;;) { t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD, pat, 1L, searchflags, RE_LAST, NULL); if (curwin->w_cursor.lnum >= old_pos.lnum) - t = FAIL; /* match after start is failure too */ + t = FAIL; // match after start is failure too if (thisblock && t != FAIL) { pos_T *pos; - /* Check that the block the match is in doesn't end before the - * position where we started the search from. */ + // Check that the block the match is in doesn't end before the + // position where we started the search from. if ((pos = findmatchlimit(NULL, '}', FM_FORWARD, (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL && pos->lnum < old_pos.lnum) { - /* There can't be a useful match before the end of this block. - * Skip to the end. */ + // There can't be a useful match before the end of this block. + // Skip to the end. curwin->w_cursor = *pos; continue; } @@ -2371,7 +2371,7 @@ find_decl( if (t == FAIL) { - /* If we previously found a valid position, use it. */ + // If we previously found a valid position, use it. if (found_pos.lnum != 0) { curwin->w_cursor = found_pos; @@ -2381,41 +2381,41 @@ find_decl( } if (get_leader_len(ml_get_curline(), NULL, FALSE, TRUE) > 0) { - /* Ignore this line, continue at start of next line. */ + // Ignore this line, continue at start of next line. ++curwin->w_cursor.lnum; curwin->w_cursor.col = 0; continue; } valid = is_ident(ml_get_curline(), curwin->w_cursor.col); - /* If the current position is not a valid identifier and a previous - * match is present, favor that one instead. */ + // If the current position is not a valid identifier and a previous + // match is present, favor that one instead. if (!valid && found_pos.lnum != 0) { curwin->w_cursor = found_pos; break; } - /* Global search: use first valid match found */ + // Global search: use first valid match found if (valid && !locally) break; if (valid && curwin->w_cursor.lnum >= par_pos.lnum) { - /* If we previously found a valid position, use it. */ + // If we previously found a valid position, use it. if (found_pos.lnum != 0) curwin->w_cursor = found_pos; break; } - /* For finding a local variable and the match is before the "{" or - * inside a comment, continue searching. For K&R style function - * declarations this skips the function header without types. */ + // For finding a local variable and the match is before the "{" or + // inside a comment, continue searching. For K&R style function + // declarations this skips the function header without types. if (!valid) CLEAR_POS(&found_pos); else found_pos = curwin->w_cursor; - /* Remove SEARCH_START from flags to avoid getting stuck at one - * position. */ + // Remove SEARCH_START from flags to avoid getting stuck at one + // position. searchflags &= ~SEARCH_START; } @@ -2427,7 +2427,7 @@ find_decl( else { curwin->w_set_curswant = TRUE; - /* "n" searches forward now */ + // "n" searches forward now reset_search_dir(); } @@ -2452,10 +2452,10 @@ nv_screengo(oparg_T *oap, int dir, long dist) int retval = OK; int atend = FALSE; int n; - int col_off1; /* margin offset for first screen line */ - int col_off2; /* margin offset for wrapped screen line */ - int width1; /* text width for first screen line */ - int width2; /* test width for wrapped screen line */ + int col_off1; // margin offset for first screen line + int col_off2; // margin offset for wrapped screen line + int width1; // text width for first screen line + int width2; // test width for wrapped screen line oap->motion_type = MCHAR; oap->inclusive = (curwin->w_curswant == MAXCOL); @@ -2465,7 +2465,7 @@ nv_screengo(oparg_T *oap, int dir, long dist) width1 = curwin->w_width - col_off1; width2 = curwin->w_width - col_off2; if (width2 == 0) - width2 = 1; /* avoid divide by zero */ + width2 = 1; // avoid divide by zero if (curwin->w_width != 0) { @@ -2508,7 +2508,7 @@ nv_screengo(oparg_T *oap, int dir, long dist) curwin->w_curswant -= width2; else { - /* to previous line */ + // to previous line if (curwin->w_cursor.lnum == 1) { retval = FAIL; @@ -2516,8 +2516,8 @@ nv_screengo(oparg_T *oap, int dir, long dist) } --curwin->w_cursor.lnum; #ifdef FEAT_FOLDING - /* Move to the start of a closed fold. Don't do that when - * 'foldopen' contains "all": it will open in a moment. */ + // Move to the start of a closed fold. Don't do that when + // 'foldopen' contains "all": it will open in a moment. if (!(fdo_flags & FDO_ALL)) (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); @@ -2528,20 +2528,20 @@ nv_screengo(oparg_T *oap, int dir, long dist) + 1) * width2; } } - else /* dir == FORWARD */ + else // dir == FORWARD { if (linelen > width1) n = ((linelen - width1 - 1) / width2 + 1) * width2 + width1; else n = width1; if (curwin->w_curswant + width2 < (colnr_T)n) - /* move forward within line */ + // move forward within line curwin->w_curswant += width2; else { - /* to next line */ + // to next line #ifdef FEAT_FOLDING - /* Move to the end of a closed fold. */ + // Move to the end of a closed fold. (void)hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum); #endif @@ -2594,7 +2594,7 @@ nv_screengo(oparg_T *oap, int dir, long dist) } if (atend) - curwin->w_curswant = MAXCOL; /* stick in the last column */ + curwin->w_curswant = MAXCOL; // stick in the last column return retval; } @@ -2628,15 +2628,15 @@ scroll_redraw(int up, long count) scrolldown(count, TRUE); if (get_scrolloff_value()) { - /* Adjust the cursor position for 'scrolloff'. Mark w_topline as - * valid, otherwise the screen jumps back at the end of the file. */ + // Adjust the cursor position for 'scrolloff'. Mark w_topline as + // valid, otherwise the screen jumps back at the end of the file. cursor_correct(); check_cursor_moved(curwin); curwin->w_valid |= VALID_TOPLINE; - /* If moved back to where we were, at least move the cursor, otherwise - * we get stuck at one position. Don't move the cursor up if the - * first line of the buffer is already on the screen */ + // If moved back to where we were, at least move the cursor, otherwise + // we get stuck at one position. Don't move the cursor up if the + // first line of the buffer is already on the screen while (curwin->w_topline == prev_topline #ifdef FEAT_DIFF && curwin->w_topfill == prev_topfill @@ -2656,8 +2656,8 @@ scroll_redraw(int up, long count) || cursor_up(1L, FALSE) == FAIL) break; } - /* Mark w_topline as valid, otherwise the screen jumps back at the - * end of the file. */ + // Mark w_topline as valid, otherwise the screen jumps back at the + // end of the file. check_cursor_moved(curwin); curwin->w_valid |= VALID_TOPLINE; } @@ -2696,10 +2696,10 @@ nv_zet(cmdarg_T *cap) for (;;) { #ifdef USE_ON_FLY_SCROLL - dont_scroll = TRUE; /* disallow scrolling here */ + dont_scroll = TRUE; // disallow scrolling here #endif ++no_mapping; - ++allow_keys; /* no mapping for nchar, but allow key codes */ + ++allow_keys; // no mapping for nchar, but allow key codes nchar = plain_vgetc(); LANGMAP_ADJUST(nchar, TRUE); --no_mapping; @@ -2740,9 +2740,9 @@ nv_zet(cmdarg_T *cap) dozet: if ( #ifdef FEAT_FOLDING - /* "zf" and "zF" are always an operator, "zd", "zo", "zO", "zc" - * and "zC" only in Visual mode. "zj" and "zk" are motion - * commands. */ + // "zf" and "zF" are always an operator, "zd", "zo", "zO", "zc" + // and "zC" only in Visual mode. "zj" and "zk" are motion + // commands. cap->nchar != 'f' && cap->nchar != 'F' && !(VIsual_active && vim_strchr((char_u *)"dcCoO", cap->nchar)) && cap->nchar != 'j' && cap->nchar != 'k' @@ -2769,42 +2769,42 @@ dozet: switch (nchar) { - /* "z+", "z<CR>" and "zt": put cursor at top of screen */ + // "z+", "z<CR>" and "zt": put cursor at top of screen case '+': if (cap->count0 == 0) { - /* No count given: put cursor at the line below screen */ - validate_botline(); /* make sure w_botline is valid */ + // No count given: put cursor at the line below screen + validate_botline(); // make sure w_botline is valid if (curwin->w_botline > curbuf->b_ml.ml_line_count) curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; else curwin->w_cursor.lnum = curwin->w_botline; } - /* FALLTHROUGH */ + // FALLTHROUGH case NL: case CAR: case K_KENTER: beginline(BL_WHITE | BL_FIX); - /* FALLTHROUGH */ + // FALLTHROUGH case 't': scroll_cursor_top(0, TRUE); redraw_later(VALID); set_fraction(curwin); break; - /* "z." and "zz": put cursor in middle of screen */ + // "z." and "zz": put cursor in middle of screen case '.': beginline(BL_WHITE | BL_FIX); - /* FALLTHROUGH */ + // FALLTHROUGH case 'z': scroll_cursor_halfway(TRUE); redraw_later(VALID); set_fraction(curwin); break; - /* "z^", "z-" and "zb": put cursor at bottom of screen */ - case '^': /* Strange Vi behavior: <count>z^ finds line at top of window - * when <count> is at bottom of window, and puts that one at - * bottom of window. */ + // "z^", "z-" and "zb": put cursor at bottom of screen + case '^': // Strange Vi behavior: <count>z^ finds line at top of window + // when <count> is at bottom of window, and puts that one at + // bottom of window. if (cap->count0 != 0) { scroll_cursor_bot(0, TRUE); @@ -2814,22 +2814,22 @@ dozet: curwin->w_cursor.lnum = 1; else curwin->w_cursor.lnum = curwin->w_topline - 1; - /* FALLTHROUGH */ + // FALLTHROUGH case '-': beginline(BL_WHITE | BL_FIX); - /* FALLTHROUGH */ + // FALLTHROUGH case 'b': scroll_cursor_bot(0, TRUE); redraw_later(VALID); set_fraction(curwin); break; - /* "zH" - scroll screen right half-page */ + // "zH" - scroll screen right half-page case 'H': cap->count1 *= curwin->w_width / 2; - /* FALLTHROUGH */ + // FALLTHROUGH - /* "zh" - scroll screen to the right */ + // "zh" - scroll screen to the right case 'h': case K_LEFT: if (!curwin->w_p_wrap) @@ -2842,27 +2842,27 @@ dozet: } break; - /* "zL" - scroll screen left half-page */ + // "zL" - scroll screen left half-page case 'L': cap->count1 *= curwin->w_width / 2; - /* FALLTHROUGH */ + // FALLTHROUGH - /* "zl" - scroll screen to the left */ + // "zl" - scroll screen to the left case 'l': case K_RIGHT: if (!curwin->w_p_wrap) { - /* scroll the window left */ + // scroll the window left curwin->w_leftcol += (colnr_T)cap->count1; leftcol_changed(); } break; - /* "zs" - scroll screen, cursor at the start */ + // "zs" - scroll screen, cursor at the start case 's': if (!curwin->w_p_wrap) { #ifdef FEAT_FOLDING if (hasFolding(curwin->w_cursor.lnum, NULL, NULL)) - col = 0; /* like the cursor is in col 0 */ + col = 0; // like the cursor is in col 0 else #endif getvcol(curwin, &curwin->w_cursor, &col, NULL, NULL); @@ -2878,12 +2878,12 @@ dozet: } break; - /* "ze" - scroll screen, cursor at the end */ + // "ze" - scroll screen, cursor at the end case 'e': if (!curwin->w_p_wrap) { #ifdef FEAT_FOLDING if (hasFolding(curwin->w_cursor.lnum, NULL, NULL)) - col = 0; /* like the cursor is in col 0 */ + col = 0; // like the cursor is in col 0 else #endif getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col); @@ -2901,8 +2901,8 @@ dozet: break; #ifdef FEAT_FOLDING - /* "zF": create fold command */ - /* "zf": create fold operator */ + // "zF": create fold command + // "zf": create fold operator case 'F': case 'f': if (foldManualAllowed(TRUE)) { @@ -2910,7 +2910,7 @@ dozet: nv_operator(cap); curwin->w_p_fen = TRUE; - /* "zF" is like "zfzf" */ + // "zF" is like "zfzf" if (nchar == 'F' && cap->oap->op_type == OP_FOLD) { nv_operator(cap); @@ -2921,8 +2921,8 @@ dozet: clearopbeep(cap->oap); break; - /* "zd": delete fold at cursor */ - /* "zD": delete fold at cursor recursively */ + // "zd": delete fold at cursor + // "zD": delete fold at cursor recursively case 'd': case 'D': if (foldManualAllowed(FALSE)) { @@ -2934,7 +2934,7 @@ dozet: } break; - /* "zE": erase all folds */ + // "zE": erase all folds case 'E': if (foldmethodIsManual(curwin)) { clearFolding(curwin); @@ -2947,19 +2947,19 @@ dozet: emsg(_("E352: Cannot erase folds with current 'foldmethod'")); break; - /* "zn": fold none: reset 'foldenable' */ + // "zn": fold none: reset 'foldenable' case 'n': curwin->w_p_fen = FALSE; break; - /* "zN": fold Normal: set 'foldenable' */ + // "zN": fold Normal: set 'foldenable' case 'N': curwin->w_p_fen = TRUE; break; - /* "zi": invert folding: toggle 'foldenable' */ + // "zi": invert folding: toggle 'foldenable' case 'i': curwin->w_p_fen = !curwin->w_p_fen; break; - /* "za": open closed fold or close open fold at cursor */ + // "za": open closed fold or close open fold at cursor case 'a': if (hasFolding(curwin->w_cursor.lnum, NULL, NULL)) openFold(curwin->w_cursor.lnum, cap->count1); else @@ -2969,7 +2969,7 @@ dozet: } break; - /* "zA": open fold at cursor recursively */ + // "zA": open fold at cursor recursively case 'A': if (hasFolding(curwin->w_cursor.lnum, NULL, NULL)) openFoldRecurse(curwin->w_cursor.lnum); else @@ -2979,21 +2979,21 @@ dozet: } break; - /* "zo": open fold at cursor or Visual area */ + // "zo": open fold at cursor or Visual area case 'o': if (VIsual_active) nv_operator(cap); else openFold(curwin->w_cursor.lnum, cap->count1); break; - /* "zO": open fold recursively */ + // "zO": open fold recursively case 'O': if (VIsual_active) nv_operator(cap); else openFoldRecurse(curwin->w_cursor.lnum); break; - /* "zc": close fold at cursor or Visual area */ + // "zc": close fold at cursor or Visual area case 'c': if (VIsual_active) nv_operator(cap); else @@ -3001,7 +3001,7 @@ dozet: curwin->w_p_fen = TRUE; break; - /* "zC": close fold recursively */ + // "zC": close fold recursively case 'C': if (VIsual_active) nv_operator(cap); else @@ -3009,41 +3009,41 @@ dozet: curwin->w_p_fen = TRUE; break; - /* "zv": open folds at the cursor */ + // "zv": open folds at the cursor case 'v': foldOpenCursor(); break; - /* "zx": re-apply 'foldlevel' and open folds at the cursor */ + // "zx": re-apply 'foldlevel' and open folds at the cursor case 'x': curwin->w_p_fen = TRUE; - curwin->w_foldinvalid = TRUE; /* recompute folds */ - newFoldLevel(); /* update right now */ + curwin->w_foldinvalid = TRUE; // recompute folds + newFoldLevel(); // update right now foldOpenCursor(); break; - /* "zX": undo manual opens/closes, re-apply 'foldlevel' */ + // "zX": undo manual opens/closes, re-apply 'foldlevel' case 'X': curwin->w_p_fen = TRUE; - curwin->w_foldinvalid = TRUE; /* recompute folds */ - old_fdl = -1; /* force an update */ + curwin->w_foldinvalid = TRUE; // recompute folds + old_fdl = -1; // force an update break; - /* "zm": fold more */ + // "zm": fold more case 'm': if (curwin->w_p_fdl > 0) { curwin->w_p_fdl -= cap->count1; if (curwin->w_p_fdl < 0) curwin->w_p_fdl = 0; } - old_fdl = -1; /* force an update */ + old_fdl = -1; // force an update curwin->w_p_fen = TRUE; break; - /* "zM": close all folds */ + // "zM": close all folds case 'M': curwin->w_p_fdl = 0; - old_fdl = -1; /* force an update */ + old_fdl = -1; // force an update curwin->w_p_fen = TRUE; break; - /* "zr": reduce folding */ + // "zr": reduce folding case 'r': curwin->w_p_fdl += cap->count1; { int d = getDeepestNesting(); @@ -3053,24 +3053,24 @@ dozet: } break; - /* "zR": open all folds */ + // "zR": open all folds case 'R': curwin->w_p_fdl = getDeepestNesting(); - old_fdl = -1; /* force an update */ + old_fdl = -1; // force an update break; - case 'j': /* "zj" move to next fold downwards */ - case 'k': /* "zk" move to next fold upwards */ + case 'j': // "zj" move to next fold downwards + case 'k': // "zk" move to next fold upwards if (foldMoveTo(TRUE, nchar == 'j' ? FORWARD : BACKWARD, cap->count1) == FAIL) clearopbeep(cap->oap); break; -#endif /* FEAT_FOLDING */ +#endif // FEAT_FOLDING #ifdef FEAT_SPELL - case 'u': /* "zug" and "zuw": undo "zg" and "zw" */ + case 'u': // "zug" and "zuw": undo "zg" and "zw" ++no_mapping; - ++allow_keys; /* no mapping for nchar, but allow key codes */ + ++allow_keys; // no mapping for nchar, but allow key codes nchar = plain_vgetc(); LANGMAP_ADJUST(nchar, TRUE); --no_mapping; @@ -3084,12 +3084,12 @@ dozet: break; } undo = TRUE; - /* FALLTHROUGH */ + // FALLTHROUGH - case 'g': /* "zg": add good word to word list */ - case 'w': /* "zw": add wrong word to word list */ - case 'G': /* "zG": add good word to temp word list */ - case 'W': /* "zW": add wrong word to temp word list */ + case 'g': // "zg": add good word to word list + case 'w': // "zw": add wrong word to word list + case 'G': // "zG": add good word to temp word list + case 'W': // "zW": add wrong word to temp word list { char_u *ptr = NULL; int len; @@ -3103,9 +3103,9 @@ dozet: { pos_T pos = curwin->w_cursor; - /* Find bad word under the cursor. When 'spell' is - * off this fails and find_ident_under_cursor() is - * used below. */ + // Find bad word under the cursor. When 'spell' is + // off this fails and find_ident_under_cursor() is + // used below. emsg_off++; len = spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL); emsg_off--; @@ -3125,7 +3125,7 @@ dozet: } break; - case '=': /* "z=": suggestions for a badly spelled word */ + case '=': // "z=": suggestions for a badly spelled word if (!checkclearop(cap->oap)) spell_suggest((int)cap->count0); break; @@ -3135,7 +3135,7 @@ dozet: } #ifdef FEAT_FOLDING - /* Redraw when 'foldenable' changed */ + // Redraw when 'foldenable' changed if (old_fen != curwin->w_p_fen) { # ifdef FEAT_DIFF @@ -3143,7 +3143,7 @@ dozet: if (foldmethodIsDiff(curwin) && curwin->w_p_scb) { - /* Adjust 'foldenable' in diff-synced windows. */ + // Adjust 'foldenable' in diff-synced windows. FOR_ALL_WINDOWS(wp) { if (wp != curwin && foldmethodIsDiff(wp) && wp->w_p_scb) @@ -3157,7 +3157,7 @@ dozet: changed_window_setting(); } - /* Redraw when 'foldlevel' changed. */ + // Redraw when 'foldlevel' changed. if (old_fdl != curwin->w_p_fdl) newFoldLevel(); #endif @@ -3173,7 +3173,7 @@ nv_ver_scrollbar(cmdarg_T *cap) if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); - /* Even if an operator was pending, we still want to scroll */ + // Even if an operator was pending, we still want to scroll gui_do_scroll(); } @@ -3186,7 +3186,7 @@ nv_hor_scrollbar(cmdarg_T *cap) if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); - /* Even if an operator was pending, we still want to scroll */ + // Even if an operator was pending, we still want to scroll gui_do_horiz_scroll(scrollbar_value, FALSE); } #endif @@ -3201,7 +3201,7 @@ nv_tabline(cmdarg_T *cap) if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); - /* Even if an operator was pending, we still want to jump tabs. */ + // Even if an operator was pending, we still want to jump tabs. goto_tabpage(current_tab); } @@ -3214,7 +3214,7 @@ nv_tabmenu(cmdarg_T *cap) if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); - /* Even if an operator was pending, we still want to jump tabs. */ + // Even if an operator was pending, we still want to jump tabs. handle_tabmenu(); } @@ -3293,13 +3293,13 @@ nv_colon(cmdarg_T *cap) { if (cap->oap->op_type != OP_NOP) { - /* Using ":" as a movement is characterwise exclusive. */ + // Using ":" as a movement is characterwise exclusive. cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; } else if (cap->count0) { - /* translate "count:" into ":.,.+(count - 1)" */ + // translate "count:" into ":.,.+(count - 1)" stuffcharReadbuff('.'); if (cap->count0 > 1) { @@ -3308,17 +3308,17 @@ nv_colon(cmdarg_T *cap) } } - /* When typing, don't type below an old message */ + // When typing, don't type below an old message if (KeyTyped) compute_cmdrow(); old_p_im = p_im; - /* get a command line and execute it */ + // get a command line and execute it cmd_result = do_cmdline(NULL, getexline, NULL, cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0); - /* If 'insertmode' changed, enter or exit Insert mode */ + // If 'insertmode' changed, enter or exit Insert mode if (p_im != old_p_im) { if (p_im) @@ -3328,7 +3328,7 @@ nv_colon(cmdarg_T *cap) } if (cmd_result == FAIL) - /* The Ex command failed, do not execute the operator. */ + // The Ex command failed, do not execute the operator. clearop(cap->oap); else if (cap->oap->op_type != OP_NOP && (cap->oap->start.lnum > curbuf->b_ml.ml_line_count @@ -3336,8 +3336,7 @@ nv_colon(cmdarg_T *cap) (colnr_T)STRLEN(ml_get(cap->oap->start.lnum)) || did_emsg )) - /* The start of the operator has become invalid by the Ex command. - */ + // The start of the operator has become invalid by the Ex command. clearopbeep(cap->oap); } } @@ -3348,13 +3347,13 @@ nv_colon(cmdarg_T *cap) static void nv_ctrlg(cmdarg_T *cap) { - if (VIsual_active) /* toggle Selection/Visual mode */ + if (VIsual_active) // toggle Selection/Visual mode { VIsual_select = !VIsual_select; showmode(); } else if (!checkclearop(cap->oap)) - /* print full name if count given or :cd used */ + // print full name if count given or :cd used fileinfo((int)cap->count0, FALSE, TRUE); } @@ -3366,7 +3365,7 @@ nv_ctrlh(cmdarg_T *cap) { if (VIsual_active && VIsual_select) { - cap->cmdchar = 'x'; /* BS key behaves like 'x' in Select mode */ + cap->cmdchar = 'x'; // BS key behaves like 'x' in Select mode v_visop(cap); } else @@ -3390,7 +3389,7 @@ nv_clear(cmdarg_T *cap) ui_get_shellsize(); #endif #ifdef FEAT_SYN_HL - /* Clear all syntax states to force resyncing. */ + // Clear all syntax states to force resyncing. syn_stack_free_all(curwin->w_s); # ifdef FEAT_RELTIME { @@ -3422,7 +3421,7 @@ nv_ctrlo(cmdarg_T *cap) { VIsual_select = FALSE; showmode(); - restart_VIsual_select = 2; /* restart Select mode later */ + restart_VIsual_select = 2; // restart Select mode later } else { @@ -3453,11 +3452,11 @@ nv_Zet(cmdarg_T *cap) { switch (cap->nchar) { - /* "ZZ": equivalent to ":x". */ + // "ZZ": equivalent to ":x". case 'Z': do_cmdline_cmd((char_u *)"x"); break; - /* "ZQ": equivalent to ":q!" (Elvis compatible). */ + // "ZQ": equivalent to ":q!" (Elvis compatible). case 'Q': do_cmdline_cmd((char_u *)"q!"); break; @@ -3499,18 +3498,18 @@ nv_ident(cmdarg_T *cap) unsigned buflen; char_u *newbuf; char_u *p; - char_u *kp; /* value of 'keywordprg' */ - int kp_help; /* 'keywordprg' is ":he" */ - int kp_ex; /* 'keywordprg' starts with ":" */ - int n = 0; /* init for GCC */ + char_u *kp; // value of 'keywordprg' + int kp_help; // 'keywordprg' is ":he" + int kp_ex; // 'keywordprg' starts with ":" + int n = 0; // init for GCC int cmdchar; - int g_cmd; /* "g" command */ + int g_cmd; // "g" command int tag_cmd = FALSE; char_u *aux_ptr; int isman; int isman_s; - if (cap->cmdchar == 'g') /* "g*", "g#", "g]" and "gCTRL-]" */ + if (cap->cmdchar == 'g') // "g*", "g#", "g]" and "gCTRL-]" { cmdchar = cap->nchar; g_cmd = TRUE; @@ -3521,7 +3520,7 @@ nv_ident(cmdarg_T *cap) g_cmd = FALSE; } - if (cmdchar == POUND) /* the pound sign, '#' for English keyboards */ + if (cmdchar == POUND) // the pound sign, '#' for English keyboards cmdchar = '#'; /* @@ -3543,15 +3542,15 @@ nv_ident(cmdarg_T *cap) return; } - /* Allocate buffer to put the command in. Inserting backslashes can - * double the length of the word. p_kp / curbuf->b_p_kp could be added - * and some numbers. */ + // Allocate buffer to put the command in. Inserting backslashes can + // double the length of the word. p_kp / curbuf->b_p_kp could be added + // and some numbers. kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp); kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0); if (kp_help && *skipwhite(ptr) == NUL) { - emsg(_(e_noident)); /* found white space only */ + emsg(_(e_noident)); // found white space only return; } kp_ex = (*kp == ':'); @@ -3576,7 +3575,7 @@ nv_ident(cmdarg_T *cap) if (!g_cmd && vim_iswordp(ptr)) STRCPY(buf, "\\<"); - no_smartcase = TRUE; /* don't use 'smartcase' now */ + no_smartcase = TRUE; // don't use 'smartcase' now break; case 'K': @@ -3593,8 +3592,8 @@ nv_ident(cmdarg_T *cap) } else { - /* An external command will probably use an argument starting - * with "-" as an option. To avoid trouble we skip the "-". */ + // An external command will probably use an argument starting + // with "-" as an option. To avoid trouble we skip the "-". while (*ptr == '-' && n > 0) { ++ptr; @@ -3602,13 +3601,13 @@ nv_ident(cmdarg_T *cap) } if (n == 0) { - emsg(_(e_noident)); /* found dashes only */ + emsg(_(e_noident)); // found dashes only vim_free(buf); return; } - /* When a count is given, turn it into a range. Is this - * really what we want? */ + // When a count is given, turn it into a range. Is this + // really what we want? isman = (STRCMP(kp, "man") == 0); isman_s = (STRCMP(kp, "man -s") == 0); if (cap->count0 != 0 && !(isman || isman_s)) @@ -3658,10 +3657,10 @@ nv_ident(cmdarg_T *cap) { ptr = vim_strnsave(ptr, n); if (kp_ex) - /* Escape the argument properly for an Ex command */ + // Escape the argument properly for an Ex command p = vim_strsave_fnameescape(ptr, FALSE); else - /* Escape the argument properly for a shell command */ + // Escape the argument properly for a shell command p = vim_strsave_shellescape(ptr, TRUE, TRUE); vim_free(ptr); if (p == NULL) @@ -3689,7 +3688,7 @@ nv_ident(cmdarg_T *cap) else if (tag_cmd) { if (curbuf->b_help) - /* ":help" handles unescaped argument */ + // ":help" handles unescaped argument aux_ptr = (char_u *)""; else aux_ptr = (char_u *)"\\|\"\n["; @@ -3700,11 +3699,11 @@ nv_ident(cmdarg_T *cap) p = buf + STRLEN(buf); while (n-- > 0) { - /* put a backslash before \ and some others */ + // put a backslash before \ and some others if (vim_strchr(aux_ptr, *ptr) != NULL) *p++ = '\\'; - /* When current byte is a part of multibyte character, copy all - * bytes of that character. */ + // When current byte is a part of multibyte character, copy all + // bytes of that character. if (has_mbyte) { int i; @@ -3751,8 +3750,8 @@ nv_ident(cmdarg_T *cap) int get_visual_text( cmdarg_T *cap, - char_u **pp, /* return: start of selected text */ - int *lenp) /* return: length of selected text */ + char_u **pp, // return: start of selected text + int *lenp) // return: length of selected text { if (VIsual_mode != 'V') unadjust_for_sel(); @@ -3780,7 +3779,7 @@ get_visual_text( *lenp = curwin->w_cursor.col - VIsual.col + 1; } if (has_mbyte) - /* Correct the length to include the whole last character. */ + // Correct the length to include the whole last character. *lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1; } reset_VIsual_and_resel(); @@ -3815,7 +3814,7 @@ nv_scroll(cmdarg_T *cap) if (cap->cmdchar == 'L') { - validate_botline(); /* make sure curwin->w_botline is valid */ + validate_botline(); // make sure curwin->w_botline is valid curwin->w_cursor.lnum = curwin->w_botline - 1; if (cap->count1 - 1 >= curwin->w_cursor.lnum) curwin->w_cursor.lnum = 1; @@ -3824,7 +3823,7 @@ nv_scroll(cmdarg_T *cap) #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) { - /* Count a fold for one screen line. */ + // Count a fold for one screen line. for (n = cap->count1 - 1; n > 0 && curwin->w_cursor.lnum > curwin->w_topline; --n) { @@ -3843,17 +3842,17 @@ nv_scroll(cmdarg_T *cap) if (cap->cmdchar == 'M') { #ifdef FEAT_DIFF - /* Don't count filler lines above the window. */ + // Don't count filler lines above the window. used -= diff_check_fill(curwin, curwin->w_topline) - curwin->w_topfill; #endif - validate_botline(); /* make sure w_empty_rows is valid */ + validate_botline(); // make sure w_empty_rows is valid half = (curwin->w_height - curwin->w_empty_rows + 1) / 2; for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; ++n) { #ifdef FEAT_DIFF - /* Count half he number of filler lines to be "below this - * line" and half to be "above the next line". */ + // Count half he number of filler lines to be "below this + // line" and half to be "above the next line". if (n > 0 && used + diff_check_fill(curwin, curwin->w_topline + n) / 2 >= half) { @@ -3872,13 +3871,13 @@ nv_scroll(cmdarg_T *cap) if (n > 0 && used > curwin->w_height) --n; } - else /* (cap->cmdchar == 'H') */ + else // (cap->cmdchar == 'H') { n = cap->count1 - 1; #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) { - /* Count a fold for one screen line. */ + // Count a fold for one screen line. lnum = curwin->w_topline; while (n-- > 0 && lnum < curwin->w_botline - 1) { @@ -3894,7 +3893,7 @@ nv_scroll(cmdarg_T *cap) curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; } - /* Correct for 'so', except when an operator is pending. */ + // Correct for 'so', except when an operator is pending. if (cap->oap->op_type == OP_NOP) cursor_correct(); beginline(BL_SOL | BL_FIX); @@ -3911,7 +3910,7 @@ nv_right(cmdarg_T *cap) if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { - /* <C-Right> and <S-Right> move a word or WORD right */ + // <C-Right> and <S-Right> move a word or WORD right if (mod_mask & MOD_MASK_CTRL) cap->arg = TRUE; nv_wordcmd(cap); @@ -3948,9 +3947,9 @@ nv_right(cmdarg_T *cap) && vim_strchr(p_ww, '>') != NULL)) && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { - /* When deleting we also count the NL as a character. - * Set cap->oap->inclusive when last char in the line is - * included, move to next line after that */ + // When deleting we also count the NL as a character. + // Set cap->oap->inclusive when last char in the line is + // included, move to next line after that if ( cap->oap->op_type != OP_NOP && !cap->oap->inclusive && !LINEEMPTY(curwin->w_cursor.lnum)) @@ -3967,7 +3966,7 @@ nv_right(cmdarg_T *cap) } if (cap->oap->op_type == OP_NOP) { - /* Only beep and flush if not moved at all */ + // Only beep and flush if not moved at all if (n == cap->count1) beep_flush(); } @@ -4011,7 +4010,7 @@ nv_left(cmdarg_T *cap) if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { - /* <C-Left> and <S-Left> move a word or WORD left */ + // <C-Left> and <S-Left> move a word or WORD left if (mod_mask & MOD_MASK_CTRL) cap->arg = 1; nv_bck_word(cap); @@ -4024,10 +4023,9 @@ nv_left(cmdarg_T *cap) { if (oneleft() == FAIL) { - /* <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'. - * 'h' wraps to previous line if 'whichwrap' has 'h'. - * CURS_LEFT wraps to previous line if 'whichwrap' has '<'. - */ + // <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'. + // 'h' wraps to previous line if 'whichwrap' has 'h'. + // CURS_LEFT wraps to previous line if 'whichwrap' has '<'. if ( (((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H) && vim_strchr(p_ww, 'b') != NULL) @@ -4041,10 +4039,10 @@ nv_left(cmdarg_T *cap) coladvance((colnr_T)MAXCOL); curwin->w_set_curswant = TRUE; - /* When the NL before the first char has to be deleted we - * put the cursor on the NUL after the previous line. - * This is a very special case, be careful! - * Don't adjust op_end now, otherwise it won't work. */ + // When the NL before the first char has to be deleted we + // put the cursor on the NUL after the previous line. + // This is a very special case, be careful! + // Don't adjust op_end now, otherwise it won't work. if ( (cap->oap->op_type == OP_DELETE || cap->oap->op_type == OP_CHANGE) && !LINEEMPTY(curwin->w_cursor.lnum)) @@ -4062,7 +4060,7 @@ nv_left(cmdarg_T *cap) } continue; } - /* Only beep and flush if not moved at all */ + // Only beep and flush if not moved at all else if (cap->oap->op_type == OP_NOP && n == cap->count1) beep_flush(); break; @@ -4084,7 +4082,7 @@ nv_up(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { - /* <S-Up> is page up */ + // <S-Up> is page up cap->arg = BACKWARD; nv_page(cap); } @@ -4107,25 +4105,25 @@ nv_down(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { - /* <S-Down> is page down */ + // <S-Down> is page down cap->arg = FORWARD; nv_page(cap); } #if defined(FEAT_QUICKFIX) - /* Quickfix window only: view the result under the cursor. */ + // Quickfix window only: view the result under the cursor. else if (bt_quickfix(curbuf) && cap->cmdchar == CAR) qf_view_result(FALSE); #endif else { #ifdef FEAT_CMDWIN - /* In the cmdline window a <CR> executes the command. */ + // In the cmdline window a <CR> executes the command. if (cmdwin_type != 0 && cap->cmdchar == CAR) cmdwin_result = CAR; else #endif #ifdef FEAT_JOB_CHANNEL - /* In a prompt buffer a <CR> in the last line invokes the callback. */ + // In a prompt buffer a <CR> in the last line invokes the callback. if (bt_prompt(curbuf) && cap->cmdchar == CAR && curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count) { @@ -4171,7 +4169,7 @@ nv_gotofile(cmdarg_T *cap) if (ptr != NULL) { - /* do autowrite if necessary */ + // do autowrite if necessary if (curbufIsChanged() && curbuf->b_nwindows <= 1 && !buf_hide(curbuf)) (void)autowrite(curbuf, FALSE); setpcmark(); @@ -4196,11 +4194,11 @@ nv_gotofile(cmdarg_T *cap) static void nv_end(cmdarg_T *cap) { - if (cap->arg || (mod_mask & MOD_MASK_CTRL)) /* CTRL-END = goto last line */ + if (cap->arg || (mod_mask & MOD_MASK_CTRL)) // CTRL-END = goto last line { cap->arg = TRUE; nv_goto(cap); - cap->count1 = 1; /* to end of current line */ + cap->count1 = 1; // to end of current line } nv_dollar(cap); } @@ -4213,12 +4211,12 @@ nv_dollar(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = TRUE; - /* In virtual mode when off the edge of a line and an operator - * is pending (whew!) keep the cursor where it is. - * Otherwise, send it to the end of the line. */ + // In virtual mode when off the edge of a line and an operator + // is pending (whew!) keep the cursor where it is. + // Otherwise, send it to the end of the line. if (!virtual_active() || gchar_cursor() != NUL || cap->oap->op_type == OP_NOP) - curwin->w_curswant = MAXCOL; /* so we stay at the end */ + curwin->w_curswant = MAXCOL; // so we stay at the end if (cursor_down((long)(cap->count1 - 1), cap->oap->op_type == OP_NOP) == FAIL) clearopbeep(cap->oap); @@ -4240,15 +4238,15 @@ nv_search(cmdarg_T *cap) if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13) { - /* Translate "g??" to "g?g?" */ + // Translate "g??" to "g?g?" cap->cmdchar = 'g'; cap->nchar = '?'; nv_operator(cap); return; } - /* When using 'incsearch' the cursor may be moved to set a different search - * start position. */ + // When using 'incsearch' the cursor may be moved to set a different search + // start position. cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0, TRUE); if (cap->searchbuf == NULL) @@ -4275,9 +4273,9 @@ nv_next(cmdarg_T *cap) if (i == 1 && !wrapped && EQUAL_POS(old, curwin->w_cursor)) { - /* Avoid getting stuck on the current cursor position, which can - * happen when an offset is given and the cursor is on the last char - * in the buffer: Repeat with count + 1. */ + // Avoid getting stuck on the current cursor position, which can + // happen when an offset is given and the cursor is on the last char + // in the buffer: Repeat with count + 1. cap->count1 += 1; (void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, NULL); cap->count1 -= 1; @@ -4323,8 +4321,8 @@ normal_search( #endif } - /* "/$" will put the cursor after the end of the line, may need to - * correct that here */ + // "/$" will put the cursor after the end of the line, may need to + // correct that here check_cursor(); return i; } @@ -4351,7 +4349,7 @@ nv_csearch(cmdarg_T *cap) else { curwin->w_set_curswant = TRUE; - /* Include a Tab for "tx" and for "dfx". */ + // Include a Tab for "tx" and for "dfx". if (gchar_cursor() == TAB && virtual_active() && cap->arg == FORWARD && (t_cmd || cap->oap->op_type != OP_NOP)) { @@ -4379,8 +4377,8 @@ nv_brackets(cmdarg_T *cap) { pos_T new_pos = {0, 0, 0}; pos_T prev_pos; - pos_T *pos = NULL; /* init for GCC */ - pos_T old_pos; /* cursor position before command */ + pos_T *pos = NULL; // init for GCC + pos_T old_pos; // cursor position before command int flag; long n; int findc; @@ -4472,13 +4470,13 @@ nv_brackets(cmdarg_T *cap) if ((pos = findmatchlimit(cap->oap, findc, (cap->cmdchar == '[') ? FM_BACKWARD : FM_FORWARD, 0)) == NULL) { - if (new_pos.lnum == 0) /* nothing found */ + if (new_pos.lnum == 0) // nothing found { if (cap->nchar != 'm' && cap->nchar != 'M') clearopbeep(cap->oap); } else - pos = &new_pos; /* use last one found */ + pos = &new_pos; // use last one found break; } prev_pos = new_pos; @@ -4495,11 +4493,11 @@ nv_brackets(cmdarg_T *cap) */ if (cap->nchar == 'm' || cap->nchar == 'M') { - /* norm is TRUE for "]M" and "[m" */ + // norm is TRUE for "]M" and "[m" int norm = ((findc == '{') == (cap->nchar == 'm')); n = cap->count1; - /* found a match: we were inside a method */ + // found a match: we were inside a method if (prev_pos.lnum != 0) { pos = &prev_pos; @@ -4515,7 +4513,7 @@ nv_brackets(cmdarg_T *cap) { if ((findc == '{' ? dec_cursor() : inc_cursor()) < 0) { - /* if not found anything, that's an error */ + // if not found anything, that's an error if (pos == NULL) clearopbeep(cap->oap); n = 0; @@ -4524,22 +4522,22 @@ nv_brackets(cmdarg_T *cap) c = gchar_cursor(); if (c == '{' || c == '}') { - /* Must have found end/start of class: use it. - * Or found the place to be at. */ + // Must have found end/start of class: use it. + // Or found the place to be at. if ((c == findc && norm) || (n == 1 && !norm)) { new_pos = curwin->w_cursor; pos = &new_pos; n = 0; } - /* if no match found at all, we started outside of the - * class and we're inside now. Just go on. */ + // if no match found at all, we started outside of the + // class and we're inside now. Just go on. else if (new_pos.lnum == 0) { new_pos = curwin->w_cursor; pos = &new_pos; } - /* found start/end of other method: go to match */ + // found start/end of other method: go to match else if ((pos = findmatchlimit(cap->oap, findc, (cap->cmdchar == '[') ? FM_BACKWARD : FM_FORWARD, 0)) == NULL) @@ -4573,10 +4571,10 @@ nv_brackets(cmdarg_T *cap) */ else if (cap->nchar == '[' || cap->nchar == ']') { - if (cap->nchar == cap->cmdchar) /* "]]" or "[[" */ + if (cap->nchar == cap->cmdchar) // "]]" or "[[" flag = '{'; else - flag = '}'; /* "][" or "[]" */ + flag = '}'; // "][" or "[]" curwin->w_set_curswant = TRUE; /* @@ -4683,7 +4681,7 @@ nv_brackets(cmdarg_T *cap) } #endif - /* Not a valid cap->nchar. */ + // Not a valid cap->nchar. else clearopbeep(cap->oap); } @@ -4700,7 +4698,7 @@ nv_percent(cmdarg_T *cap) #endif cap->oap->inclusive = TRUE; - if (cap->count0) /* {cnt}% : goto {cnt} percentage in file */ + if (cap->count0) // {cnt}% : goto {cnt} percentage in file { if (cap->count0 > 100) clearopbeep(cap->oap); @@ -4708,8 +4706,8 @@ nv_percent(cmdarg_T *cap) { cap->oap->motion_type = MLINE; setpcmark(); - /* Round up, so CTRL-G will give same value. Watch out for a - * large line count, the line number must not go negative! */ + // Round up, so CTRL-G will give same value. Watch out for a + // large line count, the line number must not go negative! if (curbuf->b_ml.ml_line_count > 1000000) curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L) / 100L * cap->count0; @@ -4721,7 +4719,7 @@ nv_percent(cmdarg_T *cap) beginline(BL_SOL | BL_FIX); } } - else /* "%" : go to matching paren */ + else // "%" : go to matching paren { cap->oap->motion_type = MCHAR; cap->oap->use_reg_one = TRUE; @@ -4754,7 +4752,7 @@ nv_brace(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->use_reg_one = TRUE; - /* The motion used to be inclusive for "(", but that is not what Vi does. */ + // The motion used to be inclusive for "(", but that is not what Vi does. cap->oap->inclusive = FALSE; curwin->w_set_curswant = TRUE; @@ -4762,7 +4760,7 @@ nv_brace(cmdarg_T *cap) clearopbeep(cap->oap); else { - /* Don't leave the cursor on the NUL past end of line. */ + // Don't leave the cursor on the NUL past end of line. adjust_cursor(cap->oap); curwin->w_cursor.coladd = 0; #ifdef FEAT_FOLDING @@ -4816,7 +4814,7 @@ nv_undo(cmdarg_T *cap) { if (cap->oap->op_type == OP_LOWER || VIsual_active) { - /* translate "<Visual>u" to "<Visual>gu" and "guu" to "gugu" */ + // translate "<Visual>u" to "<Visual>gu" and "guu" to "gugu" cap->cmdchar = 'g'; cap->nchar = 'u'; nv_operator(cap); @@ -4865,34 +4863,34 @@ nv_replace(cmdarg_T *cap) } #endif - /* get another character */ + // get another character if (cap->nchar == Ctrl_V) { had_ctrl_v = Ctrl_V; cap->nchar = get_literal(); - /* Don't redo a multibyte character with CTRL-V. */ + // Don't redo a multibyte character with CTRL-V. if (cap->nchar > DEL) had_ctrl_v = NUL; } else had_ctrl_v = NUL; - /* Abort if the character is a special key. */ + // Abort if the character is a special key. if (IS_SPECIAL(cap->nchar)) { clearopbeep(cap->oap); return; } - /* Visual mode "r" */ + // Visual mode "r" if (VIsual_active) { if (got_int) reset_VIsual(); if (had_ctrl_v) { - /* Use a special (negative) number to make a difference between a - * literal CR or NL and a line break. */ + // Use a special (negative) number to make a difference between a + // literal CR or NL and a line break. if (cap->nchar == CAR) cap->nchar = REPLACE_CR_NCHAR; else if (cap->nchar == NL) @@ -4902,14 +4900,14 @@ nv_replace(cmdarg_T *cap) return; } - /* Break tabs, etc. */ + // Break tabs, etc. if (virtual_active()) { if (u_save_cursor() == FAIL) return; if (gchar_cursor() == NUL) { - /* Add extra space and put the cursor on the first one. */ + // Add extra space and put the cursor on the first one. coladvance_force((colnr_T)(getviscol() + cap->count1)); curwin->w_cursor.col -= cap->count1; } @@ -4917,7 +4915,7 @@ nv_replace(cmdarg_T *cap) coladvance_force(getviscol()); } - /* Abort if not enough characters to replace. */ + // Abort if not enough characters to replace. ptr = ml_get_cursor(); if (STRLEN(ptr) < (unsigned)cap->count1 || (has_mbyte && mb_charlen(ptr) < cap->count1)) @@ -4941,7 +4939,7 @@ nv_replace(cmdarg_T *cap) return; } - /* save line for undo */ + // save line for undo if (u_save_cursor() == FAIL) return; @@ -4955,11 +4953,11 @@ nv_replace(cmdarg_T *cap) * autoindent. The insert command depends on being on the last * character of a line or not. */ - (void)del_chars(cap->count1, FALSE); /* delete the characters */ + (void)del_chars(cap->count1, FALSE); // delete the characters stuffcharReadbuff('\r'); stuffcharReadbuff(ESC); - /* Give 'r' to edit(), to get the redo command right. */ + // Give 'r' to edit(), to get the redo command right. invoke_edit(cap, TRUE, 'r', FALSE); } else @@ -4977,9 +4975,9 @@ nv_replace(cmdarg_T *cap) if (cap->ncharC2 != 0) AppendCharToRedobuff(cap->ncharC2); - /* This is slow, but it handles replacing a single-byte with a - * multi-byte and the other way around. Also handles adding - * composing characters for utf-8. */ + // This is slow, but it handles replacing a single-byte with a + // multi-byte and the other way around. Also handles adding + // composing characters for utf-8. for (n = cap->count1; n > 0; --n) { State = REPLACE; @@ -4990,7 +4988,7 @@ nv_replace(cmdarg_T *cap) if (c != NUL) ins_char(c); else - /* will be decremented further down */ + // will be decremented further down ++curwin->w_cursor.col; } else @@ -5040,13 +5038,13 @@ nv_replace(cmdarg_T *cap) } #endif - /* mark the buffer as changed and prepare for displaying */ + // mark the buffer as changed and prepare for displaying changed_bytes(curwin->w_cursor.lnum, (colnr_T)(curwin->w_cursor.col - cap->count1)); } - --curwin->w_cursor.col; /* cursor on the last replaced char */ - /* if the character on the left of the current cursor is a multi-byte - * character, move two characters left */ + --curwin->w_cursor.col; // cursor on the last replaced char + // if the character on the left of the current cursor is a multi-byte + // character, move two characters left if (has_mbyte) mb_adjust_cursor(); curbuf->b_op_end = curwin->w_cursor; @@ -5075,8 +5073,8 @@ v_swap_corners(int cmdchar) curwin->w_cursor.lnum = old_cursor.lnum; curwin->w_curswant = right; - /* 'selection "exclusive" and cursor at right-bottom corner: move it - * right one column */ + // 'selection "exclusive" and cursor at right-bottom corner: move it + // right one column if (old_cursor.lnum >= VIsual.lnum && *p_sel == 'e') ++curwin->w_curswant; coladvance(curwin->w_curswant); @@ -5110,11 +5108,11 @@ v_swap_corners(int cmdchar) static void nv_Replace(cmdarg_T *cap) { - if (VIsual_active) /* "R" is replace lines */ + if (VIsual_active) // "R" is replace lines { cap->cmdchar = 'c'; cap->nchar = NUL; - VIsual_mode_orig = VIsual_mode; /* remember original area for gv */ + VIsual_mode_orig = VIsual_mode; // remember original area for gv VIsual_mode = 'V'; nv_operator(cap); } @@ -5141,7 +5139,7 @@ nv_vreplace(cmdarg_T *cap) { cap->cmdchar = 'r'; cap->nchar = cap->extra_char; - nv_replace(cap); /* Do same as "r" in Visual mode for now */ + nv_replace(cap); // Do same as "r" in Visual mode for now } else if (!checkclearopq(cap->oap)) { @@ -5149,7 +5147,7 @@ nv_vreplace(cmdarg_T *cap) emsg(_(e_modifiable)); else { - if (cap->extra_char == Ctrl_V) /* get another character */ + if (cap->extra_char == Ctrl_V) // get another character cap->extra_char = get_literal(); stuffcharReadbuff(cap->extra_char); stuffcharReadbuff(ESC); @@ -5279,7 +5277,7 @@ nv_cursormark(cmdarg_T *cap, int flag, pos_T *pos) cap->oap->motion_type = flag ? MLINE : MCHAR; if (cap->cmdchar == '`') cap->oap->use_reg_one = TRUE; - cap->oap->inclusive = FALSE; /* ignored if not MCHAR */ + cap->oap->inclusive = FALSE; // ignored if not MCHAR curwin->w_set_curswant = TRUE; } @@ -5291,8 +5289,8 @@ v_visop(cmdarg_T *cap) { static char_u trans[] = "YyDdCcxdXdAAIIrr"; - /* Uppercase means linewise, except in block mode, then "D" deletes till - * the end of the line, and "C" replaces till EOL */ + // Uppercase means linewise, except in block mode, then "D" deletes till + // the end of the line, and "C" replaces till EOL if (isupper(cap->cmdchar)) { if (VIsual_mode != Ctrl_V) @@ -5314,7 +5312,7 @@ v_visop(cmdarg_T *cap) nv_subst(cmdarg_T *cap) { #ifdef FEAT_TERMINAL - /* When showing output of term_dumpdiff() swap the top and botom. */ + // When showing output of term_dumpdiff() swap the top and botom. if (term_swap_diff() == OK) return; #endif @@ -5325,7 +5323,7 @@ nv_subst(cmdarg_T *cap) return; } #endif - if (VIsual_active) /* "vs" and "vS" are the same as "vc" */ + if (VIsual_active) // "vs" and "vS" are the same as "vc" { if (cap->cmdchar == 'S') { @@ -5346,9 +5344,9 @@ nv_subst(cmdarg_T *cap) nv_abbrev(cmdarg_T *cap) { if (cap->cmdchar == K_DEL || cap->cmdchar == K_KDEL) - cap->cmdchar = 'x'; /* DEL key behaves like 'x' */ + cap->cmdchar = 'x'; // DEL key behaves like 'x' - /* in Visual mode these commands are operators */ + // in Visual mode these commands are operators if (VIsual_active) v_visop(cap); else @@ -5405,7 +5403,7 @@ nv_gomark(cmdarg_T *cap) int c; #ifdef FEAT_FOLDING pos_T old_cursor = curwin->w_cursor; - int old_KeyTyped = KeyTyped; /* getting file may reset it */ + int old_KeyTyped = KeyTyped; // getting file may reset it #endif if (cap->cmdchar == 'g') @@ -5413,7 +5411,7 @@ nv_gomark(cmdarg_T *cap) else c = cap->nchar; pos = getmark(c, (cap->oap->op_type == OP_NOP)); - if (pos == (pos_T *)-1) /* jumped to other file */ + if (pos == (pos_T *)-1) // jumped to other file { if (cap->arg) { @@ -5426,7 +5424,7 @@ nv_gomark(cmdarg_T *cap) else nv_cursormark(cap, cap->arg, pos); - /* May need to clear the coladd that a mark includes. */ + // May need to clear the coladd that a mark includes. if (!virtual_active()) curwin->w_cursor.coladd = 0; check_cursor_col(); @@ -5450,7 +5448,7 @@ nv_pcmark(cmdarg_T *cap) pos_T *pos; # ifdef FEAT_FOLDING linenr_T lnum = curwin->w_cursor.lnum; - int old_KeyTyped = KeyTyped; /* getting file may reset it */ + int old_KeyTyped = KeyTyped; // getting file may reset it # endif if (!checkclearopq(cap->oap)) @@ -5459,12 +5457,12 @@ nv_pcmark(cmdarg_T *cap) pos = movechangelist((int)cap->count1); else pos = movemark((int)cap->count1); - if (pos == (pos_T *)-1) /* jump to other file */ + if (pos == (pos_T *)-1) // jump to other file { curwin->w_set_curswant = TRUE; check_cursor(); } - else if (pos != NULL) /* can jump */ + else if (pos != NULL) // can jump nv_cursormark(cap, FALSE, pos); else if (cap->cmdchar == 'g') { @@ -5505,7 +5503,7 @@ nv_regname(cmdarg_T *cap) if (cap->nchar != NUL && valid_yank_reg(cap->nchar, FALSE)) { cap->oap->regname = cap->nchar; - cap->opcount = cap->count0; /* remember count before '"' */ + cap->opcount = cap->count0; // remember count before '"' #ifdef FEAT_EVAL set_reg_var(cap->oap->regname); #endif @@ -5526,43 +5524,43 @@ nv_visual(cmdarg_T *cap) if (cap->cmdchar == Ctrl_Q) cap->cmdchar = Ctrl_V; - /* 'v', 'V' and CTRL-V can be used while an operator is pending to make it - * characterwise, linewise, or blockwise. */ + // 'v', 'V' and CTRL-V can be used while an operator is pending to make it + // characterwise, linewise, or blockwise. if (cap->oap->op_type != OP_NOP) { motion_force = cap->oap->motion_force = cap->cmdchar; - finish_op = FALSE; /* operator doesn't finish now but later */ + finish_op = FALSE; // operator doesn't finish now but later return; } VIsual_select = cap->arg; - if (VIsual_active) /* change Visual mode */ + if (VIsual_active) // change Visual mode { - if (VIsual_mode == cap->cmdchar) /* stop visual mode */ + if (VIsual_mode == cap->cmdchar) // stop visual mode end_visual_mode(); - else /* toggle char/block mode */ - { /* or char/line mode */ + else // toggle char/block mode + { // or char/line mode VIsual_mode = cap->cmdchar; showmode(); } - redraw_curbuf_later(INVERTED); /* update the inversion */ + redraw_curbuf_later(INVERTED); // update the inversion } - else /* start Visual mode */ + else // start Visual mode { check_visual_highlight(); if (cap->count0 > 0 && resel_VIsual_mode != NUL) { - /* use previously selected part */ + // use previously selected part VIsual = curwin->w_cursor; VIsual_active = TRUE; VIsual_reselect = TRUE; if (!cap->arg) - /* start Select mode when 'selectmode' contains "cmd" */ + // start Select mode when 'selectmode' contains "cmd" may_start_select('c'); setmouse(); if (p_smd && msg_silent == 0) - redraw_cmdline = TRUE; /* show visual mode later */ + redraw_cmdline = TRUE; // show visual mode later /* * For V and ^V, we multiply the number of lines even if there * was only one -- webb @@ -5601,19 +5599,19 @@ nv_visual(cmdarg_T *cap) } else curwin->w_set_curswant = TRUE; - redraw_curbuf_later(INVERTED); /* show the inversion */ + redraw_curbuf_later(INVERTED); // show the inversion } else { if (!cap->arg) - /* start Select mode when 'selectmode' contains "cmd" */ + // start Select mode when 'selectmode' contains "cmd" may_start_select('c'); n_start_visual_mode(cap->cmdchar); if (VIsual_mode != 'V' && *p_sel == 'e') - ++cap->count1; /* include one more char */ + ++cap->count1; // include one more char if (cap->count0 > 0 && --cap->count1 > 0) { - /* With a count select that many characters or lines. */ + // With a count select that many characters or lines. if (VIsual_mode == 'v' || VIsual_mode == Ctrl_V) nv_right(cap); else if (VIsual_mode == 'V') @@ -5629,7 +5627,7 @@ nv_visual(cmdarg_T *cap) void start_selection(void) { - /* if 'selectmode' contains "key", start Select mode */ + // if 'selectmode' contains "key", start Select mode may_start_select('k'); n_start_visual_mode('v'); } @@ -5652,7 +5650,7 @@ may_start_select(int c) n_start_visual_mode(int c) { #ifdef FEAT_CONCEAL - /* Check for redraw before changing the state. */ + // Check for redraw before changing the state. conceal_check_cursor_line(); #endif @@ -5675,20 +5673,20 @@ n_start_visual_mode(int c) setmouse(); #ifdef FEAT_CONCEAL - /* Check for redraw after changing the state. */ + // Check for redraw after changing the state. conceal_check_cursor_line(); #endif if (p_smd && msg_silent == 0) - redraw_cmdline = TRUE; /* show visual mode later */ + redraw_cmdline = TRUE; // show visual mode later #ifdef FEAT_CLIPBOARD - /* Make sure the clipboard gets updated. Needed because start and - * end may still be the same, and the selection needs to be owned */ + // Make sure the clipboard gets updated. Needed because start and + // end may still be the same, and the selection needs to be owned clip_star.vmode = NUL; #endif - /* Only need to redraw this line, unless still need to redraw an old - * Visual area (when 'lazyredraw' is set). */ + // Only need to redraw this line, unless still need to redraw an old + // Visual area (when 'lazyredraw' is set). if (curwin->w_redr_type < INVERTED) { curwin->w_old_cursor_lnum = curwin->w_cursor.lnum; @@ -5705,13 +5703,13 @@ nv_window(cmdarg_T *cap) { if (cap->nchar == ':') { - /* "CTRL-W :" is the same as typing ":"; useful in a terminal window */ + // "CTRL-W :" is the same as typing ":"; useful in a terminal window cap->cmdchar = ':'; cap->nchar = NUL; nv_colon(cap); } else if (!checkclearop(cap->oap)) - do_window(cap->nchar, cap->count0, NUL); /* everything is in window.c */ + do_window(cap->nchar, cap->count0, NUL); // everything is in window.c } /* @@ -5722,7 +5720,7 @@ nv_suspend(cmdarg_T *cap) { clearop(cap->oap); if (VIsual_active) - end_visual_mode(); /* stop Visual mode */ + end_visual_mode(); // stop Visual mode do_cmdline_cmd((char_u *)"st"); } @@ -5793,7 +5791,7 @@ nv_g_cmd(cmdarg_T *cap) beep_flush(); else { - /* set w_cursor to the start of the Visual area, tpos to the end */ + // set w_cursor to the start of the Visual area, tpos to the end if (VIsual_active) { i = VIsual_mode; @@ -5822,8 +5820,8 @@ nv_g_cmd(cmdarg_T *cap) VIsual_active = TRUE; VIsual_reselect = TRUE; - /* Set Visual to the start and w_cursor to the end of the Visual - * area. Make sure they are on an existing character. */ + // Set Visual to the start and w_cursor to the end of the Visual + // area. Make sure they are on an existing character. check_cursor(); VIsual = curwin->w_cursor; curwin->w_cursor = tpos; @@ -5840,8 +5838,8 @@ nv_g_cmd(cmdarg_T *cap) may_start_select('c'); setmouse(); #ifdef FEAT_CLIPBOARD - /* Make sure the clipboard gets updated. Needed because start and - * end are still the same, and the selection needs to be owned */ + // Make sure the clipboard gets updated. Needed because start and + // end are still the same, and the selection needs to be owned clip_star.vmode = NUL; #endif redraw_curbuf_later(INVERTED); @@ -5863,12 +5861,12 @@ nv_g_cmd(cmdarg_T *cap) */ case K_BS: cap->nchar = Ctrl_H; - /* FALLTHROUGH */ + // FALLTHROUGH case 'h': case 'H': case Ctrl_H: # ifdef EBCDIC - /* EBCDIC: 'v'-'h' != '^v'-'^h' */ + // EBCDIC: 'v'-'h' != '^v'-'^h' if (cap->nchar == Ctrl_H) cap->cmdchar = Ctrl_V; else @@ -5878,10 +5876,9 @@ nv_g_cmd(cmdarg_T *cap) nv_visual(cap); break; - /* "gn", "gN" visually select next/previous search match - * "gn" selects next match - * "gN" selects previous match - */ + // "gn", "gN" visually select next/previous search match + // "gn" selects next match + // "gN" selects previous match case 'N': case 'n': if (!current_search(cap->count1, cap->nchar == 'n')) @@ -5894,8 +5891,8 @@ nv_g_cmd(cmdarg_T *cap) */ case 'j': case K_DOWN: - /* with 'nowrap' it works just like the normal "j" command; also when - * in a closed fold */ + // with 'nowrap' it works just like the normal "j" command; also when + // in a closed fold if (!curwin->w_p_wrap #ifdef FEAT_FOLDING || hasFolding(curwin->w_cursor.lnum, NULL, NULL) @@ -5913,8 +5910,8 @@ nv_g_cmd(cmdarg_T *cap) case 'k': case K_UP: - /* with 'nowrap' it works just like the normal "k" command; also when - * in a closed fold */ + // with 'nowrap' it works just like the normal "k" command; also when + // in a closed fold if (!curwin->w_p_wrap #ifdef FEAT_FOLDING || hasFolding(curwin->w_cursor.lnum, NULL, NULL) @@ -5943,7 +5940,7 @@ nv_g_cmd(cmdarg_T *cap) */ case '^': flag = TRUE; - /* FALLTHROUGH */ + // FALLTHROUGH case '0': case 'm': @@ -5963,9 +5960,9 @@ nv_g_cmd(cmdarg_T *cap) } else i = curwin->w_leftcol; - /* Go to the middle of the screen line. When 'number' or - * 'relativenumber' is on and lines are wrapping the middle can be more - * to the left. */ + // Go to the middle of the screen line. When 'number' or + // 'relativenumber' is on and lines are wrapping the middle can be more + // to the left. if (cap->nchar == 'm') i += (curwin->w_width - curwin_col_off() + ((curwin->w_p_wrap && i > 0) @@ -6000,8 +5997,8 @@ nv_g_cmd(cmdarg_T *cap) break; case '_': - /* "g_": to the last non-blank character in the line or <count> lines - * downward. */ + // "g_": to the last non-blank character in the line or <count> lines + // downward. cap->oap->motion_type = MCHAR; cap->oap->inclusive = TRUE; curwin->w_curswant = MAXCOL; @@ -6012,11 +6009,11 @@ nv_g_cmd(cmdarg_T *cap) { char_u *ptr = ml_get_curline(); - /* In Visual mode we may end up after the line. */ + // In Visual mode we may end up after the line. if (curwin->w_cursor.col > 0 && ptr[curwin->w_cursor.col] == NUL) --curwin->w_cursor.col; - /* Decrease the cursor column until it's on a non-blank. */ + // Decrease the cursor column until it's on a non-blank. while (curwin->w_cursor.col > 0 && VIM_ISWHITE(ptr[curwin->w_cursor.col])) --curwin->w_cursor.col; @@ -6035,7 +6032,7 @@ nv_g_cmd(cmdarg_T *cap) oap->inclusive = TRUE; if (curwin->w_p_wrap && curwin->w_width != 0) { - curwin->w_curswant = MAXCOL; /* so we stay at the end */ + curwin->w_curswant = MAXCOL; // so we stay at the end if (cap->count1 == 1) { int width1 = curwin->w_width - col_off; @@ -6048,7 +6045,7 @@ nv_g_cmd(cmdarg_T *cap) * width2; coladvance((colnr_T)i); - /* Make sure we stick in this column. */ + // Make sure we stick in this column. validate_virtcol(); curwin->w_curswant = curwin->w_virtcol; curwin->w_set_curswant = FALSE; @@ -6089,10 +6086,10 @@ nv_g_cmd(cmdarg_T *cap) case '*': case '#': #if POUND != '#' - case POUND: /* pound sign (sometimes equal to '#') */ + case POUND: // pound sign (sometimes equal to '#') #endif - case Ctrl_RSB: /* :tag or :tselect for current identifier */ - case ']': /* :tselect for current identifier */ + case Ctrl_RSB: // :tag or :tselect for current identifier + case ']': // :tselect for current identifier nv_ident(cap); break; @@ -6155,10 +6152,10 @@ nv_g_cmd(cmdarg_T *cap) break; #endif - /* "g'm" and "g`m": jump to mark without setting pcmark */ + // "g'm" and "g`m": jump to mark without setting pcmark case '\'': cap->arg = TRUE; - /* FALLTHROUGH */ + // FALLTHROUGH case '`': nv_gomark(cap); break; @@ -6190,7 +6187,7 @@ nv_g_cmd(cmdarg_T *cap) show_utf8(); break; - /* "g<": show scrollback text */ + // "g<": show scrollback text case '<': show_sb_text(); break; @@ -6217,7 +6214,7 @@ nv_g_cmd(cmdarg_T *cap) case 'q': case 'w': oap->cursor_start = curwin->w_cursor; - /* FALLTHROUGH */ + // FALLTHROUGH case '~': case 'u': case 'U': @@ -6271,13 +6268,13 @@ nv_g_cmd(cmdarg_T *cap) break; #ifdef FEAT_BYTEOFF - /* "go": goto byte count from start of buffer */ + // "go": goto byte count from start of buffer case 'o': goto_byte(cap->count0); break; #endif - /* "gQ": improved Ex mode */ + // "gQ": improved Ex mode case 'Q': if (text_locked()) { @@ -6311,7 +6308,7 @@ nv_g_cmd(cmdarg_T *cap) break; case '+': - case '-': /* "g+" and "g-": undo or redo along the timeline */ + case '-': // "g+" and "g-": undo or redo along the timeline if (!checkclearopq(oap)) undo_time(cap->nchar == '-' ? -cap->count1 : cap->count1, FALSE, FALSE, FALSE); @@ -6337,11 +6334,11 @@ n_opencmd(cmdarg_T *cap) { #ifdef FEAT_FOLDING if (cap->cmdchar == 'O') - /* Open above the first line of a folded sequence of lines */ + // Open above the first line of a folded sequence of lines (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); else - /* Open below the last line of a folded sequence of lines */ + // Open below the last line of a folded sequence of lines (void)hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum); #endif @@ -6360,10 +6357,10 @@ n_opencmd(cmdarg_T *cap) #endif #ifdef FEAT_SYN_HL if (curwin->w_p_cul) - /* force redraw of cursorline */ + // force redraw of cursorline curwin->w_valid &= ~VALID_CROW; #endif - /* When '#' is in 'cpoptions' ignore the count. */ + // When '#' is in 'cpoptions' ignore the count. if (vim_strchr(p_cpo, CPO_HASH) != NULL) cap->count1 = 1; invoke_edit(cap, FALSE, cap->cmdchar, TRUE); @@ -6408,10 +6405,10 @@ nv_redo(cmdarg_T *cap) static void nv_Undo(cmdarg_T *cap) { - /* In Visual mode and typing "gUU" triggers an operator */ + // In Visual mode and typing "gUU" triggers an operator if (cap->oap->op_type == OP_UPPER || VIsual_active) { - /* translate "gUU" to "gUgU" */ + // translate "gUU" to "gUgU" cap->cmdchar = 'g'; cap->nchar = 'U'; nv_operator(cap); @@ -6463,7 +6460,7 @@ nv_operator(cmdarg_T *cap) } #endif - if (op_type == cap->oap->op_type) /* double operator works on lines */ + if (op_type == cap->oap->op_type) // double operator works on lines nv_lineop(cap); else if (!checkclearop(cap->oap)) { @@ -6511,13 +6508,13 @@ nv_lineop(cmdarg_T *cap) cap->oap->motion_type = MLINE; if (cursor_down(cap->count1 - 1L, cap->oap->op_type == OP_NOP) == FAIL) clearopbeep(cap->oap); - else if ( (cap->oap->op_type == OP_DELETE /* only with linewise motions */ + else if ( (cap->oap->op_type == OP_DELETE // only with linewise motions && cap->oap->motion_force != 'v' && cap->oap->motion_force != Ctrl_V) || cap->oap->op_type == OP_LSHIFT || cap->oap->op_type == OP_RSHIFT) beginline(BL_SOL | BL_FIX); - else if (cap->oap->op_type != OP_YANK) /* 'Y' does not move cursor */ + else if (cap->oap->op_type != OP_YANK) // 'Y' does not move cursor beginline(BL_WHITE | BL_FIX); } @@ -6527,7 +6524,7 @@ nv_lineop(cmdarg_T *cap) static void nv_home(cmdarg_T *cap) { - /* CTRL-HOME is like "gg" */ + // CTRL-HOME is like "gg" if (mod_mask & MOD_MASK_CTRL) nv_goto(cap); else @@ -6535,8 +6532,8 @@ nv_home(cmdarg_T *cap) cap->count0 = 1; nv_pipe(cap); } - ins_at_eol = FALSE; /* Don't move cursor past eol (only necessary in a - one-character line). */ + ins_at_eol = FALSE; // Don't move cursor past eol (only necessary in a + // one-character line). } /* @@ -6555,8 +6552,8 @@ nv_pipe(cmdarg_T *cap) } else curwin->w_curswant = 0; - /* keep curswant at the column where we wanted to go, not where - * we ended; differs if line is too short */ + // keep curswant at the column where we wanted to go, not where + // we ended; differs if line is too short curwin->w_set_curswant = FALSE; } @@ -6605,7 +6602,7 @@ nv_wordcmd(cmdarg_T *cap) if (!word_end && cap->oap->op_type == OP_CHANGE) { n = gchar_cursor(); - if (n != NUL) /* not an empty line */ + if (n != NUL) // not an empty line { if (VIM_ISWHITE(n)) { @@ -6649,8 +6646,8 @@ nv_wordcmd(cmdarg_T *cap) else n = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP); - /* Don't leave the cursor on the NUL past the end of line. Unless we - * didn't move it forward. */ + // Don't leave the cursor on the NUL past the end of line. Unless we + // didn't move it forward. if (LT_POS(startpos, curwin->w_cursor)) adjust_cursor(cap->oap); @@ -6674,17 +6671,16 @@ nv_wordcmd(cmdarg_T *cap) static void adjust_cursor(oparg_T *oap) { - /* The cursor cannot remain on the NUL when: - * - the column is > 0 - * - not in Visual mode or 'selection' is "o" - * - 'virtualedit' is not "all" and not "onemore". - */ + // The cursor cannot remain on the NUL when: + // - the column is > 0 + // - not in Visual mode or 'selection' is "o" + // - 'virtualedit' is not "all" and not "onemore". if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL && (!VIsual_active || *p_sel == 'o') && !virtual_active() && (ve_flags & VE_ONEMORE) == 0) { --curwin->w_cursor.col; - /* prevent cursor from moving on the trail byte */ + // prevent cursor from moving on the trail byte if (has_mbyte) mb_adjust_cursor(); oap->inclusive = TRUE; @@ -6705,8 +6701,8 @@ nv_beginline(cmdarg_T *cap) if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP) foldOpenCursor(); #endif - ins_at_eol = FALSE; /* Don't move cursor past eol (only necessary in a - one-character line). */ + ins_at_eol = FALSE; // Don't move cursor past eol (only necessary in a + // one-character line). } /* @@ -6770,7 +6766,7 @@ nv_select(cmdarg_T *cap) VIsual_select = TRUE; else if (VIsual_reselect) { - cap->nchar = 'v'; /* fake "gv" command */ + cap->nchar = 'v'; // fake "gv" command cap->arg = TRUE; nv_g_cmd(cap); } @@ -6793,7 +6789,7 @@ nv_goto(cmdarg_T *cap) cap->oap->motion_type = MLINE; setpcmark(); - /* When a count is given, use it instead of the default lnum */ + // When a count is given, use it instead of the default lnum if (cap->count0 != 0) lnum = cap->count0; if (lnum < 1L) @@ -6818,7 +6814,7 @@ nv_normal(cmdarg_T *cap) { clearop(cap->oap); if (restart_edit != 0 && mode_displayed) - clear_cmdline = TRUE; /* unshow mode later */ + clear_cmdline = TRUE; // unshow mode later restart_edit = 0; #ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -6826,10 +6822,10 @@ nv_normal(cmdarg_T *cap) #endif if (VIsual_active) { - end_visual_mode(); /* stop Visual */ + end_visual_mode(); // stop Visual redraw_curbuf_later(INVERTED); } - /* CTRL-\ CTRL-G restarts Insert mode when 'insertmode' is set. */ + // CTRL-\ CTRL-G restarts Insert mode when 'insertmode' is set. if (cap->nchar == Ctrl_G && p_im) restart_edit = 'a'; } @@ -6852,7 +6848,7 @@ nv_esc(cmdarg_T *cap) && cap->oap->regname == 0 && !p_im); - if (cap->arg) /* TRUE for CTRL-C */ + if (cap->arg) // TRUE for CTRL-C { if (restart_edit == 0 #ifdef FEAT_CMDWIN @@ -6867,15 +6863,15 @@ nv_esc(cmdarg_T *cap) msg(_("Type :qa and press <Enter> to exit Vim")); } - /* Don't reset "restart_edit" when 'insertmode' is set, it won't be - * set again below when halfway a mapping. */ + // Don't reset "restart_edit" when 'insertmode' is set, it won't be + // set again below when halfway a mapping. if (!p_im) restart_edit = 0; #ifdef FEAT_CMDWIN if (cmdwin_type != 0) { cmdwin_result = K_IGNORE; - got_int = FALSE; /* don't stop executing autocommands et al. */ + got_int = FALSE; // don't stop executing autocommands et al. return; } #endif @@ -6883,8 +6879,8 @@ nv_esc(cmdarg_T *cap) if (VIsual_active) { - end_visual_mode(); /* stop Visual */ - check_cursor_col(); /* make sure cursor is not beyond EOL */ + end_visual_mode(); // stop Visual + check_cursor_col(); // make sure cursor is not beyond EOL curwin->w_set_curswant = TRUE; redraw_curbuf_later(INVERTED); } @@ -6892,8 +6888,8 @@ nv_esc(cmdarg_T *cap) vim_beep(BO_ESC); clearop(cap->oap); - /* A CTRL-C is often used at the start of a menu. When 'insertmode' is - * set return to Insert mode afterwards. */ + // A CTRL-C is often used at the start of a menu. When 'insertmode' is + // set return to Insert mode afterwards. if (restart_edit == 0 && goto_im() && ex_normal_busy == 0) restart_edit = 'a'; } @@ -6909,8 +6905,8 @@ set_cursor_for_append_to_line(void) { int save_State = State; - /* Pretend Insert mode here to allow the cursor on the - * character past the end of the line */ + // Pretend Insert mode here to allow the cursor on the + // character past the end of the line State = INSERT; coladvance((colnr_T)MAXCOL); State = save_State; @@ -6926,11 +6922,11 @@ set_cursor_for_append_to_line(void) static void nv_edit(cmdarg_T *cap) { - /* <Insert> is equal to "i" */ + // <Insert> is equal to "i" if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS) cap->cmdchar = 'i'; - /* in Visual mode "A" and "I" are an operator */ + // in Visual mode "A" and "I" are an operator if (VIsual_active && (cap->cmdchar == 'A' || cap->cmdchar == 'I')) { #ifdef FEAT_TERMINAL @@ -6945,7 +6941,7 @@ nv_edit(cmdarg_T *cap) v_visop(cap); } - /* in Visual mode and after an operator "a" and "i" are for text objects */ + // in Visual mode and after an operator "a" and "i" are for text objects else if ((cap->cmdchar == 'a' || cap->cmdchar == 'i') && (cap->oap->op_type != OP_NOP || VIsual_active)) { @@ -6965,11 +6961,11 @@ nv_edit(cmdarg_T *cap) #endif else if (!curbuf->b_p_ma && !p_im) { - /* Only give this error when 'insertmode' is off. */ + // Only give this error when 'insertmode' is off. emsg(_(e_modifiable)); clearop(cap->oap); if (cap->cmdchar == K_PS) - /* drop the pasted text */ + // drop the pasted text bracketed_paste(PASTE_INSERT, TRUE, NULL); } else if (cap->cmdchar == K_PS && VIsual_active) @@ -6977,7 +6973,7 @@ nv_edit(cmdarg_T *cap) pos_T old_pos = curwin->w_cursor; pos_T old_visual = VIsual; - /* In Visual mode the selected text is deleted. */ + // In Visual mode the selected text is deleted. if (VIsual_mode == 'V' || curwin->w_cursor.lnum != VIsual.lnum) { shift_delete_registers(); @@ -6991,24 +6987,24 @@ nv_edit(cmdarg_T *cap) do_pending_operator(cap, 0, FALSE); cap->cmdchar = K_PS; - /* When the last char in the line was deleted then append. Detect this - * by checking if the cursor moved to before the Visual area. */ + // When the last char in the line was deleted then append. Detect this + // by checking if the cursor moved to before the Visual area. if (*ml_get_cursor() != NUL && LT_POS(curwin->w_cursor, old_pos) && LT_POS(curwin->w_cursor, old_visual)) inc_cursor(); - /* Insert to replace the deleted text with the pasted text. */ + // Insert to replace the deleted text with the pasted text. invoke_edit(cap, FALSE, cap->cmdchar, FALSE); } else if (!checkclearopq(cap->oap)) { switch (cap->cmdchar) { - case 'A': /* "A"ppend after the line */ + case 'A': // "A"ppend after the line set_cursor_for_append_to_line(); break; - case 'I': /* "I"nsert before the first non-blank */ + case 'I': // "I"nsert before the first non-blank if (vim_strchr(p_cpo, CPO_INSEND) == NULL) beginline(BL_WHITE); else @@ -7016,15 +7012,15 @@ nv_edit(cmdarg_T *cap) break; case K_PS: - /* Bracketed paste works like "a"ppend, unless the cursor is in - * the first column, then it inserts. */ + // Bracketed paste works like "a"ppend, unless the cursor is in + // the first column, then it inserts. if (curwin->w_cursor.col == 0) break; - /* FALLTHROUGH */ + // FALLTHROUGH - case 'a': /* "a"ppend is like "i"nsert on the next character. */ - /* increment coladd when in virtual space, increment the - * column otherwise, also to append after an unprintable char */ + case 'a': // "a"ppend is like "i"nsert on the next character. + // increment coladd when in virtual space, increment the + // column otherwise, also to append after an unprintable char if (virtual_active() && (curwin->w_cursor.coladd > 0 || *ml_get_cursor() == NUL @@ -7039,8 +7035,8 @@ nv_edit(cmdarg_T *cap) { int save_State = State; - /* Pretend Insert mode here to allow the cursor on the - * character past the end of the line */ + // Pretend Insert mode here to allow the cursor on the + // character past the end of the line State = INSERT; coladvance(getviscol()); State = save_State; @@ -7049,7 +7045,7 @@ nv_edit(cmdarg_T *cap) invoke_edit(cap, FALSE, cap->cmdchar, FALSE); } else if (cap->cmdchar == K_PS) - /* drop the pasted text */ + // drop the pasted text bracketed_paste(PASTE_INSERT, TRUE, NULL); } @@ -7059,21 +7055,21 @@ nv_edit(cmdarg_T *cap) static void invoke_edit( cmdarg_T *cap, - int repl, /* "r" or "gr" command */ + int repl, // "r" or "gr" command int cmd, int startln) { int restart_edit_save = 0; - /* Complicated: When the user types "a<C-O>a" we don't want to do Insert - * mode recursively. But when doing "a<C-O>." or "a<C-O>rx" we do allow - * it. */ + // Complicated: When the user types "a<C-O>a" we don't want to do Insert + // mode recursively. But when doing "a<C-O>." or "a<C-O>rx" we do allow + // it. if (repl || !stuff_empty()) restart_edit_save = restart_edit; else restart_edit_save = 0; - /* Always reset "restart_edit", this is not a restarted edit. */ + // Always reset "restart_edit", this is not a restarted edit. restart_edit = 0; if (edit(cmd, startln, cap->count1)) @@ -7096,67 +7092,66 @@ nv_object( char_u *mps_save; if (cap->cmdchar == 'i') - include = FALSE; /* "ix" = inner object: exclude white space */ + include = FALSE; // "ix" = inner object: exclude white space else - include = TRUE; /* "ax" = an object: include white space */ + include = TRUE; // "ax" = an object: include white space - /* Make sure (), [], {} and <> are in 'matchpairs' */ + // Make sure (), [], {} and <> are in 'matchpairs' mps_save = curbuf->b_p_mps; curbuf->b_p_mps = (char_u *)"(:),{:},[:],<:>"; switch (cap->nchar) { - case 'w': /* "aw" = a word */ + case 'w': // "aw" = a word flag = current_word(cap->oap, cap->count1, include, FALSE); break; - case 'W': /* "aW" = a WORD */ + case 'W': // "aW" = a WORD flag = current_word(cap->oap, cap->count1, include, TRUE); break; - case 'b': /* "ab" = a braces block */ + case 'b': // "ab" = a braces block case '(': case ')': flag = current_block(cap->oap, cap->count1, include, '(', ')'); break; - case 'B': /* "aB" = a Brackets block */ + case 'B': // "aB" = a Brackets block case '{': case '}': flag = current_block(cap->oap, cap->count1, include, '{', '}'); break; - case '[': /* "a[" = a [] block */ + case '[': // "a[" = a [] block case ']': flag = current_block(cap->oap, cap->count1, include, '[', ']'); break; - case '<': /* "a<" = a <> block */ + case '<': // "a<" = a <> block case '>': flag = current_block(cap->oap, cap->count1, include, '<', '>'); break; - case 't': /* "at" = a tag block (xml and html) */ - /* Do not adjust oap->end in do_pending_operator() - * otherwise there are different results for 'dit' - * (note leading whitespace in last line): - * 1) <b> 2) <b> - * foobar foobar - * </b> </b> - */ + case 't': // "at" = a tag block (xml and html) + // Do not adjust oap->end in do_pending_operator() + // otherwise there are different results for 'dit' + // (note leading whitespace in last line): + // 1) <b> 2) <b> + // foobar foobar + // </b> </b> cap->retval |= CA_NO_ADJ_OP_END; flag = current_tagblock(cap->oap, cap->count1, include); break; - case 'p': /* "ap" = a paragraph */ + case 'p': // "ap" = a paragraph flag = current_par(cap->oap, cap->count1, include, 'p'); break; - case 's': /* "as" = a sentence */ + case 's': // "as" = a sentence flag = current_sent(cap->oap, cap->count1, include); break; - case '"': /* "a"" = a double quoted string */ - case '\'': /* "a'" = a single quoted string */ - case '`': /* "a`" = a backtick quoted string */ + case '"': // "a"" = a double quoted string + case '\'': // "a'" = a single quoted string + case '`': // "a`" = a backtick quoted string flag = current_quote(cap->oap, cap->count1, include, cap->nchar); break; -#if 0 /* TODO */ - case 'S': /* "aS" = a section */ - case 'f': /* "af" = a filename */ - case 'u': /* "au" = a URL */ +#if 0 // TODO + case 'S': // "aS" = a section + case 'f': // "af" = a filename + case 'u': // "au" = a URL #endif default: flag = FAIL; @@ -7180,7 +7175,7 @@ nv_record(cmdarg_T *cap) { if (cap->oap->op_type == OP_FORMAT) { - /* "gqq" is the same as "gqgq": format line */ + // "gqq" is the same as "gqgq": format line cap->cmdchar = 'g'; cap->nchar = 'q'; nv_operator(cap); @@ -7195,8 +7190,8 @@ nv_record(cmdarg_T *cap) } else #endif - /* (stop) recording into a named register, unless executing a - * register */ + // (stop) recording into a named register, unless executing a + // register if (reg_executing == 0 && do_record(cap->nchar) == FAIL) clearopbeep(cap->oap); } @@ -7248,16 +7243,16 @@ nv_halfpage(cmdarg_T *cap) static void nv_join(cmdarg_T *cap) { - if (VIsual_active) /* join the visual lines */ + if (VIsual_active) // join the visual lines nv_operator(cap); else if (!checkclearop(cap->oap)) { if (cap->count0 <= 1) - cap->count0 = 2; /* default for join is two lines! */ + cap->count0 = 2; // default for join is two lines! if (curwin->w_cursor.lnum + cap->count0 - 1 > curbuf->b_ml.ml_line_count) { - /* can't join when on the last line */ + // can't join when on the last line if (cap->count0 <= 2) { clearopbeep(cap->oap); @@ -7299,7 +7294,7 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) if (cap->oap->op_type != OP_NOP) { #ifdef FEAT_DIFF - /* "dp" is ":diffput" */ + // "dp" is ":diffput" if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'p') { clearop(cap->oap); @@ -7333,11 +7328,10 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) if (VIsual_active) { - /* Putting in Visual mode: The put text replaces the selected - * text. First delete the selected text, then put the new text. - * Need to save and restore the registers that the delete - * overwrites if the old contents is being put. - */ + // Putting in Visual mode: The put text replaces the selected + // text. First delete the selected text, then put the new text. + // Need to save and restore the registers that the delete + // overwrites if the old contents is being put. was_visual = TRUE; regname = cap->oap->regname; #ifdef FEAT_CLIPBOARD @@ -7351,8 +7345,8 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) ) { - /* The delete is going to overwrite the register we want to - * put, save it first. */ + // The delete is going to overwrite the register we want to + // put, save it first. reg1 = get_register(regname, TRUE); } @@ -7366,20 +7360,20 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) empty = (curbuf->b_ml.ml_flags & ML_EMPTY); --msg_silent; - /* delete PUT_LINE_BACKWARD; */ + // delete PUT_LINE_BACKWARD; cap->oap->regname = regname; if (reg1 != NULL) { - /* Delete probably changed the register we want to put, save - * it first. Then put back what was there before the delete. */ + // Delete probably changed the register we want to put, save + // it first. Then put back what was there before the delete. reg2 = get_register(regname, FALSE); put_register(regname, reg1); } - /* When deleted a linewise Visual area, put the register as - * lines to avoid it joined with the next line. When deletion was - * characterwise, split a line when putting lines. */ + // When deleted a linewise Visual area, put the register as + // lines to avoid it joined with the next line. When deletion was + // characterwise, split a line when putting lines. if (VIsual_mode == 'V') flags |= PUT_LINE; else if (VIsual_mode == 'v') @@ -7391,38 +7385,38 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) && curwin->w_cursor.col < curbuf->b_op_start.col) || (VIsual_mode == 'V' && curwin->w_cursor.lnum < curbuf->b_op_start.lnum)) - /* cursor is at the end of the line or end of file, put - * forward. */ + // cursor is at the end of the line or end of file, put + // forward. dir = FORWARD; - /* May have been reset in do_put(). */ + // May have been reset in do_put(). VIsual_active = TRUE; } do_put(cap->oap->regname, dir, cap->count1, flags); - /* If a register was saved, put it back now. */ + // If a register was saved, put it back now. if (reg2 != NULL) put_register(regname, reg2); - /* What to reselect with "gv"? Selecting the just put text seems to - * be the most useful, since the original text was removed. */ + // What to reselect with "gv"? Selecting the just put text seems to + // be the most useful, since the original text was removed. if (was_visual) { curbuf->b_visual.vi_start = curbuf->b_op_start; curbuf->b_visual.vi_end = curbuf->b_op_end; - /* need to adjust cursor position */ + // need to adjust cursor position if (*p_sel == 'e') inc(&curbuf->b_visual.vi_end); } - /* When all lines were selected and deleted do_put() leaves an empty - * line that needs to be deleted now. */ + // When all lines were selected and deleted do_put() leaves an empty + // line that needs to be deleted now. if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL) { ml_delete(curbuf->b_ml.ml_line_count, TRUE); deleted_lines(curbuf->b_ml.ml_line_count + 1, 1); - /* If the cursor was in that line, move it to the end of the last - * line. */ + // If the cursor was in that line, move it to the end of the last + // line. if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) { curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; @@ -7440,7 +7434,7 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) nv_open(cmdarg_T *cap) { #ifdef FEAT_DIFF - /* "do" is ":diffget" */ + // "do" is ":diffget" if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o') { clearop(cap->oap); @@ -7448,7 +7442,7 @@ nv_open(cmdarg_T *cap) } else #endif - if (VIsual_active) /* switch start and end of visual */ + if (VIsual_active) // switch start and end of visual v_swap_corners(cap->cmdchar); #ifdef FEAT_JOB_CHANNEL else if (bt_prompt(curbuf)) @@ -7484,5 +7478,5 @@ nv_cursorhold(cmdarg_T *cap) { apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf); did_cursorhold = TRUE; - cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ + cap->retval |= CA_COMMAND_BUSY; // don't call edit() now } |