vim-patch:8.2.0026: still some /* */ comments (#16088)

Problem:    Still some /* */ comments.
Solution:   Convert to // comments.
85a2002adb
This commit is contained in:
dundargoc
2021-10-23 19:56:43 +02:00
committed by GitHub
parent bb9e6a1583
commit 4a0acd6fac
3 changed files with 95 additions and 96 deletions

View File

@@ -299,8 +299,8 @@ bool msg_attr_keep(char_u *s, int attr, bool keep, bool multiline)
} }
++entered; ++entered;
/* Add message to history (unless it's a repeated kept message or a // Add message to history (unless it's a repeated kept message or a
* truncated message) */ // truncated message)
if (s != keep_msg if (s != keep_msg
|| (*s != '<' || (*s != '<'
&& last_msg_hist != NULL && last_msg_hist != NULL
@@ -1089,8 +1089,8 @@ void wait_return(int redraw)
redraw_all_later(NOT_VALID); redraw_all_later(NOT_VALID);
} }
/* If using ":silent cmd", don't wait for a return. Also don't set // If using ":silent cmd", don't wait for a return. Also don't set
* need_wait_return to do it later. */ // need_wait_return to do it later.
if (msg_silent != 0) { if (msg_silent != 0) {
return; return;
} }
@@ -1140,8 +1140,8 @@ void wait_return(int redraw)
hit_return_msg(); hit_return_msg();
do { do {
/* Remember "got_int", if it is set vgetc() probably returns a // Remember "got_int", if it is set vgetc() probably returns a
* CTRL-C, but we need to loop then. */ // CTRL-C, but we need to loop then.
had_got_int = got_int; had_got_int = got_int;
// Don't do mappings here, we put the character back in the // Don't do mappings here, we put the character back in the
@@ -1213,8 +1213,8 @@ void wait_return(int redraw)
|| c == K_X1MOUSE || c == K_X2MOUSE) { || c == K_X1MOUSE || c == K_X2MOUSE) {
(void)jump_to_mouse(MOUSE_SETPOS, NULL, 0); (void)jump_to_mouse(MOUSE_SETPOS, NULL, 0);
} else if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C) { } else if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C) {
/* Put the character back in the typeahead buffer. Don't use the // Put the character back in the typeahead buffer. Don't use the
* stuff buffer, because lmaps wouldn't work. */ // stuff buffer, because lmaps wouldn't work.
ins_char_typebuf(c); ins_char_typebuf(c);
do_redraw = true; // need a redraw even though there is do_redraw = true; // need a redraw even though there is
// typeahead // typeahead
@@ -1824,8 +1824,8 @@ void msg_prt_line(char_u *s, int list)
c_extra = NUL; c_extra = NUL;
c_final = NUL; c_final = NUL;
c = *p_extra++; c = *p_extra++;
/* Use special coloring to be able to distinguish <hex> from // Use special coloring to be able to distinguish <hex> from
* the same in plain text. */ // the same in plain text.
attr = HL_ATTR(HLF_0); attr = HL_ATTR(HLF_0);
} else if (c == ' ') { } else if (c == ' ') {
if (lead != NULL && s <= lead) { if (lead != NULL && s <= lead) {
@@ -2155,8 +2155,8 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr, int recurs
} }
} }
/* When we displayed a char in last column need to check if there // When we displayed a char in last column need to check if there
* is still more. */ // is still more.
if (did_last_char) { if (did_last_char) {
continue; continue;
} }
@@ -2506,8 +2506,8 @@ void show_sb_text(void)
{ {
msgchunk_T *mp; msgchunk_T *mp;
/* Only show something if there is more than one line, otherwise it looks // Only show something if there is more than one line, otherwise it looks
* weird, typing a command without output results in one line. */ // weird, typing a command without output results in one line.
mp = msg_sb_start(last_msgchunk); mp = msg_sb_start(last_msgchunk);
if (mp == NULL || mp->sb_prev == NULL) { if (mp == NULL || mp->sb_prev == NULL) {
vim_beep(BO_MESS); vim_beep(BO_MESS);
@@ -2578,8 +2578,8 @@ static void t_puts(int *t_col, const char_u *t_s, const char_u *s, int attr)
attr); attr);
msg_col += *t_col; msg_col += *t_col;
*t_col = 0; *t_col = 0;
/* If the string starts with a composing character don't increment the // If the string starts with a composing character don't increment the
* column position for it. */ // column position for it.
if (utf_iscomposing(utf_ptr2char(t_s))) { if (utf_iscomposing(utf_ptr2char(t_s))) {
msg_col--; msg_col--;
} }
@@ -2747,8 +2747,8 @@ static int do_more_prompt(int typed_char)
case ':': // start new command line case ':': // start new command line
if (!confirm_msg_used) { if (!confirm_msg_used) {
/* Since got_int is set all typeahead will be flushed, but we // Since got_int is set all typeahead will be flushed, but we
* want to keep this ':', remember that in a special way. */ // want to keep this ':', remember that in a special way.
typeahead_noflush(':'); typeahead_noflush(':');
cmdline_row = Rows - 1; // put ':' on this line cmdline_row = Rows - 1; // put ':' on this line
skip_redraw = true; // skip redraw once skip_redraw = true; // skip redraw once
@@ -2765,8 +2765,8 @@ static int do_more_prompt(int typed_char)
got_int = TRUE; got_int = TRUE;
quit_more = TRUE; quit_more = TRUE;
} }
/* When there is some more output (wrapping line) display that // When there is some more output (wrapping line) display that
* without another prompt. */ // without another prompt.
lines_left = Rows - 1; lines_left = Rows - 1;
break; break;
@@ -2972,9 +2972,9 @@ void repeat_message(void)
ui_cursor_goto(msg_row, msg_col); // put cursor back ui_cursor_goto(msg_row, msg_col); // put cursor back
} else if (State == HITRETURN || State == SETWSIZE) { } else if (State == HITRETURN || State == SETWSIZE) {
if (msg_row == Rows - 1) { if (msg_row == Rows - 1) {
/* Avoid drawing the "hit-enter" prompt below the previous one, // Avoid drawing the "hit-enter" prompt below the previous one,
* overwrite it. Esp. useful when regaining focus and a // overwrite it. Esp. useful when regaining focus and a
* FocusGained autocmd exists but didn't draw anything. */ // FocusGained autocmd exists but didn't draw anything.
msg_didout = false; msg_didout = false;
msg_col = 0; msg_col = 0;
msg_clr_eos(); msg_clr_eos();

View File

@@ -100,8 +100,8 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
*/ */
found_one = FALSE; found_one = FALSE;
for (list = curbuf->b_p_com; *list; ) { for (list = curbuf->b_p_com; *list; ) {
/* Get one option part into part_buf[]. Advance "list" to next // Get one option part into part_buf[]. Advance "list" to next
* one. Put "string" at start of string. */ // one. Put "string" at start of string.
if (!got_com && flags != NULL) { if (!got_com && flags != NULL) {
*flags = list; // remember where flags started *flags = list; // remember where flags started
} }
@@ -113,16 +113,16 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
} }
*string++ = NUL; // isolate flags from string *string++ = NUL; // isolate flags from string
/* If we found a middle match previously, use that match when this // If we found a middle match previously, use that match when this
* is not a middle or end. */ // is not a middle or end.
if (middle_match_len != 0 if (middle_match_len != 0
&& vim_strchr(part_buf, COM_MIDDLE) == NULL && vim_strchr(part_buf, COM_MIDDLE) == NULL
&& vim_strchr(part_buf, COM_END) == NULL) { && vim_strchr(part_buf, COM_END) == NULL) {
break; break;
} }
/* When we already found a nested comment, only accept further // When we already found a nested comment, only accept further
* nested comments. */ // nested comments.
if (got_com && vim_strchr(part_buf, COM_NEST) == NULL) { if (got_com && vim_strchr(part_buf, COM_NEST) == NULL) {
continue; continue;
} }
@@ -132,10 +132,10 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
continue; continue;
} }
/* Line contents and string must match. // Line contents and string must match.
* When string starts with white space, must have some white space // When string starts with white space, must have some white space
* (but the amount does not need to match, there might be a mix of // (but the amount does not need to match, there might be a mix of
* TABs and spaces). */ // TABs and spaces).
if (ascii_iswhite(string[0])) { if (ascii_iswhite(string[0])) {
if (i == 0 || !ascii_iswhite(line[i - 1])) { if (i == 0 || !ascii_iswhite(line[i - 1])) {
continue; // missing white space continue; // missing white space
@@ -150,18 +150,18 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
if (string[j] != NUL) { if (string[j] != NUL) {
continue; // string doesn't match continue; // string doesn't match
} }
/* When 'b' flag used, there must be white space or an // When 'b' flag used, there must be white space or an
* end-of-line after the string in the line. */ // end-of-line after the string in the line.
if (vim_strchr(part_buf, COM_BLANK) != NULL if (vim_strchr(part_buf, COM_BLANK) != NULL
&& !ascii_iswhite(line[i + j]) && line[i + j] != NUL) { && !ascii_iswhite(line[i + j]) && line[i + j] != NUL) {
continue; continue;
} }
/* We have found a match, stop searching unless this is a middle // We have found a match, stop searching unless this is a middle
* comment. The middle comment can be a substring of the end // comment. The middle comment can be a substring of the end
* comment in which case it's better to return the length of the // comment in which case it's better to return the length of the
* end comment and its flags. Thus we keep searching with middle // end comment and its flags. Thus we keep searching with middle
* and end matches and use an end match if it matches better. */ // and end matches and use an end match if it matches better.
if (vim_strchr(part_buf, COM_MIDDLE) != NULL) { if (vim_strchr(part_buf, COM_MIDDLE) != NULL) {
if (middle_match_len == 0) { if (middle_match_len == 0) {
middle_match_len = j; middle_match_len = j;
@@ -170,8 +170,8 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
continue; continue;
} }
if (middle_match_len != 0 && j > middle_match_len) { if (middle_match_len != 0 && j > middle_match_len) {
/* Use this match instead of the middle match, since it's a // Use this match instead of the middle match, since it's a
* longer thus better match. */ // longer thus better match.
middle_match_len = 0; middle_match_len = 0;
} }
@@ -183,8 +183,8 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
} }
if (middle_match_len != 0) { if (middle_match_len != 0) {
/* Use the previously found middle match after failing to find a // Use the previously found middle match after failing to find a
* match with an end. */ // match with an end.
if (!got_com && flags != NULL) { if (!got_com && flags != NULL) {
*flags = saved_flags; *flags = saved_flags;
} }
@@ -254,8 +254,8 @@ int get_last_leader_offset(char_u *line, char_u **flags)
*/ */
(void)copy_option_part(&list, part_buf, COM_MAX_LEN, ","); (void)copy_option_part(&list, part_buf, COM_MAX_LEN, ",");
string = vim_strchr(part_buf, ':'); string = vim_strchr(part_buf, ':');
if (string == NULL) { /* If everything is fine, this cannot actually if (string == NULL) { // If everything is fine, this cannot actually
* happen. */ // happen.
continue; continue;
} }
*string++ = NUL; // Isolate flags from string. *string++ = NUL; // Isolate flags from string.
@@ -331,11 +331,10 @@ int get_last_leader_offset(char_u *line, char_u **flags)
lower_check_bound = i; lower_check_bound = i;
/* Let's verify whether the comment leader found is a substring // Let's verify whether the comment leader found is a substring
* of other comment leaders. If it is, let's adjust the // of other comment leaders. If it is, let's adjust the
* lower_check_bound so that we make sure that we have determined // lower_check_bound so that we make sure that we have determined
* the comment leader correctly. // the comment leader correctly.
*/
while (ascii_iswhite(*com_leader)) { while (ascii_iswhite(*com_leader)) {
++com_leader; ++com_leader;
@@ -359,8 +358,8 @@ int get_last_leader_offset(char_u *line, char_u **flags)
continue; continue;
} }
/* Now we have to verify whether string ends with a substring // Now we have to verify whether string ends with a substring
* beginning the com_leader. */ // beginning the com_leader.
for (off = (len2 > i ? i : len2); off > 0 && off + len1 > len2; ) { for (off = (len2 > i ? i : len2); off > 0 && off + len1 > len2; ) {
--off; --off;
if (!STRNCMP(string + off, com_leader, len2 - off)) { if (!STRNCMP(string + off, com_leader, len2 - off)) {
@@ -497,9 +496,9 @@ int get_keystroke(MultiQueue *events)
for (;; ) { for (;; ) {
// flush output before waiting // flush output before waiting
ui_flush(); ui_flush();
/* Leave some room for check_termcode() to insert a key code into (max // Leave some room for check_termcode() to insert a key code into (max
* 5 chars plus NUL). And fix_input_buffer() can triple the number of // 5 chars plus NUL). And fix_input_buffer() can triple the number of
* bytes. */ // bytes.
maxlen = (buflen - 6 - len) / 3; maxlen = (buflen - 6 - len) / 3;
if (buf == NULL) { if (buf == NULL) {
buf = xmalloc((size_t)buflen); buf = xmalloc((size_t)buflen);
@@ -511,8 +510,8 @@ int get_keystroke(MultiQueue *events)
maxlen = (buflen - 6 - len) / 3; maxlen = (buflen - 6 - len) / 3;
} }
/* First time: blocking wait. Second time: wait up to 100ms for a // First time: blocking wait. Second time: wait up to 100ms for a
* terminal code to complete. */ // terminal code to complete.
n = os_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0, events); n = os_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0, events);
if (n > 0) { if (n > 0) {
// Replace zero and CSI by a special key code. // Replace zero and CSI by a special key code.
@@ -575,8 +574,8 @@ int get_number(int colon, int *mouse_used)
*mouse_used = FALSE; *mouse_used = FALSE;
} }
/* When not printing messages, the user won't know what to type, return a // When not printing messages, the user won't know what to type, return a
* zero (as if CR was hit). */ // zero (as if CR was hit).
if (msg_silent != 0) { if (msg_silent != 0) {
return 0; return 0;
} }
@@ -674,9 +673,9 @@ void msgmore(long n)
return; return;
} }
/* We don't want to overwrite another important message, but do overwrite // We don't want to overwrite another important message, but do overwrite
* a previous "more lines" or "fewer lines" message, so that "5dd" and // a previous "more lines" or "fewer lines" message, so that "5dd" and
* then "put" reports the last action. */ // then "put" reports the last action.
if (keep_msg != NULL && !keep_msg_more) { if (keep_msg != NULL && !keep_msg_more) {
return; return;
} }

View File

@@ -226,9 +226,9 @@ void update_topline(win_T *wp)
n = wp->w_topline + *so_ptr - wp->w_cursor.lnum; n = wp->w_topline + *so_ptr - wp->w_cursor.lnum;
} }
/* If we weren't very close to begin with, we scroll to put the // If we weren't very close to begin with, we scroll to put the
* cursor in the middle of the window. Otherwise put the cursor // cursor in the middle of the window. Otherwise put the cursor
* near the top of the window. */ // near the top of the window.
if (n >= halfheight) { if (n >= halfheight) {
scroll_cursor_halfway(false); scroll_cursor_halfway(false);
} else { } else {
@@ -263,9 +263,9 @@ void update_topline(win_T *wp)
|| hasAnyFolding(wp))) { || hasAnyFolding(wp))) {
lineoff_T loff; lineoff_T loff;
/* Cursor is (a few lines) above botline, check if there are // Cursor is (a few lines) above botline, check if there are
* 'scrolloff' window lines below the cursor. If not, need to // 'scrolloff' window lines below the cursor. If not, need to
* scroll. */ // scroll.
int n = wp->w_empty_rows; int n = wp->w_empty_rows;
loff.lnum = wp->w_cursor.lnum; loff.lnum = wp->w_cursor.lnum;
// In a fold go to its last line. // In a fold go to its last line.
@@ -570,8 +570,8 @@ static void curs_rows(win_T *wp)
continue; // skip changed or deleted lines continue; // skip changed or deleted lines
} }
if (wp->w_lines[i].wl_lnum == lnum) { if (wp->w_lines[i].wl_lnum == lnum) {
/* Check for newly inserted lines below this row, in which // Check for newly inserted lines below this row, in which
* case we need to check for folded lines. */ // case we need to check for folded lines.
if (!wp->w_buffer->b_mod_set if (!wp->w_buffer->b_mod_set
|| wp->w_lines[i].wl_lastlnum < wp->w_cursor.lnum || wp->w_lines[i].wl_lastlnum < wp->w_cursor.lnum
|| wp->w_buffer->b_mod_top || wp->w_buffer->b_mod_top
@@ -815,8 +815,8 @@ void curs_columns(win_T *wp, int may_scroll)
if (off_left < 0 || off_right > 0) { if (off_left < 0 || off_right > 0) {
int diff = (off_left < 0) ? -off_left: off_right; int diff = (off_left < 0) ? -off_left: off_right;
/* When far off or not enough room on either side, put cursor in // When far off or not enough room on either side, put cursor in
* middle of window. */ // middle of window.
int new_leftcol; int new_leftcol;
if (p_ss == 0 || diff >= textwidth / 2 || off_right >= off_left) { if (p_ss == 0 || diff >= textwidth / 2 || off_right >= off_left) {
new_leftcol = wp->w_wcol - extra - textwidth / 2; new_leftcol = wp->w_wcol - extra - textwidth / 2;
@@ -848,8 +848,8 @@ void curs_columns(win_T *wp, int may_scroll)
wp->w_wcol = 0; wp->w_wcol = 0;
} }
/* Skip over filler lines. At the top use w_topfill, there // Skip over filler lines. At the top use w_topfill, there
* may be some filler lines above the window. */ // may be some filler lines above the window.
if (wp->w_cursor.lnum == wp->w_topline) { if (wp->w_cursor.lnum == wp->w_topline) {
wp->w_wrow += wp->w_topfill; wp->w_wrow += wp->w_topfill;
} else { } else {
@@ -869,12 +869,12 @@ void curs_columns(win_T *wp, int may_scroll)
&& wp->w_cursor.lnum == wp->w_topline && wp->w_cursor.lnum == wp->w_topline
&& width > 0 && width > 0
&& wp->w_width_inner != 0) { && wp->w_width_inner != 0) {
/* Cursor past end of screen. Happens with a single line that does // Cursor past end of screen. Happens with a single line that does
* not fit on screen. Find a skipcol to show the text around the // not fit on screen. Find a skipcol to show the text around the
* cursor. Avoid scrolling all the time. compute value of "extra": // cursor. Avoid scrolling all the time. compute value of "extra":
* 1: Less than "p_so" lines above // 1: Less than "p_so" lines above
* 2: Less than "p_so" lines below // 2: Less than "p_so" lines below
* 3: both of them */ // 3: both of them
extra = 0; extra = 0;
if (wp->w_skipcol + so * width > wp->w_virtcol) { if (wp->w_skipcol + so * width > wp->w_virtcol) {
extra = 1; extra = 1;
@@ -1592,8 +1592,8 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
- curwin->w_filler_rows; - curwin->w_filler_rows;
while (loff.lnum > 1) { while (loff.lnum > 1) {
/* Stop when scrolled nothing or at least "min_scroll", found "extra" // Stop when scrolled nothing or at least "min_scroll", found "extra"
* context for 'scrolloff' and counted all lines below the window. */ // context for 'scrolloff' and counted all lines below the window.
if ((((scrolled <= 0 || scrolled >= min_scroll) if ((((scrolled <= 0 || scrolled >= min_scroll)
&& extra >= (mouse_dragging > 0 ? mouse_dragging - 1 : so)) && extra >= (mouse_dragging > 0 ? mouse_dragging - 1 : so))
|| boff.lnum + 1 > curbuf->b_ml.ml_line_count) || boff.lnum + 1 > curbuf->b_ml.ml_line_count)
@@ -1912,8 +1912,8 @@ int onepage(Direction dir, long count)
curwin->w_topfill = 0; curwin->w_topfill = 0;
curwin->w_valid &= ~(VALID_WROW|VALID_CROW); curwin->w_valid &= ~(VALID_WROW|VALID_CROW);
} else { } else {
/* For the overlap, start with the line just below the window // For the overlap, start with the line just below the window
* and go upwards. */ // and go upwards.
loff.lnum = curwin->w_botline; loff.lnum = curwin->w_botline;
loff.fill = win_get_fill(curwin, loff.lnum) loff.fill = win_get_fill(curwin, loff.lnum)
- curwin->w_filler_rows; - curwin->w_filler_rows;
@@ -1948,9 +1948,9 @@ int onepage(Direction dir, long count)
continue; continue;
} }
/* Find the line at the top of the window that is going to be the // Find the line at the top of the window that is going to be the
* line at the bottom of the window. Make sure this results in // line at the bottom of the window. Make sure this results in
* the same line as before doing CTRL-F. */ // the same line as before doing CTRL-F.
loff.lnum = curwin->w_topline - 1; loff.lnum = curwin->w_topline - 1;
loff.fill = win_get_fill(curwin, loff.lnum + 1) - curwin->w_topfill; loff.fill = win_get_fill(curwin, loff.lnum + 1) - curwin->w_topfill;
get_scroll_overlap(&loff, 1); get_scroll_overlap(&loff, 1);
@@ -1963,8 +1963,8 @@ int onepage(Direction dir, long count)
} }
curwin->w_cursor.lnum = loff.lnum; curwin->w_cursor.lnum = loff.lnum;
/* Find the line just above the new topline to get the right line // Find the line just above the new topline to get the right line
* at the bottom of the window. */ // at the bottom of the window.
n = 0; n = 0;
while (n <= curwin->w_height_inner && loff.lnum >= 1) { while (n <= curwin->w_height_inner && loff.lnum >= 1) {
topline_back(curwin, &loff); topline_back(curwin, &loff);
@@ -1987,13 +1987,13 @@ int onepage(Direction dir, long count)
// We're at the wrong end of a fold now. // We're at the wrong end of a fold now.
(void)hasFoldingWin(curwin, loff.lnum, &loff.lnum, NULL, true, NULL); (void)hasFoldingWin(curwin, loff.lnum, &loff.lnum, NULL, true, NULL);
/* Always scroll at least one line. Avoid getting stuck on // Always scroll at least one line. Avoid getting stuck on
* very long lines. */ // very long lines.
if (loff.lnum >= curwin->w_topline if (loff.lnum >= curwin->w_topline
&& (loff.lnum > curwin->w_topline && (loff.lnum > curwin->w_topline
|| loff.fill >= curwin->w_topfill)) { || loff.fill >= curwin->w_topfill)) {
/* First try using the maximum number of filler lines. If // First try using the maximum number of filler lines. If
* that's not enough, backup one line. */ // that's not enough, backup one line.
loff.fill = curwin->w_topfill; loff.fill = curwin->w_topfill;
if (curwin->w_topfill < win_get_fill(curwin, curwin->w_topline)) { if (curwin->w_topfill < win_get_fill(curwin, curwin->w_topline)) {
max_topfill(); max_topfill();
@@ -2266,8 +2266,8 @@ void do_check_cursorbind(void)
curwin->w_curswant = curswant; curwin->w_curswant = curswant;
curwin->w_set_curswant = set_curswant; curwin->w_set_curswant = set_curswant;
/* Make sure the cursor is in a valid position. Temporarily set // Make sure the cursor is in a valid position. Temporarily set
* "restart_edit" to allow the cursor to be beyond the EOL. */ // "restart_edit" to allow the cursor to be beyond the EOL.
{ {
int restart_edit_save = restart_edit; int restart_edit_save = restart_edit;
restart_edit = true; restart_edit = true;