diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-21 18:25:54 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-21 18:25:54 +0100 |
commit | 85a2002adb0eda9a9309c2fab4a79edaa91fb834 (patch) | |
tree | 99278733712406ab6f291d92f1645c0064c75037 /src/move.c | |
parent | fe72d08400d9064b3f959f1f62f279527e64835a (diff) | |
download | vim-git-85a2002adb0eda9a9309c2fab4a79edaa91fb834.tar.gz |
patch 8.2.0026: still some /* */ commentsv8.2.0026
Problem: Still some /* */ comments.
Solution: Convert to // comments.
Diffstat (limited to 'src/move.c')
-rw-r--r-- | src/move.c | 332 |
1 files changed, 166 insertions, 166 deletions
diff --git a/src/move.c b/src/move.c index 6121e3e2d..6b854541c 100644 --- a/src/move.c +++ b/src/move.c @@ -25,11 +25,11 @@ static void curs_rows(win_T *wp); typedef struct { - linenr_T lnum; /* line number */ + linenr_T lnum; // line number #ifdef FEAT_DIFF - int fill; /* filler lines */ + int fill; // filler lines #endif - int height; /* height of added line */ + int height; // height of added line } lineoff_T; static void topline_back(lineoff_T *lp); @@ -108,7 +108,7 @@ comp_botline(win_T *wp) #endif } - /* wp->w_botline is the line that is just below the window */ + // wp->w_botline is the line that is just below the window wp->w_botline = lnum; wp->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; @@ -192,8 +192,8 @@ update_topline(void) long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; int save_so = *so_ptr; - /* If there is no valid screen and when the window height is zero just use - * the cursor line. */ + // If there is no valid screen and when the window height is zero just use + // the cursor line. if (!screen_valid(TRUE) || curwin->w_height == 0) { curwin->w_topline = curwin->w_cursor.lnum; @@ -207,7 +207,7 @@ update_topline(void) if (curwin->w_valid & VALID_TOPLINE) return; - /* When dragging with the mouse, don't scroll that quickly */ + // When dragging with the mouse, don't scroll that quickly if (mouse_dragging > 0) *so_ptr = mouse_dragging - 1; @@ -219,7 +219,7 @@ update_topline(void) /* * If the buffer is empty, always set topline to 1. */ - if (BUFEMPTY()) /* special case - file is empty */ + if (BUFEMPTY()) // special case - file is empty { if (curwin->w_topline != 1) redraw_later(NOT_VALID); @@ -237,16 +237,16 @@ update_topline(void) { if (curwin->w_topline > 1) { - /* If the cursor is above topline, scrolling is always needed. - * If the cursor is far below topline and there is no folding, - * scrolling down is never needed. */ + // If the cursor is above topline, scrolling is always needed. + // If the cursor is far below topline and there is no folding, + // scrolling down is never needed. if (curwin->w_cursor.lnum < curwin->w_topline) check_topline = TRUE; else if (check_top_offset()) check_topline = TRUE; } #ifdef FEAT_DIFF - /* Check if there are more filler lines than allowed. */ + // Check if there are more filler lines than allowed. if (!check_topline && curwin->w_topfill > diff_check_fill(curwin, curwin->w_topline)) check_topline = TRUE; @@ -261,15 +261,15 @@ update_topline(void) #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) { - /* Count the number of logical lines between the cursor and - * topline + scrolloff (approximation of how much will be - * scrolled). */ + // Count the number of logical lines between the cursor and + // topline + scrolloff (approximation of how much will be + // scrolled). n = 0; for (lnum = curwin->w_cursor.lnum; - lnum < curwin->w_topline + *so_ptr; ++lnum) + lnum < curwin->w_topline + *so_ptr; ++lnum) { ++n; - /* stop at end of file or when we know we are far off */ + // stop at end of file or when we know we are far off if (lnum >= curbuf->b_ml.ml_line_count || n >= halfheight) break; (void)hasFolding(lnum, NULL, &lnum); @@ -279,9 +279,9 @@ update_topline(void) #endif n = curwin->w_topline + *so_ptr - curwin->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 @@ -294,7 +294,7 @@ update_topline(void) else { #ifdef FEAT_FOLDING - /* Make sure topline is the first line of a fold. */ + // Make sure topline is the first line of a fold. (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif check_botline = TRUE; @@ -327,13 +327,13 @@ update_topline(void) { 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. n = curwin->w_empty_rows; loff.lnum = curwin->w_cursor.lnum; #ifdef FEAT_FOLDING - /* In a fold go to its last line. */ + // In a fold go to its last line. (void)hasFolding(loff.lnum, NULL, &loff.lnum); #endif #ifdef FEAT_DIFF @@ -353,11 +353,11 @@ update_topline(void) botline_forw(&loff); } if (n >= *so_ptr) - /* sufficient context, no need to scroll */ + // sufficient context, no need to scroll check_botline = FALSE; } else - /* sufficient context, no need to scroll */ + // sufficient context, no need to scroll check_botline = FALSE; } if (check_botline) @@ -365,15 +365,15 @@ update_topline(void) #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) { - /* Count the number of logical lines between the cursor and - * botline - scrolloff (approximation of how much will be - * scrolled). */ + // Count the number of logical lines between the cursor and + // botline - scrolloff (approximation of how much will be + // scrolled). line_count = 0; for (lnum = curwin->w_cursor.lnum; - lnum >= curwin->w_botline - *so_ptr; --lnum) + lnum >= curwin->w_botline - *so_ptr; --lnum) { ++line_count; - /* stop at end of file or when we know we are far off */ + // stop at end of file or when we know we are far off if (lnum <= 0 || line_count > curwin->w_height + 1) break; (void)hasFolding(lnum, &lnum, NULL); @@ -409,7 +409,7 @@ update_topline(void) } else redraw_later(VALID); - /* May need to set w_skipcol when cursor in w_topline. */ + // May need to set w_skipcol when cursor in w_topline. if (curwin->w_cursor.lnum == curwin->w_topline) validate_cursor(); } @@ -450,15 +450,15 @@ check_top_offset(void) loff.lnum = curwin->w_cursor.lnum; #ifdef FEAT_DIFF loff.fill = 0; - n = curwin->w_topfill; /* always have this context */ + n = curwin->w_topfill; // always have this context #else n = 0; #endif - /* Count the visible screen lines above the cursor line. */ + // Count the visible screen lines above the cursor line. while (n < so) { topline_back(&loff); - /* Stop when included a line above the window. */ + // Stop when included a line above the window. if (loff.lnum < curwin->w_topline #ifdef FEAT_DIFF || (loff.lnum == curwin->w_topline && loff.fill > 0) @@ -535,10 +535,10 @@ changed_window_setting_win(win_T *wp) set_topline(win_T *wp, linenr_T lnum) { #ifdef FEAT_FOLDING - /* go to first of folded lines */ + // go to first of folded lines (void)hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL); #endif - /* Approximate the value of w_botline */ + // Approximate the value of w_botline wp->w_botline += lnum - wp->w_topline; wp->w_topline = lnum; wp->w_topline_was_set = TRUE; @@ -546,7 +546,7 @@ set_topline(win_T *wp, linenr_T lnum) wp->w_topfill = 0; #endif wp->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE|VALID_TOPLINE); - /* Don't set VALID_TOPLINE here, 'scrolloff' needs to be checked. */ + // Don't set VALID_TOPLINE here, 'scrolloff' needs to be checked. redraw_later(VALID); } @@ -675,7 +675,7 @@ curs_rows(win_T *wp) long fold_count; #endif - /* Check if wp->w_lines[].wl_size is invalid */ + // Check if wp->w_lines[].wl_size is invalid all_invalid = (!redrawing() || wp->w_lines_valid == 0 || wp->w_lines[0].wl_lnum > wp->w_topline); @@ -687,12 +687,12 @@ curs_rows(win_T *wp) if (!all_invalid && i < wp->w_lines_valid) { if (wp->w_lines[i].wl_lnum < lnum || !wp->w_lines[i].wl_valid) - continue; /* skip changed or deleted lines */ + continue; // skip changed or deleted lines if (wp->w_lines[i].wl_lnum == lnum) { #ifdef FEAT_FOLDING - /* 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 @@ -701,7 +701,7 @@ curs_rows(win_T *wp) valid = TRUE; } else if (wp->w_lines[i].wl_lnum > lnum) - --i; /* hold at inserted lines */ + --i; // hold at inserted lines } if (valid #ifdef FEAT_DIFF @@ -711,7 +711,7 @@ curs_rows(win_T *wp) { #ifdef FEAT_FOLDING lnum = wp->w_lines[i].wl_lastlnum + 1; - /* Cursor inside folded lines, don't count this row */ + // Cursor inside folded lines, don't count this row if (lnum > wp->w_cursor.lnum) break; #else @@ -765,7 +765,7 @@ curs_rows(win_T *wp) } else if (i > wp->w_lines_valid) { - /* a line that is too long to fit on the last screen line */ + // a line that is too long to fit on the last screen line wp->w_cline_height = 0; #ifdef FEAT_FOLDING wp->w_cline_folded = hasFoldingWin(wp, wp->w_cursor.lnum, @@ -854,11 +854,11 @@ validate_cursor_col(void) col += off; width = curwin->w_width - off + curwin_col_off2(); - /* long line wrapping, adjust curwin->w_wrow */ + // long line wrapping, adjust curwin->w_wrow if (curwin->w_p_wrap && col >= (colnr_T)curwin->w_width && width > 0) - /* use same formula as what is used in curs_columns() */ + // use same formula as what is used in curs_columns() col -= ((col - curwin->w_width) / width + 1) * width; if (col > (int)curwin->w_leftcol) col -= curwin->w_leftcol; @@ -922,10 +922,10 @@ curwin_col_off2(void) */ void curs_columns( - int may_scroll) /* when TRUE, may scroll horizontally */ + int may_scroll) // when TRUE, may scroll horizontally { int diff; - int extra; /* offset for first screen line */ + int extra; // offset for first screen line int off_left, off_right; int n; int p_lines; @@ -954,14 +954,14 @@ curs_columns( */ #ifdef FEAT_FOLDING if (curwin->w_cline_folded) - /* In a folded line the cursor is always in the first column */ + // In a folded line the cursor is always in the first column startcol = curwin->w_virtcol = endcol = curwin->w_leftcol; else #endif getvvcol(curwin, &curwin->w_cursor, &startcol, &(curwin->w_virtcol), &endcol); - /* remove '$' from change command when cursor moves onto it */ + // remove '$' from change command when cursor moves onto it if (startcol > dollar_vcol) dollar_vcol = -1; @@ -977,7 +977,7 @@ curs_columns( textwidth = curwin->w_width - extra; if (textwidth <= 0) { - /* No room for text, put cursor in last char of window. */ + // No room for text, put cursor in last char of window. curwin->w_wcol = curwin->w_width - 1; curwin->w_wrow = curwin->w_height - 1; } @@ -985,22 +985,22 @@ curs_columns( { width = textwidth + curwin_col_off2(); - /* long line wrapping, adjust curwin->w_wrow */ + // long line wrapping, adjust curwin->w_wrow if (curwin->w_wcol >= curwin->w_width) { #ifdef FEAT_LINEBREAK char_u *sbr; #endif - /* this same formula is used in validate_cursor_col() */ + // this same formula is used in validate_cursor_col() n = (curwin->w_wcol - curwin->w_width) / width + 1; curwin->w_wcol -= n * width; curwin->w_wrow += n; #ifdef FEAT_LINEBREAK - /* When cursor wraps to first char of next line in Insert - * mode, the 'showbreak' string isn't shown, backup to first - * column */ + // When cursor wraps to first char of next line in Insert + // mode, the 'showbreak' string isn't shown, backup to first + // column sbr = get_showbreak_value(curwin); if (*sbr && *ml_get_cursor() == NUL && curwin->w_wcol == (int)vim_strsize(sbr)) @@ -1009,9 +1009,9 @@ curs_columns( } } - /* No line wrapping: compute curwin->w_leftcol if scrolling is on and line - * is not folded. - * If scrolling is off, curwin->w_leftcol is assumed to be 0 */ + // No line wrapping: compute curwin->w_leftcol if scrolling is on and line + // is not folded. + // If scrolling is off, curwin->w_leftcol is assumed to be 0 else if (may_scroll #ifdef FEAT_FOLDING && !curwin->w_cline_folded @@ -1034,8 +1034,8 @@ curs_columns( else diff = 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. if (p_ss == 0 || diff >= textwidth / 2 || off_right >= off_left) new_leftcol = curwin->w_wcol - extra - textwidth / 2; else @@ -1052,7 +1052,7 @@ curs_columns( if (new_leftcol != (int)curwin->w_leftcol) { curwin->w_leftcol = new_leftcol; - /* screen has to be redrawn with new curwin->w_leftcol */ + // screen has to be redrawn with new curwin->w_leftcol redraw_later(NOT_VALID); } } @@ -1064,8 +1064,8 @@ curs_columns( curwin->w_wcol = 0; #ifdef FEAT_DIFF - /* 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 (curwin->w_cursor.lnum == curwin->w_topline) curwin->w_wrow += curwin->w_topfill; else @@ -1092,17 +1092,17 @@ curs_columns( && width > 0 && curwin->w_width != 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 'scrolloff' lines above - * 2: Less than 'scrolloff' 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 'scrolloff' lines above + // 2: Less than 'scrolloff' lines below + // 3: both of them extra = 0; if (curwin->w_skipcol + so * width > curwin->w_virtcol) extra = 1; - /* Compute last display line of the buffer line that we want at the - * bottom of the window. */ + // Compute last display line of the buffer line that we want at the + // bottom of the window. if (p_lines == 0) p_lines = plines_win(curwin, curwin->w_cursor.lnum, FALSE); --p_lines; @@ -1115,20 +1115,20 @@ curs_columns( if (extra == 3 || p_lines < so * 2) { - /* not enough room for 'scrolloff', put cursor in the middle */ + // not enough room for 'scrolloff', put cursor in the middle n = curwin->w_virtcol / width; if (n > curwin->w_height / 2) n -= curwin->w_height / 2; else n = 0; - /* don't skip more than necessary */ + // don't skip more than necessary if (n > p_lines - curwin->w_height + 1) n = p_lines - curwin->w_height + 1; curwin->w_skipcol = n * width; } else if (extra == 1) { - /* less then 'scrolloff' lines above, decrease skipcol */ + // less then 'scrolloff' lines above, decrease skipcol extra = (curwin->w_skipcol + so * width - curwin->w_virtcol + width - 1) / width; if (extra > 0) @@ -1140,7 +1140,7 @@ curs_columns( } else if (extra == 2) { - /* less then 'scrolloff' lines below, increase skipcol */ + // less then 'scrolloff' lines below, increase skipcol endcol = (n - curwin->w_height + 1) * width; while (endcol > curwin->w_virtcol) endcol -= width; @@ -1151,7 +1151,7 @@ curs_columns( curwin->w_wrow -= curwin->w_skipcol / width; if (curwin->w_wrow >= curwin->w_height) { - /* small window, make sure cursor is in it */ + // small window, make sure cursor is in it extra = curwin->w_wrow - curwin->w_height + 1; curwin->w_skipcol += extra * width; curwin->w_wrow -= extra; @@ -1169,7 +1169,7 @@ curs_columns( redraw_later(NOT_VALID); #ifdef FEAT_SYN_HL - /* Redraw when w_virtcol changes and 'cursorcolumn' is set */ + // Redraw when w_virtcol changes and 'cursorcolumn' is set if (curwin->w_p_cuc && (curwin->w_valid & VALID_VIRTCOL) == 0 && !pum_visible()) redraw_later(SOME_VALID); @@ -1279,19 +1279,19 @@ f_screenpos(typval_T *argvars UNUSED, typval_T *rettv) void scrolldown( long line_count, - int byfold UNUSED) /* TRUE: count a closed fold as one line */ + int byfold UNUSED) // TRUE: count a closed fold as one line { - long done = 0; /* total # of physical lines done */ + long done = 0; // total # of physical lines done int wrow; int moved = FALSE; #ifdef FEAT_FOLDING linenr_T first; - /* Make sure w_topline is at the first of a sequence of folded lines. */ + // Make sure w_topline is at the first of a sequence of folded lines. (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif - validate_cursor(); /* w_wrow needs to be valid */ + validate_cursor(); // w_wrow needs to be valid while (line_count-- > 0) { #ifdef FEAT_DIFF @@ -1311,7 +1311,7 @@ scrolldown( curwin->w_topfill = 0; #endif #ifdef FEAT_FOLDING - /* A sequence of folded lines only counts for one logical line */ + // A sequence of folded lines only counts for one logical line if (hasFolding(curwin->w_topline, &first, NULL)) { ++done; @@ -1324,11 +1324,11 @@ scrolldown( #endif done += PLINES_NOFILL(curwin->w_topline); } - --curwin->w_botline; /* approximate w_botline */ + --curwin->w_botline; // approximate w_botline invalidate_botline(); } - curwin->w_wrow += done; /* keep w_wrow updated */ - curwin->w_cline_row += done; /* keep w_cline_row updated */ + curwin->w_wrow += done; // keep w_wrow updated + curwin->w_cline_row += done; // keep w_cline_row updated #ifdef FEAT_DIFF if (curwin->w_cursor.lnum == curwin->w_topline) @@ -1369,7 +1369,7 @@ scrolldown( if (moved) { #ifdef FEAT_FOLDING - /* Move cursor to first line of closed fold. */ + // Move cursor to first line of closed fold. foldAdjustCursor(); #endif coladvance(curwin->w_curswant); @@ -1382,7 +1382,7 @@ scrolldown( void scrollup( long line_count, - int byfold UNUSED) /* TRUE: count a closed fold as one line */ + int byfold UNUSED) // TRUE: count a closed fold as one line { #if defined(FEAT_FOLDING) || defined(FEAT_DIFF) linenr_T lnum; @@ -1399,7 +1399,7 @@ scrollup( # endif ) { - /* count each sequence of folded lines as one logical line */ + // count each sequence of folded lines as one logical line lnum = curwin->w_topline; while (line_count--) { @@ -1421,7 +1421,7 @@ scrollup( # endif } } - /* approximate w_botline */ + // approximate w_botline curwin->w_botline += lnum - curwin->w_topline; curwin->w_topline = lnum; } @@ -1429,7 +1429,7 @@ scrollup( #endif { curwin->w_topline += line_count; - curwin->w_botline += line_count; /* approximate w_botline */ + curwin->w_botline += line_count; // approximate w_botline } if (curwin->w_topline > curbuf->b_ml.ml_line_count) @@ -1443,7 +1443,7 @@ scrollup( #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) - /* Make sure w_topline is at the first of a sequence of folded lines. */ + // Make sure w_topline is at the first of a sequence of folded lines. (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif @@ -1464,7 +1464,7 @@ scrollup( void check_topfill( win_T *wp, - int down) /* when TRUE scroll down when not enough space */ + int down) // when TRUE scroll down when not enough space { int n; @@ -1529,7 +1529,7 @@ scrolldown_clamp(void) ) return; - validate_cursor(); /* w_wrow needs to be valid */ + validate_cursor(); // w_wrow needs to be valid /* * Compute the row number of the last row of the cursor line @@ -1571,7 +1571,7 @@ scrolldown_clamp(void) #ifdef FEAT_FOLDING (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif - --curwin->w_botline; /* approximate w_botline */ + --curwin->w_botline; // approximate w_botline curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE); } } @@ -1592,7 +1592,7 @@ scrollup_clamp(void) ) return; - validate_cursor(); /* w_wrow needs to be valid */ + validate_cursor(); // w_wrow needs to be valid /* * Compute the row number of the first row of the cursor line @@ -1623,7 +1623,7 @@ scrollup_clamp(void) #endif ++curwin->w_topline; } - ++curwin->w_botline; /* approximate w_botline */ + ++curwin->w_botline; // approximate w_botline curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE); } } @@ -1640,7 +1640,7 @@ topline_back(lineoff_T *lp) #ifdef FEAT_DIFF if (lp->fill < diff_check_fill(curwin, lp->lnum)) { - /* Add a filler line. */ + // Add a filler line. ++lp->fill; lp->height = 1; } @@ -1656,7 +1656,7 @@ topline_back(lineoff_T *lp) else #ifdef FEAT_FOLDING if (hasFolding(lp->lnum, &lp->lnum, NULL)) - /* Add a closed fold */ + // Add a closed fold lp->height = 1; else #endif @@ -1676,7 +1676,7 @@ botline_forw(lineoff_T *lp) #ifdef FEAT_DIFF if (lp->fill < diff_check_fill(curwin, lp->lnum + 1)) { - /* Add a filler line. */ + // Add a filler line. ++lp->fill; lp->height = 1; } @@ -1692,7 +1692,7 @@ botline_forw(lineoff_T *lp) else #ifdef FEAT_FOLDING if (hasFolding(lp->lnum, NULL, &lp->lnum)) - /* Add a closed fold */ + // Add a closed fold lp->height = 1; else #endif @@ -1744,8 +1744,8 @@ scroll_cursor_top(int min_scroll, int always) int extra = 0; int used; int i; - linenr_T top; /* just above displayed lines */ - linenr_T bot; /* just below displayed lines */ + linenr_T top; // just above displayed lines + linenr_T bot; // just below displayed lines linenr_T old_topline = curwin->w_topline; #ifdef FEAT_DIFF linenr_T old_topfill = curwin->w_topfill; @@ -1764,7 +1764,7 @@ scroll_cursor_top(int min_scroll, int always) * - at least 'scrolloff' lines above and below the cursor */ validate_cheight(); - used = curwin->w_cline_height; /* includes filler lines above */ + used = curwin->w_cline_height; // includes filler lines above if (curwin->w_cursor.lnum < curwin->w_topline) scrolled = used; @@ -1783,9 +1783,9 @@ scroll_cursor_top(int min_scroll, int always) new_topline = top + 1; #ifdef FEAT_DIFF - /* "used" already contains the number of filler lines above, don't add it - * again. - * Hide filler lines above cursor line by adding them to "extra". */ + // "used" already contains the number of filler lines above, don't add it + // again. + // Hide filler lines above cursor line by adding them to "extra". extra += diff_check_fill(curwin, curwin->w_cursor.lnum); #endif @@ -1797,7 +1797,7 @@ scroll_cursor_top(int min_scroll, int always) { #ifdef FEAT_FOLDING if (hasFolding(top, &top, NULL)) - /* count one logical line for a sequence of folded lines */ + // count one logical line for a sequence of folded lines i = 1; else #endif @@ -1807,7 +1807,7 @@ scroll_cursor_top(int min_scroll, int always) { #ifdef FEAT_FOLDING if (hasFolding(bot, NULL, &bot)) - /* count one logical line for a sequence of folded lines */ + // count one logical line for a sequence of folded lines ++used; else #endif @@ -1880,7 +1880,7 @@ set_empty_rows(win_T *wp, int used) wp->w_filler_rows = 0; #endif if (used == 0) - wp->w_empty_rows = 0; /* single line that doesn't fit */ + wp->w_empty_rows = 0; // single line that doesn't fit else { wp->w_empty_rows = wp->w_height - used; @@ -1924,7 +1924,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot) linenr_T old_botline = curwin->w_botline; linenr_T old_valid = curwin->w_valid; int old_empty_rows = curwin->w_empty_rows; - linenr_T cln; /* Cursor Line Number */ + linenr_T cln; // Cursor Line Number long so = get_scrolloff_value(); cln = curwin->w_cursor.lnum; @@ -1960,7 +1960,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot) else validate_botline(); - /* The lines of the cursor line itself are always used. */ + // The lines of the cursor line itself are always used. #ifdef FEAT_DIFF used = plines_nofill(cln); #else @@ -1968,9 +1968,9 @@ scroll_cursor_bot(int min_scroll, int set_topbot) used = curwin->w_cline_height; #endif - /* If the cursor is below botline, we will at least scroll by the height - * of the cursor line. Correct for empty lines, which are really part of - * botline. */ + // If the cursor is below botline, we will at least scroll by the height + // of the cursor line. Correct for empty lines, which are really part of + // botline. if (cln >= curwin->w_botline) { scrolled = used; @@ -2001,8 +2001,8 @@ scroll_cursor_bot(int min_scroll, int set_topbot) 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) @@ -2014,7 +2014,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot) ) break; - /* Add one line above */ + // Add one line above topline_back(&loff); if (loff.height == MAXCOL) used = MAXCOL; @@ -2029,7 +2029,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot) #endif ) { - /* Count screen lines that are below the window. */ + // Count screen lines that are below the window. scrolled += loff.height; if (loff.lnum == curwin->w_botline #ifdef FEAT_DIFF @@ -2041,7 +2041,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot) if (boff.lnum < curbuf->b_ml.ml_line_count) { - /* Add one line below */ + // Add one line below botline_forw(&boff); used += boff.height; if (used > curwin->w_height) @@ -2057,7 +2057,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot) #endif ) { - /* Count screen lines that are below the window. */ + // Count screen lines that are below the window. scrolled += boff.height; if (boff.lnum == curwin->w_botline #ifdef FEAT_DIFF @@ -2070,13 +2070,13 @@ scroll_cursor_bot(int min_scroll, int set_topbot) } } - /* curwin->w_empty_rows is larger, no need to scroll */ + // curwin->w_empty_rows is larger, no need to scroll if (scrolled <= 0) line_count = 0; - /* more than a screenfull, don't scroll but redraw */ + // more than a screenfull, don't scroll but redraw else if (used > curwin->w_height) line_count = used; - /* scroll minimal number of lines */ + // scroll minimal number of lines else { line_count = 0; @@ -2090,7 +2090,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot) i += boff.height; ++line_count; } - if (i < scrolled) /* below curwin->w_botline, don't scroll */ + if (i < scrolled) // below curwin->w_botline, don't scroll line_count = 9999; } @@ -2151,7 +2151,7 @@ scroll_cursor_halfway(int atend) topline = loff.lnum; while (topline > 1) { - if (below <= above) /* add a line below the cursor first */ + if (below <= above) // add a line below the cursor first { if (boff.lnum < curbuf->b_ml.ml_line_count) { @@ -2163,13 +2163,13 @@ scroll_cursor_halfway(int atend) } else { - ++below; /* count a "~" line */ + ++below; // count a "~" line if (atend) ++used; } } - if (below > above) /* add a line above the cursor */ + if (below > above) // add a line above the cursor { topline_back(&loff); if (loff.height == MAXCOL) @@ -2208,12 +2208,12 @@ scroll_cursor_halfway(int atend) void cursor_correct(void) { - int above = 0; /* screen lines above topline */ + int above = 0; // screen lines above topline linenr_T topline; - int below = 0; /* screen lines below botline */ + int below = 0; // screen lines below botline linenr_T botline; int above_wanted, below_wanted; - linenr_T cln; /* Cursor Line Number */ + linenr_T cln; // Cursor Line Number int max_off; long so = get_scrolloff_value(); @@ -2267,7 +2267,7 @@ cursor_correct(void) topline = curwin->w_topline; botline = curwin->w_botline - 1; #ifdef FEAT_DIFF - /* count filler lines as context */ + // count filler lines as context above = curwin->w_topfill; below = curwin->w_filler_rows; #endif @@ -2292,7 +2292,7 @@ cursor_correct(void) #endif above += PLINES_NOFILL(topline); #ifdef FEAT_DIFF - /* Count filler lines below this line as context. */ + // Count filler lines below this line as context. if (topline < botline) above += diff_check_fill(curwin, topline + 1); #endif @@ -2337,7 +2337,7 @@ onepage(int dir, long count) linenr_T old_topline = curwin->w_topline; long so = get_scrolloff_value(); - if (curbuf->b_ml.ml_line_count == 1) /* nothing to do */ + if (curbuf->b_ml.ml_line_count == 1) // nothing to do { beep_flush(); return FAIL; @@ -2374,7 +2374,7 @@ onepage(int dir, long count) { if (ONE_WINDOW && p_window > 0 && p_window < Rows - 1) { - /* Vi compatible scrolling */ + // Vi compatible scrolling if (p_window <= 2) ++curwin->w_topline; else @@ -2385,7 +2385,7 @@ onepage(int dir, long count) } else if (curwin->w_botline > curbuf->b_ml.ml_line_count) { - /* at end of file */ + // at end of file curwin->w_topline = curbuf->b_ml.ml_line_count; #ifdef FEAT_DIFF curwin->w_topfill = 0; @@ -2394,8 +2394,8 @@ onepage(int dir, long count) } 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; #ifdef FEAT_DIFF loff.fill = diff_check_fill(curwin, loff.lnum) @@ -2412,19 +2412,19 @@ onepage(int dir, long count) VALID_CROW|VALID_BOTLINE|VALID_BOTLINE_AP); } } - else /* dir == BACKWARDS */ + else // dir == BACKWARDS { #ifdef FEAT_DIFF if (curwin->w_topline == 1) { - /* Include max number of filler lines */ + // Include max number of filler lines max_topfill(); continue; } #endif if (ONE_WINDOW && p_window > 0 && p_window < Rows - 1) { - /* Vi compatible scrolling (sort of) */ + // Vi compatible scrolling (sort of) if (p_window <= 2) --curwin->w_topline; else @@ -2437,9 +2437,9 @@ onepage(int 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; #ifdef FEAT_DIFF loff.fill = diff_check_fill(curwin, loff.lnum + 1) @@ -2460,8 +2460,8 @@ onepage(int 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 && loff.lnum >= 1) { @@ -2471,7 +2471,7 @@ onepage(int dir, long count) else n += loff.height; } - if (loff.lnum < 1) /* at begin of file */ + if (loff.lnum < 1) // at begin of file { curwin->w_topline = 1; #ifdef FEAT_DIFF @@ -2481,7 +2481,7 @@ onepage(int dir, long count) } else { - /* Go two lines forward again. */ + // Go two lines forward again. #ifdef FEAT_DIFF topline_botline(&loff); #endif @@ -2491,12 +2491,12 @@ onepage(int dir, long count) botline_topline(&loff); #endif #ifdef FEAT_FOLDING - /* We're at the wrong end of a fold now. */ + // We're at the wrong end of a fold now. (void)hasFolding(loff.lnum, &loff.lnum, NULL); #endif - /* 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 #ifdef FEAT_DIFF && (loff.lnum > curwin->w_topline @@ -2505,8 +2505,8 @@ onepage(int dir, long count) ) { #ifdef FEAT_DIFF - /* 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 < diff_check_fill(curwin, curwin->w_topline)) @@ -2601,7 +2601,7 @@ get_scroll_overlap(lineoff_T *lp, int dir) #endif h1 = lp->height; if (h1 > min_height) - return; /* no overlap */ + return; // no overlap loff0 = *lp; if (dir > 0) @@ -2611,7 +2611,7 @@ get_scroll_overlap(lineoff_T *lp, int dir) h2 = lp->height; if (h2 == MAXCOL || h2 + h1 > min_height) { - *lp = loff0; /* no overlap */ + *lp = loff0; // no overlap return; } @@ -2623,7 +2623,7 @@ get_scroll_overlap(lineoff_T *lp, int dir) h3 = lp->height; if (h3 == MAXCOL || h3 + h2 > min_height) { - *lp = loff0; /* no overlap */ + *lp = loff0; // no overlap return; } @@ -2634,9 +2634,9 @@ get_scroll_overlap(lineoff_T *lp, int dir) topline_back(lp); h4 = lp->height; if (h4 == MAXCOL || h4 + h3 + h2 > min_height || h3 + h2 + h1 > min_height) - *lp = loff1; /* 1 line overlap */ + *lp = loff1; // 1 line overlap else - *lp = loff2; /* 2 lines overlap */ + *lp = loff2; // 2 lines overlap return; } @@ -2814,7 +2814,7 @@ halfpage(int flag, linenr_T Prenum) } } # ifdef FEAT_FOLDING - /* Move cursor to first line of closed fold. */ + // Move cursor to first line of closed fold. foldAdjustCursor(); # endif #ifdef FEAT_DIFF @@ -2846,7 +2846,7 @@ do_check_cursorbind(void) 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_crb) { # ifdef FEAT_DIFF @@ -2861,8 +2861,8 @@ 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. restart_edit_save = restart_edit; restart_edit = TRUE; check_cursor(); @@ -2871,12 +2871,12 @@ do_check_cursorbind(void) validate_cursor(); # endif restart_edit = restart_edit_save; - /* Correct cursor for multi-byte character. */ + // Correct cursor for multi-byte character. if (has_mbyte) mb_adjust_cursor(); redraw_later(VALID); - /* Only scroll when 'scrollbind' hasn't done this. */ + // Only scroll when 'scrollbind' hasn't done this. if (!curwin->w_p_scb) update_topline(); curwin->w_redr_status = TRUE; |