summaryrefslogtreecommitdiffstats
path: root/src/change.c
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2023-05-11 19:24:20 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-11 19:24:20 +0100
commit5d01f86d99bc3a3fd92d4f4e9338a9e78e9ebe16 (patch)
tree682e4a5b8cab3daa29246001be274c1737b99377 /src/change.c
parent6c018680be0ec25d42614a93be1ea08df29a9e2a (diff)
patch 9.0.1543: display errors when making topline shorterv9.0.1543
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)
Diffstat (limited to 'src/change.c')
-rw-r--r--src/change.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/change.c b/src/change.c
index e5798c54a4..8bb61ed148 100644
--- a/src/change.c
+++ b/src/change.c
@@ -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