mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor(plines): remove implicit curwin plines_nofill() function
This commit is contained in:
parent
a177c7df09
commit
0465341e16
@ -1055,8 +1055,9 @@ bool scrolldown(long line_count, int byfold)
|
|||||||
line_count -= curwin->w_topline - first - 1;
|
line_count -= curwin->w_topline - first - 1;
|
||||||
curwin->w_botline -= curwin->w_topline - first;
|
curwin->w_botline -= curwin->w_topline - first;
|
||||||
curwin->w_topline = first;
|
curwin->w_topline = first;
|
||||||
} else
|
} else {
|
||||||
done += plines_nofill(curwin->w_topline);
|
done += plines_win_nofill(curwin, curwin->w_topline, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
--curwin->w_botline; /* approximate w_botline */
|
--curwin->w_botline; /* approximate w_botline */
|
||||||
invalidate_botline();
|
invalidate_botline();
|
||||||
@ -1195,7 +1196,7 @@ check_topfill (
|
|||||||
*/
|
*/
|
||||||
static void max_topfill(void)
|
static void max_topfill(void)
|
||||||
{
|
{
|
||||||
int n = plines_nofill(curwin->w_topline);
|
int n = plines_win_nofill(curwin, curwin->w_topline, true);
|
||||||
if (n >= curwin->w_height_inner) {
|
if (n >= curwin->w_height_inner) {
|
||||||
curwin->w_topfill = 0;
|
curwin->w_topfill = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -1222,19 +1223,16 @@ void scrolldown_clamp(void)
|
|||||||
|
|
||||||
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
|
||||||
* Compute the row number of the last row of the cursor line
|
// and make sure it doesn't go off the screen. Make sure the cursor
|
||||||
* and make sure it doesn't go off the screen. Make sure the cursor
|
// doesn't go past 'scrolloff' lines from the screen end.
|
||||||
* doesn't go past 'scrolloff' lines from the screen end.
|
|
||||||
*/
|
|
||||||
int end_row = curwin->w_wrow;
|
int end_row = curwin->w_wrow;
|
||||||
if (can_fill)
|
if (can_fill) {
|
||||||
++end_row;
|
end_row++;
|
||||||
else
|
} else {
|
||||||
end_row += plines_nofill(curwin->w_topline - 1);
|
end_row += plines_win_nofill(curwin, curwin->w_topline - 1, true);
|
||||||
if (curwin->w_p_wrap
|
}
|
||||||
&& curwin->w_width_inner != 0
|
if (curwin->w_p_wrap && curwin->w_width_inner != 0) {
|
||||||
) {
|
|
||||||
validate_cheight();
|
validate_cheight();
|
||||||
validate_virtcol();
|
validate_virtcol();
|
||||||
end_row += curwin->w_cline_height - 1 -
|
end_row += curwin->w_cline_height - 1 -
|
||||||
@ -1267,16 +1265,13 @@ void scrollup_clamp(void)
|
|||||||
|
|
||||||
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
|
||||||
* Compute the row number of the first row of the cursor line
|
// and make sure it doesn't go off the screen. Make sure the cursor
|
||||||
* and make sure it doesn't go off the screen. Make sure the cursor
|
// doesn't go before 'scrolloff' lines from the screen start.
|
||||||
* doesn't go before 'scrolloff' lines from the screen start.
|
int start_row = (curwin->w_wrow
|
||||||
*/
|
- plines_win_nofill(curwin, curwin->w_topline, true)
|
||||||
int start_row = curwin->w_wrow - plines_nofill(curwin->w_topline)
|
- curwin->w_topfill);
|
||||||
- curwin->w_topfill;
|
if (curwin->w_p_wrap && curwin->w_width_inner != 0) {
|
||||||
if (curwin->w_p_wrap
|
|
||||||
&& curwin->w_width_inner != 0
|
|
||||||
) {
|
|
||||||
validate_virtcol();
|
validate_virtcol();
|
||||||
start_row -= curwin->w_virtcol / curwin->w_width_inner;
|
start_row -= curwin->w_virtcol / curwin->w_width_inner;
|
||||||
}
|
}
|
||||||
@ -1423,7 +1418,7 @@ void scroll_cursor_top(int min_scroll, int always)
|
|||||||
while (top > 0) {
|
while (top > 0) {
|
||||||
int i = hasFolding(top, &top, NULL)
|
int i = hasFolding(top, &top, NULL)
|
||||||
? 1 // count one logical line for a sequence of folded lines
|
? 1 // count one logical line for a sequence of folded lines
|
||||||
: plines_nofill(top);
|
: plines_win_nofill(curwin, top, true);
|
||||||
used += i;
|
used += i;
|
||||||
if (extra + i <= off && bot < curbuf->b_ml.ml_line_count) {
|
if (extra + i <= off && bot < curbuf->b_ml.ml_line_count) {
|
||||||
if (hasFolding(bot, NULL, &bot)) {
|
if (hasFolding(bot, NULL, &bot)) {
|
||||||
@ -1557,12 +1552,12 @@ void scroll_cursor_bot(int min_scroll, int set_topbot)
|
|||||||
validate_botline(curwin);
|
validate_botline(curwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The lines of the cursor line itself are always used. */
|
// The lines of the cursor line itself are always used.
|
||||||
used = plines_nofill(cln);
|
used = plines_win_nofill(curwin, cln, true);
|
||||||
|
|
||||||
/* If the cursor is below botline, we will at least scroll by the height
|
// 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
|
// of the cursor line. Correct for empty lines, which are really part of
|
||||||
* botline. */
|
// botline.
|
||||||
if (cln >= curwin->w_botline) {
|
if (cln >= curwin->w_botline) {
|
||||||
scrolled = used;
|
scrolled = used;
|
||||||
if (cln == curwin->w_botline)
|
if (cln == curwin->w_botline)
|
||||||
@ -1706,7 +1701,7 @@ void scroll_cursor_halfway(int atend)
|
|||||||
|
|
||||||
loff.lnum = boff.lnum = curwin->w_cursor.lnum;
|
loff.lnum = boff.lnum = curwin->w_cursor.lnum;
|
||||||
(void)hasFolding(loff.lnum, &loff.lnum, &boff.lnum);
|
(void)hasFolding(loff.lnum, &loff.lnum, &boff.lnum);
|
||||||
int used = plines_nofill(loff.lnum);
|
int used = plines_win_nofill(curwin, loff.lnum, true);
|
||||||
loff.fill = 0;
|
loff.fill = 0;
|
||||||
boff.fill = 0;
|
boff.fill = 0;
|
||||||
linenr_T topline = loff.lnum;
|
linenr_T topline = loff.lnum;
|
||||||
@ -1819,10 +1814,11 @@ void cursor_correct(void)
|
|||||||
botline--;
|
botline--;
|
||||||
}
|
}
|
||||||
if (above < above_wanted && (above < below || below >= below_wanted)) {
|
if (above < above_wanted && (above < below || below >= below_wanted)) {
|
||||||
if (hasFolding(topline, NULL, &topline))
|
if (hasFolding(topline, NULL, &topline)) {
|
||||||
++above;
|
above++;
|
||||||
else
|
} else {
|
||||||
above += plines_nofill(topline);
|
above += plines_win_nofill(curwin, topline, true);
|
||||||
|
}
|
||||||
|
|
||||||
/* Count filler lines below this line as context. */
|
/* Count filler lines below this line as context. */
|
||||||
if (topline < botline)
|
if (topline < botline)
|
||||||
@ -2050,10 +2046,11 @@ static void get_scroll_overlap(lineoff_T *lp, int dir)
|
|||||||
{
|
{
|
||||||
int min_height = curwin->w_height_inner - 2;
|
int min_height = curwin->w_height_inner - 2;
|
||||||
|
|
||||||
if (lp->fill > 0)
|
if (lp->fill > 0) {
|
||||||
lp->height = 1;
|
lp->height = 1;
|
||||||
else
|
} else {
|
||||||
lp->height = plines_nofill(lp->lnum);
|
lp->height = plines_win_nofill(curwin, lp->lnum, true);
|
||||||
|
}
|
||||||
int h1 = lp->height;
|
int h1 = lp->height;
|
||||||
if (h1 > min_height)
|
if (h1 > min_height)
|
||||||
return; /* no overlap */
|
return; /* no overlap */
|
||||||
@ -2123,7 +2120,7 @@ void halfpage(bool flag, linenr_T Prenum)
|
|||||||
n--;
|
n--;
|
||||||
curwin->w_topfill--;
|
curwin->w_topfill--;
|
||||||
} else {
|
} else {
|
||||||
i = plines_nofill(curwin->w_topline);
|
i = plines_win_nofill(curwin, curwin->w_topline, true);
|
||||||
n -= i;
|
n -= i;
|
||||||
if (n < 0 && scrolled > 0)
|
if (n < 0 && scrolled > 0)
|
||||||
break;
|
break;
|
||||||
@ -2183,7 +2180,7 @@ void halfpage(bool flag, linenr_T Prenum)
|
|||||||
n--;
|
n--;
|
||||||
curwin->w_topfill++;
|
curwin->w_topfill++;
|
||||||
} else {
|
} else {
|
||||||
i = plines_nofill(curwin->w_topline - 1);
|
i = plines_win_nofill(curwin, curwin->w_topline - 1, true);
|
||||||
n -= i;
|
n -= i;
|
||||||
if (n < 0 && scrolled > 0)
|
if (n < 0 && scrolled > 0)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user