mirror of
https://github.com/vim/vim.git
synced 2025-11-16 23:24:03 -05:00
patch 9.1.1888: Wrong display with cpo+=$, matchparen and wrapped line
Problem: Wrong display with cpo+=$, matchparen and wrapped line.
Solution: Use old cursor line height when scrolling with cpo+=$. Also
fix wrong redraw in non-current window. (zeertzjq)
fixes: #18647
closes: #18662
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
14e7203713
commit
5c3e762631
@@ -2280,13 +2280,12 @@ win_update(win_T *wp)
|
||||
// When at start of changed lines: May scroll following lines
|
||||
// up or down to minimize redrawing.
|
||||
// Don't do this when the change continues until the end.
|
||||
// Don't scroll when dollar_vcol >= 0, keep the "$".
|
||||
// Don't scroll when redrawing the top, scrolled already above.
|
||||
if (lnum == mod_top
|
||||
&& mod_bot != MAXLNUM
|
||||
&& !(dollar_vcol >= 0 && mod_bot == mod_top + 1)
|
||||
&& row >= top_end)
|
||||
{
|
||||
int old_cline_height = 0;
|
||||
int old_rows = 0;
|
||||
int new_rows = 0;
|
||||
int xtra_rows;
|
||||
@@ -2302,6 +2301,8 @@ win_update(win_T *wp)
|
||||
if (wp->w_lines[i].wl_valid
|
||||
&& wp->w_lines[i].wl_lnum == mod_bot)
|
||||
break;
|
||||
if (wp->w_lines[i].wl_lnum == wp->w_cursor.lnum)
|
||||
old_cline_height = wp->w_lines[i].wl_size;
|
||||
old_rows += wp->w_lines[i].wl_size;
|
||||
#ifdef FEAT_FOLDING
|
||||
if (wp->w_lines[i].wl_valid
|
||||
@@ -2332,11 +2333,16 @@ win_update(win_T *wp)
|
||||
j = idx;
|
||||
for (l = lnum; l < mod_bot; ++l)
|
||||
{
|
||||
if (dollar_vcol >= 0 && wp == curwin &&
|
||||
old_cline_height > 0 && l == wp->w_cursor.lnum)
|
||||
// When dollar_vcol >= 0, cursor line isn't fully
|
||||
// redrawn, and its height remains unchanged.
|
||||
new_rows += old_cline_height;
|
||||
#ifdef FEAT_FOLDING
|
||||
if (hasFoldingWin(wp, l, NULL, &l, TRUE, NULL))
|
||||
else if (hasFoldingWin(wp, l, NULL, &l, TRUE, NULL))
|
||||
++new_rows;
|
||||
else
|
||||
#endif
|
||||
else
|
||||
new_rows += plines_correct_topline(wp, l, TRUE);
|
||||
++j;
|
||||
if (new_rows > wp->w_height - row - 2)
|
||||
@@ -2504,18 +2510,20 @@ win_update(win_T *wp)
|
||||
wp->w_lines[idx].wl_lnum = lnum;
|
||||
wp->w_lines[idx].wl_valid = TRUE;
|
||||
|
||||
int is_curline = wp == curwin && lnum == wp->w_cursor.lnum;
|
||||
|
||||
// Past end of the window or end of the screen. Note that after
|
||||
// resizing wp->w_height may be end up too big. That's a problem
|
||||
// elsewhere, but prevent a crash here.
|
||||
if (row > wp->w_height || row + wp->w_winrow >= Rows)
|
||||
{
|
||||
// we may need the size of that too long line later on
|
||||
if (dollar_vcol == -1)
|
||||
if (dollar_vcol == -1 || !is_curline)
|
||||
wp->w_lines[idx].wl_size = plines_win(wp, lnum, TRUE);
|
||||
++idx;
|
||||
break;
|
||||
}
|
||||
if (dollar_vcol == -1)
|
||||
if (dollar_vcol == -1 || !is_curline)
|
||||
wp->w_lines[idx].wl_size = row - srow;
|
||||
++idx;
|
||||
#ifdef FEAT_FOLDING
|
||||
@@ -2706,7 +2714,7 @@ win_update(win_T *wp)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (dollar_vcol == -1)
|
||||
else if (dollar_vcol == -1 || wp != curwin)
|
||||
wp->w_botline = lnum;
|
||||
|
||||
// Make sure the rest of the screen is blank.
|
||||
@@ -2731,7 +2739,7 @@ win_update(win_T *wp)
|
||||
wp->w_old_botfill = wp->w_botfill;
|
||||
#endif
|
||||
|
||||
if (dollar_vcol == -1)
|
||||
if (dollar_vcol == -1 || wp != curwin)
|
||||
{
|
||||
// There is a trick with w_botline. If we invalidate it on each
|
||||
// change that might modify it, this will cause a lot of expensive
|
||||
|
||||
Reference in New Issue
Block a user