aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/message.c46
-rw-r--r--src/nvim/misc1.c79
-rw-r--r--src/nvim/move.c66
3 files changed, 95 insertions, 96 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 279f84f3d4..75f0dd6bb7 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -299,8 +299,8 @@ bool msg_attr_keep(char_u *s, int attr, bool keep, bool multiline)
}
++entered;
- /* Add message to history (unless it's a repeated kept message or a
- * truncated message) */
+ // Add message to history (unless it's a repeated kept message or a
+ // truncated message)
if (s != keep_msg
|| (*s != '<'
&& last_msg_hist != NULL
@@ -1089,8 +1089,8 @@ void wait_return(int redraw)
redraw_all_later(NOT_VALID);
}
- /* If using ":silent cmd", don't wait for a return. Also don't set
- * need_wait_return to do it later. */
+ // If using ":silent cmd", don't wait for a return. Also don't set
+ // need_wait_return to do it later.
if (msg_silent != 0) {
return;
}
@@ -1140,8 +1140,8 @@ void wait_return(int redraw)
hit_return_msg();
do {
- /* Remember "got_int", if it is set vgetc() probably returns a
- * CTRL-C, but we need to loop then. */
+ // Remember "got_int", if it is set vgetc() probably returns a
+ // CTRL-C, but we need to loop then.
had_got_int = got_int;
// 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) {
(void)jump_to_mouse(MOUSE_SETPOS, NULL, 0);
} 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
- * stuff buffer, because lmaps wouldn't work. */
+ // Put the character back in the typeahead buffer. Don't use the
+ // stuff buffer, because lmaps wouldn't work.
ins_char_typebuf(c);
do_redraw = true; // need a redraw even though there is
// typeahead
@@ -1824,8 +1824,8 @@ void msg_prt_line(char_u *s, int list)
c_extra = NUL;
c_final = NUL;
c = *p_extra++;
- /* Use special coloring to be able to distinguish <hex> from
- * the same in plain text. */
+ // Use special coloring to be able to distinguish <hex> from
+ // the same in plain text.
attr = HL_ATTR(HLF_0);
} else if (c == ' ') {
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
- * is still more. */
+ // When we displayed a char in last column need to check if there
+ // is still more.
if (did_last_char) {
continue;
}
@@ -2506,8 +2506,8 @@ void show_sb_text(void)
{
msgchunk_T *mp;
- /* Only show something if there is more than one line, otherwise it looks
- * weird, typing a command without output results in one line. */
+ // Only show something if there is more than one line, otherwise it looks
+ // weird, typing a command without output results in one line.
mp = msg_sb_start(last_msgchunk);
if (mp == NULL || mp->sb_prev == NULL) {
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);
msg_col += *t_col;
*t_col = 0;
- /* If the string starts with a composing character don't increment the
- * column position for it. */
+ // If the string starts with a composing character don't increment the
+ // column position for it.
if (utf_iscomposing(utf_ptr2char(t_s))) {
msg_col--;
}
@@ -2747,8 +2747,8 @@ static int do_more_prompt(int typed_char)
case ':': // start new command line
if (!confirm_msg_used) {
- /* Since got_int is set all typeahead will be flushed, but we
- * want to keep this ':', remember that in a special way. */
+ // Since got_int is set all typeahead will be flushed, but we
+ // want to keep this ':', remember that in a special way.
typeahead_noflush(':');
cmdline_row = Rows - 1; // put ':' on this line
skip_redraw = true; // skip redraw once
@@ -2765,8 +2765,8 @@ static int do_more_prompt(int typed_char)
got_int = TRUE;
quit_more = TRUE;
}
- /* When there is some more output (wrapping line) display that
- * without another prompt. */
+ // When there is some more output (wrapping line) display that
+ // without another prompt.
lines_left = Rows - 1;
break;
@@ -2972,9 +2972,9 @@ void repeat_message(void)
ui_cursor_goto(msg_row, msg_col); // put cursor back
} else if (State == HITRETURN || State == SETWSIZE) {
if (msg_row == Rows - 1) {
- /* Avoid drawing the "hit-enter" prompt below the previous one,
- * overwrite it. Esp. useful when regaining focus and a
- * FocusGained autocmd exists but didn't draw anything. */
+ // Avoid drawing the "hit-enter" prompt below the previous one,
+ // overwrite it. Esp. useful when regaining focus and a
+ // FocusGained autocmd exists but didn't draw anything.
msg_didout = false;
msg_col = 0;
msg_clr_eos();
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 40db5b7cf3..ffc930ac1e 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -100,8 +100,8 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
*/
found_one = FALSE;
for (list = curbuf->b_p_com; *list; ) {
- /* Get one option part into part_buf[]. Advance "list" to next
- * one. Put "string" at start of string. */
+ // Get one option part into part_buf[]. Advance "list" to next
+ // one. Put "string" at start of string.
if (!got_com && flags != NULL) {
*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
- /* If we found a middle match previously, use that match when this
- * is not a middle or end. */
+ // If we found a middle match previously, use that match when this
+ // is not a middle or end.
if (middle_match_len != 0
&& vim_strchr(part_buf, COM_MIDDLE) == NULL
&& vim_strchr(part_buf, COM_END) == NULL) {
break;
}
- /* When we already found a nested comment, only accept further
- * nested comments. */
+ // When we already found a nested comment, only accept further
+ // nested comments.
if (got_com && vim_strchr(part_buf, COM_NEST) == NULL) {
continue;
}
@@ -132,10 +132,10 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
continue;
}
- /* Line contents and string must match.
- * 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
- * TABs and spaces). */
+ // Line contents and string must match.
+ // 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
+ // TABs and spaces).
if (ascii_iswhite(string[0])) {
if (i == 0 || !ascii_iswhite(line[i - 1])) {
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) {
continue; // string doesn't match
}
- /* When 'b' flag used, there must be white space or an
- * end-of-line after the string in the line. */
+ // When 'b' flag used, there must be white space or an
+ // end-of-line after the string in the line.
if (vim_strchr(part_buf, COM_BLANK) != NULL
&& !ascii_iswhite(line[i + j]) && line[i + j] != NUL) {
continue;
}
- /* We have found a match, stop searching unless this is a middle
- * comment. The middle comment can be a substring of the end
- * comment in which case it's better to return the length of the
- * end comment and its flags. Thus we keep searching with middle
- * and end matches and use an end match if it matches better. */
+ // We have found a match, stop searching unless this is a middle
+ // comment. The middle comment can be a substring of the end
+ // comment in which case it's better to return the length of the
+ // end comment and its flags. Thus we keep searching with middle
+ // and end matches and use an end match if it matches better.
if (vim_strchr(part_buf, COM_MIDDLE) != NULL) {
if (middle_match_len == 0) {
middle_match_len = j;
@@ -170,8 +170,8 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
continue;
}
if (middle_match_len != 0 && j > middle_match_len) {
- /* Use this match instead of the middle match, since it's a
- * longer thus better match. */
+ // Use this match instead of the middle match, since it's a
+ // longer thus better match.
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) {
- /* Use the previously found middle match after failing to find a
- * match with an end. */
+ // Use the previously found middle match after failing to find a
+ // match with an end.
if (!got_com && flags != NULL) {
*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, ",");
string = vim_strchr(part_buf, ':');
- if (string == NULL) { /* If everything is fine, this cannot actually
- * happen. */
+ if (string == NULL) { // If everything is fine, this cannot actually
+ // happen.
continue;
}
*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;
- /* Let's verify whether the comment leader found is a substring
- * of other comment leaders. If it is, let's adjust the
- * lower_check_bound so that we make sure that we have determined
- * the comment leader correctly.
- */
+ // Let's verify whether the comment leader found is a substring
+ // of other comment leaders. If it is, let's adjust the
+ // lower_check_bound so that we make sure that we have determined
+ // the comment leader correctly.
while (ascii_iswhite(*com_leader)) {
++com_leader;
@@ -359,8 +358,8 @@ int get_last_leader_offset(char_u *line, char_u **flags)
continue;
}
- /* Now we have to verify whether string ends with a substring
- * beginning the com_leader. */
+ // Now we have to verify whether string ends with a substring
+ // beginning the com_leader.
for (off = (len2 > i ? i : len2); off > 0 && off + len1 > len2; ) {
--off;
if (!STRNCMP(string + off, com_leader, len2 - off)) {
@@ -497,9 +496,9 @@ int get_keystroke(MultiQueue *events)
for (;; ) {
// flush output before waiting
ui_flush();
- /* 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
- * bytes. */
+ // 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
+ // bytes.
maxlen = (buflen - 6 - len) / 3;
if (buf == NULL) {
buf = xmalloc((size_t)buflen);
@@ -511,8 +510,8 @@ int get_keystroke(MultiQueue *events)
maxlen = (buflen - 6 - len) / 3;
}
- /* First time: blocking wait. Second time: wait up to 100ms for a
- * terminal code to complete. */
+ // First time: blocking wait. Second time: wait up to 100ms for a
+ // terminal code to complete.
n = os_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0, events);
if (n > 0) {
// Replace zero and CSI by a special key code.
@@ -575,8 +574,8 @@ int get_number(int colon, int *mouse_used)
*mouse_used = FALSE;
}
- /* When not printing messages, the user won't know what to type, return a
- * zero (as if CR was hit). */
+ // When not printing messages, the user won't know what to type, return a
+ // zero (as if CR was hit).
if (msg_silent != 0) {
return 0;
}
@@ -674,9 +673,9 @@ void msgmore(long n)
return;
}
- /* We don't want to overwrite another important message, but do overwrite
- * a previous "more lines" or "fewer lines" message, so that "5dd" and
- * then "put" reports the last action. */
+ // We don't want to overwrite another important message, but do overwrite
+ // a previous "more lines" or "fewer lines" message, so that "5dd" and
+ // then "put" reports the last action.
if (keep_msg != NULL && !keep_msg_more) {
return;
}
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 64ba02064f..5114cd6d8a 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -226,9 +226,9 @@ void update_topline(win_T *wp)
n = wp->w_topline + *so_ptr - wp->w_cursor.lnum;
}
- /* 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
- * near the top of the window. */
+ // 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
+ // near the top of the window.
if (n >= halfheight) {
scroll_cursor_halfway(false);
} else {
@@ -263,9 +263,9 @@ void update_topline(win_T *wp)
|| hasAnyFolding(wp))) {
lineoff_T loff;
- /* Cursor is (a few lines) above botline, check if there are
- * 'scrolloff' window lines below the cursor. If not, need to
- * scroll. */
+ // Cursor is (a few lines) above botline, check if there are
+ // 'scrolloff' window lines below the cursor. If not, need to
+ // scroll.
int n = wp->w_empty_rows;
loff.lnum = wp->w_cursor.lnum;
// 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
}
if (wp->w_lines[i].wl_lnum == lnum) {
- /* Check for newly inserted lines below this row, in which
- * case we need to check for folded lines. */
+ // Check for newly inserted lines below this row, in which
+ // case we need to check for folded lines.
if (!wp->w_buffer->b_mod_set
|| wp->w_lines[i].wl_lastlnum < wp->w_cursor.lnum
|| 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) {
int diff = (off_left < 0) ? -off_left: off_right;
- /* When far off or not enough room on either side, put cursor in
- * middle of window. */
+ // When far off or not enough room on either side, put cursor in
+ // middle of window.
int new_leftcol;
if (p_ss == 0 || diff >= textwidth / 2 || off_right >= off_left) {
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;
}
- /* Skip over filler lines. At the top use w_topfill, there
- * may be some filler lines above the window. */
+ // Skip over filler lines. At the top use w_topfill, there
+ // may be some filler lines above the window.
if (wp->w_cursor.lnum == wp->w_topline) {
wp->w_wrow += wp->w_topfill;
} else {
@@ -869,12 +869,12 @@ void curs_columns(win_T *wp, int may_scroll)
&& wp->w_cursor.lnum == wp->w_topline
&& width > 0
&& wp->w_width_inner != 0) {
- /* 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
- * cursor. Avoid scrolling all the time. compute value of "extra":
- * 1: Less than "p_so" lines above
- * 2: Less than "p_so" lines below
- * 3: both of them */
+ // 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
+ // cursor. Avoid scrolling all the time. compute value of "extra":
+ // 1: Less than "p_so" lines above
+ // 2: Less than "p_so" lines below
+ // 3: both of them
extra = 0;
if (wp->w_skipcol + so * width > wp->w_virtcol) {
extra = 1;
@@ -1592,8 +1592,8 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
- curwin->w_filler_rows;
while (loff.lnum > 1) {
- /* Stop when scrolled nothing or at least "min_scroll", found "extra"
- * context for 'scrolloff' and counted all lines below the window. */
+ // Stop when scrolled nothing or at least "min_scroll", found "extra"
+ // context for 'scrolloff' and counted all lines below the window.
if ((((scrolled <= 0 || scrolled >= min_scroll)
&& extra >= (mouse_dragging > 0 ? mouse_dragging - 1 : so))
|| 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_valid &= ~(VALID_WROW|VALID_CROW);
} else {
- /* For the overlap, start with the line just below the window
- * and go upwards. */
+ // For the overlap, start with the line just below the window
+ // and go upwards.
loff.lnum = curwin->w_botline;
loff.fill = win_get_fill(curwin, loff.lnum)
- curwin->w_filler_rows;
@@ -1948,9 +1948,9 @@ int onepage(Direction dir, long count)
continue;
}
- /* 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
- * the same line as before doing CTRL-F. */
+ // 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
+ // the same line as before doing CTRL-F.
loff.lnum = curwin->w_topline - 1;
loff.fill = win_get_fill(curwin, loff.lnum + 1) - curwin->w_topfill;
get_scroll_overlap(&loff, 1);
@@ -1963,8 +1963,8 @@ int onepage(Direction dir, long count)
}
curwin->w_cursor.lnum = loff.lnum;
- /* Find the line just above the new topline to get the right line
- * at the bottom of the window. */
+ // Find the line just above the new topline to get the right line
+ // at the bottom of the window.
n = 0;
while (n <= curwin->w_height_inner && loff.lnum >= 1) {
topline_back(curwin, &loff);
@@ -1987,13 +1987,13 @@ int onepage(Direction dir, long count)
// We're at the wrong end of a fold now.
(void)hasFoldingWin(curwin, loff.lnum, &loff.lnum, NULL, true, NULL);
- /* Always scroll at least one line. Avoid getting stuck on
- * very long lines. */
+ // Always scroll at least one line. Avoid getting stuck on
+ // very long lines.
if (loff.lnum >= curwin->w_topline
&& (loff.lnum > curwin->w_topline
|| loff.fill >= curwin->w_topfill)) {
- /* First try using the maximum number of filler lines. If
- * that's not enough, backup one line. */
+ // First try using the maximum number of filler lines. If
+ // that's not enough, backup one line.
loff.fill = curwin->w_topfill;
if (curwin->w_topfill < win_get_fill(curwin, curwin->w_topline)) {
max_topfill();
@@ -2266,8 +2266,8 @@ void do_check_cursorbind(void)
curwin->w_curswant = curswant;
curwin->w_set_curswant = set_curswant;
- /* Make sure the cursor is in a valid position. Temporarily set
- * "restart_edit" to allow the cursor to be beyond the EOL. */
+ // Make sure the cursor is in a valid position. Temporarily set
+ // "restart_edit" to allow the cursor to be beyond the EOL.
{
int restart_edit_save = restart_edit;
restart_edit = true;