mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.2392: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
6e0ce171e1
This commit is contained in:
parent
df27579f54
commit
ce441b8b13
@ -414,14 +414,14 @@ static int find_command(int cmdchar)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We use the absolute value of the character. Special keys have a
|
// We use the absolute value of the character. Special keys have a
|
||||||
* negative value, but are sorted on their absolute value. */
|
// negative value, but are sorted on their absolute value.
|
||||||
if (cmdchar < 0) {
|
if (cmdchar < 0) {
|
||||||
cmdchar = -cmdchar;
|
cmdchar = -cmdchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the character is in the first part: The character is the index into
|
// If the character is in the first part: The character is the index into
|
||||||
* nv_cmd_idx[]. */
|
// nv_cmd_idx[].
|
||||||
assert(nv_max_linear < (int)NV_CMDS_SIZE);
|
assert(nv_max_linear < (int)NV_CMDS_SIZE);
|
||||||
if (cmdchar <= nv_max_linear) {
|
if (cmdchar <= nv_max_linear) {
|
||||||
return nv_cmd_idx[cmdchar];
|
return nv_cmd_idx[cmdchar];
|
||||||
@ -3897,8 +3897,8 @@ bool find_decl(char_u *ptr, size_t len, bool locally, bool thisblock, int flags_
|
|||||||
|
|
||||||
pat = xmalloc(len + 7);
|
pat = xmalloc(len + 7);
|
||||||
|
|
||||||
/* Put "\V" before the pattern to avoid that the special meaning of "."
|
// Put "\V" before the pattern to avoid that the special meaning of "."
|
||||||
* and "~" causes trouble. */
|
// and "~" causes trouble.
|
||||||
assert(len <= INT_MAX);
|
assert(len <= INT_MAX);
|
||||||
sprintf((char *)pat, vim_iswordp(ptr) ? "\\V\\<%.*s\\>" : "\\V%.*s",
|
sprintf((char *)pat, vim_iswordp(ptr) ? "\\V\\<%.*s\\>" : "\\V%.*s",
|
||||||
(int)len, ptr);
|
(int)len, ptr);
|
||||||
@ -4252,9 +4252,9 @@ void scroll_redraw(int up, long count)
|
|||||||
check_cursor_moved(curwin);
|
check_cursor_moved(curwin);
|
||||||
curwin->w_valid |= VALID_TOPLINE;
|
curwin->w_valid |= VALID_TOPLINE;
|
||||||
|
|
||||||
/* If moved back to where we were, at least move the cursor, otherwise
|
// 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
|
// we get stuck at one position. Don't move the cursor up if the
|
||||||
* first line of the buffer is already on the screen */
|
// first line of the buffer is already on the screen
|
||||||
while (curwin->w_topline == prev_topline
|
while (curwin->w_topline == prev_topline
|
||||||
&& curwin->w_topfill == prev_topfill) {
|
&& curwin->w_topfill == prev_topfill) {
|
||||||
if (up) {
|
if (up) {
|
||||||
@ -4338,7 +4338,7 @@ static void nv_zet(cmdarg_T *cap)
|
|||||||
dozet:
|
dozet:
|
||||||
// "zf" and "zF" are always an operator, "zd", "zo", "zO", "zc"
|
// "zf" and "zF" are always an operator, "zd", "zo", "zO", "zc"
|
||||||
// and "zC" only in Visual mode. "zj" and "zk" are motion
|
// and "zC" only in Visual mode. "zj" and "zk" are motion
|
||||||
// commands. */
|
// commands.
|
||||||
if (cap->nchar != 'f' && cap->nchar != 'F'
|
if (cap->nchar != 'f' && cap->nchar != 'F'
|
||||||
&& !(VIsual_active && vim_strchr((char_u *)"dcCoO", cap->nchar))
|
&& !(VIsual_active && vim_strchr((char_u *)"dcCoO", cap->nchar))
|
||||||
&& cap->nchar != 'j' && cap->nchar != 'k'
|
&& cap->nchar != 'j' && cap->nchar != 'k'
|
||||||
@ -5003,9 +5003,9 @@ static void nv_ident(cmdarg_T *cap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate buffer to put the command in. Inserting backslashes can
|
// 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
|
// double the length of the word. p_kp / curbuf->b_p_kp could be added
|
||||||
* and some numbers. */
|
// and some numbers.
|
||||||
char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp; // 'keywordprg'
|
char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp; // 'keywordprg'
|
||||||
assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty.
|
assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty.
|
||||||
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
|
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
|
||||||
@ -5046,8 +5046,8 @@ static void nv_ident(cmdarg_T *cap)
|
|||||||
STRCAT(buf, kp);
|
STRCAT(buf, kp);
|
||||||
STRCAT(buf, " ");
|
STRCAT(buf, " ");
|
||||||
} else {
|
} else {
|
||||||
/* An external command will probably use an argument starting
|
// An external command will probably use an argument starting
|
||||||
* with "-" as an option. To avoid trouble we skip the "-". */
|
// with "-" as an option. To avoid trouble we skip the "-".
|
||||||
while (*ptr == '-' && n > 0) {
|
while (*ptr == '-' && n > 0) {
|
||||||
++ptr;
|
++ptr;
|
||||||
--n;
|
--n;
|
||||||
@ -5058,8 +5058,8 @@ static void nv_ident(cmdarg_T *cap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When a count is given, turn it into a range. Is this
|
// When a count is given, turn it into a range. Is this
|
||||||
* really what we want? */
|
// really what we want?
|
||||||
bool isman = (STRCMP(kp, "man") == 0);
|
bool isman = (STRCMP(kp, "man") == 0);
|
||||||
bool isman_s = (STRCMP(kp, "man -s") == 0);
|
bool isman_s = (STRCMP(kp, "man -s") == 0);
|
||||||
if (cap->count0 != 0 && !(isman || isman_s)) {
|
if (cap->count0 != 0 && !(isman || isman_s)) {
|
||||||
@ -5141,8 +5141,8 @@ static void nv_ident(cmdarg_T *cap)
|
|||||||
if (vim_strchr(aux_ptr, *ptr) != NULL) {
|
if (vim_strchr(aux_ptr, *ptr) != NULL) {
|
||||||
*p++ = '\\';
|
*p++ = '\\';
|
||||||
}
|
}
|
||||||
/* When current byte is a part of multibyte character, copy all
|
// When current byte is a part of multibyte character, copy all
|
||||||
* bytes of that character. */
|
// bytes of that character.
|
||||||
const size_t len = (size_t)(utfc_ptr2len(ptr) - 1);
|
const size_t len = (size_t)(utfc_ptr2len(ptr) - 1);
|
||||||
for (size_t i = 0; i < len && n > 0; i++, n--) {
|
for (size_t i = 0; i < len && n > 0; i++, n--) {
|
||||||
*p++ = *ptr++;
|
*p++ = *ptr++;
|
||||||
@ -5415,10 +5415,9 @@ static void nv_left(cmdarg_T *cap)
|
|||||||
cap->oap->inclusive = false;
|
cap->oap->inclusive = false;
|
||||||
for (n = cap->count1; n > 0; --n) {
|
for (n = cap->count1; n > 0; --n) {
|
||||||
if (oneleft() == false) {
|
if (oneleft() == false) {
|
||||||
/* <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'.
|
// <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'.
|
||||||
* 'h' wraps to previous line if 'whichwrap' has 'h'.
|
// 'h' wraps to previous line if 'whichwrap' has 'h'.
|
||||||
* CURS_LEFT wraps to previous line if 'whichwrap' has '<'.
|
// CURS_LEFT wraps to previous line if 'whichwrap' has '<'.
|
||||||
*/
|
|
||||||
if ((((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H)
|
if ((((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H)
|
||||||
&& vim_strchr(p_ww, 'b') != NULL)
|
&& vim_strchr(p_ww, 'b') != NULL)
|
||||||
|| (cap->cmdchar == 'h' && vim_strchr(p_ww, 'h') != NULL)
|
|| (cap->cmdchar == 'h' && vim_strchr(p_ww, 'h') != NULL)
|
||||||
@ -5570,9 +5569,9 @@ static void nv_dollar(cmdarg_T *cap)
|
|||||||
{
|
{
|
||||||
cap->oap->motion_type = kMTCharWise;
|
cap->oap->motion_type = kMTCharWise;
|
||||||
cap->oap->inclusive = true;
|
cap->oap->inclusive = true;
|
||||||
/* In virtual mode when off the edge of a line and an operator
|
// In virtual mode when off the edge of a line and an operator
|
||||||
* is pending (whew!) keep the cursor where it is.
|
// is pending (whew!) keep the cursor where it is.
|
||||||
* Otherwise, send it to the end of the line. */
|
// Otherwise, send it to the end of the line.
|
||||||
if (!virtual_active() || gchar_cursor() != NUL
|
if (!virtual_active() || gchar_cursor() != NUL
|
||||||
|| cap->oap->op_type == OP_NOP) {
|
|| 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
|
||||||
@ -6278,9 +6277,9 @@ static void nv_replace(cmdarg_T *cap)
|
|||||||
ins_char(cap->ncharC2);
|
ins_char(cap->ncharC2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--curwin->w_cursor.col; // cursor on the last replaced char
|
curwin->w_cursor.col--; // cursor on the last replaced char
|
||||||
/* if the character on the left of the current cursor is a multi-byte
|
// if the character on the left of the current cursor is a multi-byte
|
||||||
* character, move two characters left */
|
// character, move two characters left
|
||||||
mb_adjust_cursor();
|
mb_adjust_cursor();
|
||||||
curbuf->b_op_end = curwin->w_cursor;
|
curbuf->b_op_end = curwin->w_cursor;
|
||||||
curwin->w_set_curswant = true;
|
curwin->w_set_curswant = true;
|
||||||
@ -6802,8 +6801,8 @@ static void n_start_visual_mode(int c)
|
|||||||
if (p_smd && msg_silent == 0) {
|
if (p_smd && msg_silent == 0) {
|
||||||
redraw_cmdline = true; // show visual mode later
|
redraw_cmdline = true; // show visual mode later
|
||||||
}
|
}
|
||||||
/* Only need to redraw this line, unless still need to redraw an old
|
// Only need to redraw this line, unless still need to redraw an old
|
||||||
* Visual area (when 'lazyredraw' is set). */
|
// Visual area (when 'lazyredraw' is set).
|
||||||
if (curwin->w_redr_type < INVERTED) {
|
if (curwin->w_redr_type < INVERTED) {
|
||||||
curwin->w_old_cursor_lnum = curwin->w_cursor.lnum;
|
curwin->w_old_cursor_lnum = curwin->w_cursor.lnum;
|
||||||
curwin->w_old_visual_lnum = curwin->w_cursor.lnum;
|
curwin->w_old_visual_lnum = curwin->w_cursor.lnum;
|
||||||
@ -7571,8 +7570,8 @@ static void nv_home(cmdarg_T *cap)
|
|||||||
cap->count0 = 1;
|
cap->count0 = 1;
|
||||||
nv_pipe(cap);
|
nv_pipe(cap);
|
||||||
}
|
}
|
||||||
ins_at_eol = false; /* Don't move cursor past eol (only necessary in a
|
ins_at_eol = false; // Don't move cursor past eol (only necessary in a
|
||||||
one-character line). */
|
// one-character line).
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -7589,8 +7588,8 @@ static void nv_pipe(cmdarg_T *cap)
|
|||||||
} else {
|
} else {
|
||||||
curwin->w_curswant = 0;
|
curwin->w_curswant = 0;
|
||||||
}
|
}
|
||||||
/* keep curswant at the column where we wanted to go, not where
|
// keep curswant at the column where we wanted to go, not where
|
||||||
* we ended; differs if line is too short */
|
// we ended; differs if line is too short
|
||||||
curwin->w_set_curswant = false;
|
curwin->w_set_curswant = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7661,8 +7660,8 @@ static void nv_wordcmd(cmdarg_T *cap)
|
|||||||
n = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP);
|
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
|
// Don't leave the cursor on the NUL past the end of line. Unless we
|
||||||
* didn't move it forward. */
|
// didn't move it forward.
|
||||||
if (lt(startpos, curwin->w_cursor)) {
|
if (lt(startpos, curwin->w_cursor)) {
|
||||||
adjust_cursor(cap->oap);
|
adjust_cursor(cap->oap);
|
||||||
}
|
}
|
||||||
@ -7711,8 +7710,8 @@ static void nv_beginline(cmdarg_T *cap)
|
|||||||
if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP) {
|
if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP) {
|
||||||
foldOpenCursor();
|
foldOpenCursor();
|
||||||
}
|
}
|
||||||
ins_at_eol = false; /* Don't move cursor past eol (only necessary in a
|
ins_at_eol = false; // Don't move cursor past eol (only necessary in a
|
||||||
one-character line). */
|
// one-character line).
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -7857,8 +7856,8 @@ static void nv_esc(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't reset "restart_edit" when 'insertmode' is set, it won't be
|
// Don't reset "restart_edit" when 'insertmode' is set, it won't be
|
||||||
* set again below when halfway through a mapping. */
|
// set again below when halfway through a mapping.
|
||||||
if (!p_im) {
|
if (!p_im) {
|
||||||
restart_edit = 0;
|
restart_edit = 0;
|
||||||
}
|
}
|
||||||
@ -7885,8 +7884,8 @@ static void nv_esc(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
clearop(cap->oap);
|
clearop(cap->oap);
|
||||||
|
|
||||||
/* A CTRL-C is often used at the start of a menu. When 'insertmode' is
|
// A CTRL-C is often used at the start of a menu. When 'insertmode' is
|
||||||
* set return to Insert mode afterwards. */
|
// set return to Insert mode afterwards.
|
||||||
if (restart_edit == 0 && goto_im()
|
if (restart_edit == 0 && goto_im()
|
||||||
&& ex_normal_busy == 0) {
|
&& ex_normal_busy == 0) {
|
||||||
restart_edit = 'a';
|
restart_edit = 'a';
|
||||||
@ -7940,8 +7939,8 @@ static void nv_edit(cmdarg_T *cap)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a': // "a"ppend is like "i"nsert on the next character.
|
case 'a': // "a"ppend is like "i"nsert on the next character.
|
||||||
/* increment coladd when in virtual space, increment the
|
// increment coladd when in virtual space, increment the
|
||||||
* column otherwise, also to append after an unprintable char */
|
// column otherwise, also to append after an unprintable char
|
||||||
if (virtual_active()
|
if (virtual_active()
|
||||||
&& (curwin->w_cursor.coladd > 0
|
&& (curwin->w_cursor.coladd > 0
|
||||||
|| *get_cursor_pos_ptr() == NUL
|
|| *get_cursor_pos_ptr() == NUL
|
||||||
@ -8209,11 +8208,10 @@ static void nv_put_opt(cmdarg_T *cap, bool fix_indent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (VIsual_active) {
|
if (VIsual_active) {
|
||||||
/* Putting in Visual mode: The put text replaces the selected
|
// Putting in Visual mode: The put text replaces the selected
|
||||||
* text. First delete the selected text, then put the new text.
|
// text. First delete the selected text, then put the new text.
|
||||||
* Need to save and restore the registers that the delete
|
// Need to save and restore the registers that the delete
|
||||||
* overwrites if the old contents is being put.
|
// overwrites if the old contents is being put.
|
||||||
*/
|
|
||||||
was_visual = true;
|
was_visual = true;
|
||||||
regname = cap->oap->regname;
|
regname = cap->oap->regname;
|
||||||
// '+' and '*' could be the same selection
|
// '+' and '*' could be the same selection
|
||||||
@ -8286,14 +8284,14 @@ static void nv_put_opt(cmdarg_T *cap, bool fix_indent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When all lines were selected and deleted do_put() leaves an empty
|
// When all lines were selected and deleted do_put() leaves an empty
|
||||||
* line that needs to be deleted now. */
|
// line that needs to be deleted now.
|
||||||
if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL) {
|
if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL) {
|
||||||
ml_delete(curbuf->b_ml.ml_line_count, true);
|
ml_delete(curbuf->b_ml.ml_line_count, true);
|
||||||
deleted_lines(curbuf->b_ml.ml_line_count + 1, 1);
|
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
|
// If the cursor was in that line, move it to the end of the last
|
||||||
* line. */
|
// line.
|
||||||
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
|
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
|
||||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||||
coladvance(MAXCOL);
|
coladvance(MAXCOL);
|
||||||
|
@ -391,8 +391,8 @@ static void shift_block(oparg_T *oap, int amount)
|
|||||||
total += incr;
|
total += incr;
|
||||||
bd.start_vcol += incr;
|
bd.start_vcol += incr;
|
||||||
}
|
}
|
||||||
/* OK, now total=all the VWS reqd, and textstart points at the 1st
|
// OK, now total=all the VWS reqd, and textstart points at the 1st
|
||||||
* non-ws char in the block. */
|
// non-ws char in the block.
|
||||||
if (!curbuf->b_p_et) {
|
if (!curbuf->b_p_et) {
|
||||||
tabstop_fromto(ws_vcol, ws_vcol + total, p_ts, p_vts, &i, &j);
|
tabstop_fromto(ws_vcol, ws_vcol + total, p_ts, p_vts, &i, &j);
|
||||||
} else {
|
} else {
|
||||||
@ -459,14 +459,14 @@ static void shift_block(oparg_T *oap, int amount)
|
|||||||
// The column to which we will shift the text.
|
// The column to which we will shift the text.
|
||||||
destination_col = non_white_col - shift_amount;
|
destination_col = non_white_col - shift_amount;
|
||||||
|
|
||||||
/* Now let's find out how much of the beginning of the line we can
|
// Now let's find out how much of the beginning of the line we can
|
||||||
* reuse without modification. */
|
// reuse without modification.
|
||||||
verbatim_copy_end = bd.textstart;
|
verbatim_copy_end = bd.textstart;
|
||||||
verbatim_copy_width = bd.start_vcol;
|
verbatim_copy_width = bd.start_vcol;
|
||||||
|
|
||||||
/* If "bd.startspaces" is set, "bd.textstart" points to the character
|
// If "bd.startspaces" is set, "bd.textstart" points to the character
|
||||||
* preceding the block. We have to subtract its width to obtain its
|
// preceding the block. We have to subtract its width to obtain its
|
||||||
* column number. */
|
// column number.
|
||||||
if (bd.startspaces) {
|
if (bd.startspaces) {
|
||||||
verbatim_copy_width -= bd.start_char_vcols;
|
verbatim_copy_width -= bd.start_char_vcols;
|
||||||
}
|
}
|
||||||
@ -482,9 +482,9 @@ static void shift_block(oparg_T *oap, int amount)
|
|||||||
MB_PTR_ADV(verbatim_copy_end);
|
MB_PTR_ADV(verbatim_copy_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If "destination_col" is different from the width of the initial
|
// If "destination_col" is different from the width of the initial
|
||||||
* part of the line that will be copied, it means we encountered a tab
|
// part of the line that will be copied, it means we encountered a tab
|
||||||
* character, which we will have to partly replace with spaces. */
|
// character, which we will have to partly replace with spaces.
|
||||||
assert(destination_col - verbatim_copy_width >= 0);
|
assert(destination_col - verbatim_copy_width >= 0);
|
||||||
fill = (size_t)(destination_col - verbatim_copy_width);
|
fill = (size_t)(destination_col - verbatim_copy_width);
|
||||||
|
|
||||||
@ -1500,8 +1500,8 @@ int op_delete(oparg_T *oap)
|
|||||||
did_yank = true;
|
did_yank = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Yank into small delete register when no named register specified
|
// Yank into small delete register when no named register specified
|
||||||
* and the delete is within one line. */
|
// and the delete is within one line.
|
||||||
if (oap->regname == 0 && oap->motion_type != kMTLineWise
|
if (oap->regname == 0 && oap->motion_type != kMTLineWise
|
||||||
&& oap->line_count == 1) {
|
&& oap->line_count == 1) {
|
||||||
reg = get_yank_register('-', YREG_YANK);
|
reg = get_yank_register('-', YREG_YANK);
|
||||||
@ -1659,9 +1659,8 @@ int op_delete(oparg_T *oap)
|
|||||||
n = oap->end.col - oap->start.col + 1 - !oap->inclusive;
|
n = oap->end.col - oap->start.col + 1 - !oap->inclusive;
|
||||||
|
|
||||||
if (virtual_op) {
|
if (virtual_op) {
|
||||||
/* fix up things for virtualedit-delete:
|
// fix up things for virtualedit-delete:
|
||||||
* break the tabs which are going to get in our way
|
// break the tabs which are going to get in our way
|
||||||
*/
|
|
||||||
char_u *curline = get_cursor_line_ptr();
|
char_u *curline = get_cursor_line_ptr();
|
||||||
int len = (int)STRLEN(curline);
|
int len = (int)STRLEN(curline);
|
||||||
|
|
||||||
@ -1818,12 +1817,11 @@ int op_replace(oparg_T *oap, int c)
|
|||||||
continue; // nothing to replace
|
continue; // nothing to replace
|
||||||
}
|
}
|
||||||
|
|
||||||
/* n == number of extra chars required
|
// n == number of extra chars required
|
||||||
* If we split a TAB, it may be replaced by several characters.
|
// If we split a TAB, it may be replaced by several characters.
|
||||||
* Thus the number of characters may increase!
|
// Thus the number of characters may increase!
|
||||||
*/
|
// If the range starts in virtual space, count the initial
|
||||||
/* If the range starts in virtual space, count the initial
|
// coladd offset as part of "startspaces"
|
||||||
* coladd offset as part of "startspaces" */
|
|
||||||
if (virtual_op && bd.is_short && *bd.textstart == NUL) {
|
if (virtual_op && bd.is_short && *bd.textstart == NUL) {
|
||||||
pos_T vpos;
|
pos_T vpos;
|
||||||
|
|
||||||
@ -2255,15 +2253,15 @@ void op_insert(oparg_T *oap, long count1)
|
|||||||
|
|
||||||
// When a tab was inserted, and the characters in front of the tab
|
// When a tab was inserted, and the characters in front of the tab
|
||||||
// have been converted to a tab as well, the column of the cursor
|
// have been converted to a tab as well, the column of the cursor
|
||||||
// might have actually been reduced, so need to adjust here. */
|
// might have actually been reduced, so need to adjust here.
|
||||||
if (t1.lnum == curbuf->b_op_start_orig.lnum
|
if (t1.lnum == curbuf->b_op_start_orig.lnum
|
||||||
&& lt(curbuf->b_op_start_orig, t1)) {
|
&& lt(curbuf->b_op_start_orig, t1)) {
|
||||||
oap->start = curbuf->b_op_start_orig;
|
oap->start = curbuf->b_op_start_orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If user has moved off this line, we don't know what to do, so do
|
// If user has moved off this line, we don't know what to do, so do
|
||||||
* nothing.
|
// nothing.
|
||||||
* Also don't repeat the insert when Insert mode ended with CTRL-C. */
|
// Also don't repeat the insert when Insert mode ended with CTRL-C.
|
||||||
if (curwin->w_cursor.lnum != oap->start.lnum || got_int) {
|
if (curwin->w_cursor.lnum != oap->start.lnum || got_int) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2440,8 +2438,8 @@ int op_change(oparg_T *oap)
|
|||||||
|
|
||||||
ins_len = (long)STRLEN(firstline) - pre_textlen;
|
ins_len = (long)STRLEN(firstline) - pre_textlen;
|
||||||
if (ins_len > 0) {
|
if (ins_len > 0) {
|
||||||
/* Subsequent calls to ml_get() flush the firstline data - take a
|
// Subsequent calls to ml_get() flush the firstline data - take a
|
||||||
* copy of the inserted text. */
|
// copy of the inserted text.
|
||||||
ins_text = (char_u *)xmalloc((size_t)(ins_len + 1));
|
ins_text = (char_u *)xmalloc((size_t)(ins_len + 1));
|
||||||
STRLCPY(ins_text, firstline + bd.textcol, ins_len + 1);
|
STRLCPY(ins_text, firstline + bd.textcol, ins_len + 1);
|
||||||
for (linenr = oap->start.lnum + 1; linenr <= oap->end.lnum;
|
for (linenr = oap->start.lnum + 1; linenr <= oap->end.lnum;
|
||||||
@ -2450,8 +2448,8 @@ int op_change(oparg_T *oap)
|
|||||||
if (!bd.is_short || virtual_op) {
|
if (!bd.is_short || virtual_op) {
|
||||||
pos_T vpos;
|
pos_T vpos;
|
||||||
|
|
||||||
/* If the block starts in virtual space, count the
|
// If the block starts in virtual space, count the
|
||||||
* initial coladd offset as part of "startspaces" */
|
// initial coladd offset as part of "startspaces"
|
||||||
if (bd.is_short) {
|
if (bd.is_short) {
|
||||||
vpos.lnum = linenr;
|
vpos.lnum = linenr;
|
||||||
(void)getvpos(&vpos, oap->start_vcol);
|
(void)getvpos(&vpos, oap->start_vcol);
|
||||||
@ -3834,9 +3832,8 @@ char_u *skip_comment(char_u *line, bool process, bool include_space, bool *is_co
|
|||||||
|
|
||||||
*is_comment = false;
|
*is_comment = false;
|
||||||
if (leader_offset != -1) {
|
if (leader_offset != -1) {
|
||||||
/* Let's check whether the line ends with an unclosed comment.
|
// Let's check whether the line ends with an unclosed comment.
|
||||||
* If the last comment leader has COM_END in flags, there's no comment.
|
// If the last comment leader has COM_END in flags, there's no comment.
|
||||||
*/
|
|
||||||
while (*comment_flags) {
|
while (*comment_flags) {
|
||||||
if (*comment_flags == COM_END
|
if (*comment_flags == COM_END
|
||||||
|| *comment_flags == ':') {
|
|| *comment_flags == ':') {
|
||||||
@ -3859,11 +3856,10 @@ char_u *skip_comment(char_u *line, bool process, bool include_space, bool *is_co
|
|||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find:
|
// Find:
|
||||||
* - COM_END,
|
// - COM_END,
|
||||||
* - colon,
|
// - colon,
|
||||||
* whichever comes first.
|
// whichever comes first.
|
||||||
*/
|
|
||||||
while (*comment_flags) {
|
while (*comment_flags) {
|
||||||
if (*comment_flags == COM_END
|
if (*comment_flags == COM_END
|
||||||
|| *comment_flags == ':') {
|
|| *comment_flags == ':') {
|
||||||
@ -4655,8 +4651,8 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, bool
|
|||||||
bdp->endspaces = oap->end_vcol - oap->start_vcol + 1;
|
bdp->endspaces = oap->end_vcol - oap->start_vcol + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* notice: this converts partly selected Multibyte characters to
|
// notice: this converts partly selected Multibyte characters to
|
||||||
* spaces, too. */
|
// spaces, too.
|
||||||
bdp->startspaces = bdp->start_vcol - oap->start_vcol;
|
bdp->startspaces = bdp->start_vcol - oap->start_vcol;
|
||||||
if (is_del && bdp->startspaces) {
|
if (is_del && bdp->startspaces) {
|
||||||
bdp->startspaces = bdp->start_char_vcols - bdp->startspaces;
|
bdp->startspaces = bdp->start_char_vcols - bdp->startspaces;
|
||||||
|
@ -568,12 +568,11 @@ void set_init_1(bool clean_arg)
|
|||||||
|
|
||||||
save_file_ff(curbuf); // Buffer is unchanged
|
save_file_ff(curbuf); // Buffer is unchanged
|
||||||
|
|
||||||
/* Detect use of mlterm.
|
// Detect use of mlterm.
|
||||||
* Mlterm is a terminal emulator akin to xterm that has some special
|
// Mlterm is a terminal emulator akin to xterm that has some special
|
||||||
* abilities (bidi namely).
|
// abilities (bidi namely).
|
||||||
* NOTE: mlterm's author is being asked to 'set' a variable
|
// NOTE: mlterm's author is being asked to 'set' a variable
|
||||||
* instead of an environment variable due to inheritance.
|
// instead of an environment variable due to inheritance.
|
||||||
*/
|
|
||||||
if (os_env_exists("MLTERM")) {
|
if (os_env_exists("MLTERM")) {
|
||||||
set_option_value("tbidi", 1L, NULL, 0);
|
set_option_value("tbidi", 1L, NULL, 0);
|
||||||
}
|
}
|
||||||
@ -1308,16 +1307,16 @@ int do_set(char_u *arg, int opt_flags)
|
|||||||
int comma;
|
int comma;
|
||||||
bool new_value_alloced = false; // new string option was allocated
|
bool new_value_alloced = false; // new string option was allocated
|
||||||
|
|
||||||
/* When using ":set opt=val" for a global option
|
// When using ":set opt=val" for a global option
|
||||||
* with a local value the local value will be
|
// with a local value the local value will be
|
||||||
* reset, use the global value here. */
|
// reset, use the global value here.
|
||||||
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
||||||
&& ((int)options[opt_idx].indir & PV_BOTH)) {
|
&& ((int)options[opt_idx].indir & PV_BOTH)) {
|
||||||
varp = options[opt_idx].var;
|
varp = options[opt_idx].var;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The old value is kept until we are sure that the
|
// The old value is kept until we are sure that the
|
||||||
* new value is valid. */
|
// new value is valid.
|
||||||
oldval = *(char_u **)varp;
|
oldval = *(char_u **)varp;
|
||||||
|
|
||||||
// When setting the local value of a global
|
// When setting the local value of a global
|
||||||
@ -1493,8 +1492,8 @@ int do_set(char_u *arg, int opt_flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* locate newval[] in origval[] when removing it
|
// locate newval[] in origval[] when removing it
|
||||||
* and when adding to avoid duplicates */
|
// and when adding to avoid duplicates
|
||||||
i = 0; // init for GCC
|
i = 0; // init for GCC
|
||||||
if (removing || (flags & P_NODUP)) {
|
if (removing || (flags & P_NODUP)) {
|
||||||
i = (int)STRLEN(newval);
|
i = (int)STRLEN(newval);
|
||||||
@ -1724,9 +1723,9 @@ static void did_set_option(int opt_idx, int opt_flags, int new_value, int value_
|
|||||||
{
|
{
|
||||||
options[opt_idx].flags |= P_WAS_SET;
|
options[opt_idx].flags |= P_WAS_SET;
|
||||||
|
|
||||||
/* When an option is set in the sandbox, from a modeline or in secure mode
|
// When an option is set in the sandbox, from a modeline or in secure mode
|
||||||
* set the P_INSECURE flag. Otherwise, if a new value is stored reset the
|
// set the P_INSECURE flag. Otherwise, if a new value is stored reset the
|
||||||
* flag. */
|
// flag.
|
||||||
uint32_t *p = insecure_flag(curwin, opt_idx, opt_flags);
|
uint32_t *p = insecure_flag(curwin, opt_idx, opt_flags);
|
||||||
if (!value_checked && (secure
|
if (!value_checked && (secure
|
||||||
|| sandbox != 0
|
|| sandbox != 0
|
||||||
@ -5259,8 +5258,8 @@ int makeset(FILE *fd, int opt_flags, int local_only)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Round 1: fresh value for window-local options.
|
// Round 1: fresh value for window-local options.
|
||||||
* Round 2: other values */
|
// Round 2: other values
|
||||||
for (; round <= 2; varp = varp_local, round++) {
|
for (; round <= 2; varp = varp_local, round++) {
|
||||||
if (round == 1 || (opt_flags & OPT_GLOBAL)) {
|
if (round == 1 || (opt_flags & OPT_GLOBAL)) {
|
||||||
cmd = "set";
|
cmd = "set";
|
||||||
@ -6229,13 +6228,13 @@ void buf_copy_options(buf_T *buf, int flags)
|
|||||||
buf->b_p_sua = vim_strsave(p_sua);
|
buf->b_p_sua = vim_strsave(p_sua);
|
||||||
buf->b_p_keymap = vim_strsave(p_keymap);
|
buf->b_p_keymap = vim_strsave(p_keymap);
|
||||||
buf->b_kmap_state |= KEYMAP_INIT;
|
buf->b_kmap_state |= KEYMAP_INIT;
|
||||||
/* This isn't really an option, but copying the langmap and IME
|
// This isn't really an option, but copying the langmap and IME
|
||||||
* state from the current buffer is better than resetting it. */
|
// state from the current buffer is better than resetting it.
|
||||||
buf->b_p_iminsert = p_iminsert;
|
buf->b_p_iminsert = p_iminsert;
|
||||||
buf->b_p_imsearch = p_imsearch;
|
buf->b_p_imsearch = p_imsearch;
|
||||||
|
|
||||||
/* options that are normally global but also have a local value
|
// options that are normally global but also have a local value
|
||||||
* are not copied, start using the global value */
|
// are not copied, start using the global value
|
||||||
buf->b_p_ar = -1;
|
buf->b_p_ar = -1;
|
||||||
buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
|
buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
|
||||||
buf->b_p_bkc = empty_option;
|
buf->b_p_bkc = empty_option;
|
||||||
@ -6486,8 +6485,8 @@ void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For an option that is a list of file names, find the start of the
|
// For an option that is a list of file names, find the start of the
|
||||||
* last file name. */
|
// last file name.
|
||||||
for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; p--) {
|
for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; p--) {
|
||||||
// count number of backslashes before ' ' or ','
|
// count number of backslashes before ' ' or ','
|
||||||
if (*p == ' ' || *p == ',') {
|
if (*p == ' ' || *p == ',') {
|
||||||
@ -6521,10 +6520,9 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
|
|||||||
static char *(names[]) = { "all" };
|
static char *(names[]) = { "all" };
|
||||||
int ic = regmatch->rm_ic; // remember the ignore-case flag
|
int ic = regmatch->rm_ic; // remember the ignore-case flag
|
||||||
|
|
||||||
/* do this loop twice:
|
// do this loop twice:
|
||||||
* loop == 0: count the number of matching options
|
// loop == 0: count the number of matching options
|
||||||
* loop == 1: copy the matching options into allocated memory
|
// loop == 1: copy the matching options into allocated memory
|
||||||
*/
|
|
||||||
for (loop = 0; loop <= 1; loop++) {
|
for (loop = 0; loop <= 1; loop++) {
|
||||||
regmatch->rm_ic = ic;
|
regmatch->rm_ic = ic;
|
||||||
if (xp->xp_context != EXPAND_BOOL_SETTINGS) {
|
if (xp->xp_context != EXPAND_BOOL_SETTINGS) {
|
||||||
|
Loading…
Reference in New Issue
Block a user