0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.1543: display errors when making topline shorter

Problem:    Display errors when making topline shorter and 'smoothscroll' is
            set.
Solution:   Reset w_skipcol when the topline becomes shorter than its current
            value. (Luuk van Baal, closes #12367)
This commit is contained in:
Luuk van Baal
2023-05-11 19:24:20 +01:00
committed by Bram Moolenaar
parent 6c018680be
commit 5d01f86d99
10 changed files with 77 additions and 14 deletions

View File

@@ -553,13 +553,25 @@ changed_common(
{
if (wp->w_buffer == curbuf)
{
#ifdef FEAT_FOLDING
linenr_T last = lnume + xtra - 1; // last line after the change
#endif
// Mark this window to be redrawn later.
if (!redraw_not_allowed && wp->w_redr_type < UPD_VALID)
wp->w_redr_type = UPD_VALID;
// Reset "w_skipcol" if the topline length has become smaller to
// such a degree that nothing will be visible anymore, accounting
// for 'smoothscroll' <<< or 'listchars' "precedes" marker.
if (wp->w_skipcol > 0
&& (last < wp->w_topline
|| (wp->w_topline >= lnum
&& wp->w_topline < lnume
&& win_linetabsize(wp, wp->w_topline,
ml_get(wp->w_topline), (colnr_T)MAXCOL)
<= wp->w_skipcol + (wp->w_p_list
&& wp->w_lcs_chars.prec ? 1 : 3))))
wp->w_skipcol = 0;
// Check if a change in the buffer has invalidated the cached
// values for the cursor.
#ifdef FEAT_FOLDING