diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-05-11 20:37:49 +0200 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2023-05-11 20:57:36 +0200 |
commit | 6f41eaa2b5abd5c252428ba278a9fcc356e48c1d (patch) | |
tree | e27c37ae930a98e0c4714e8dfbc62e392f9d40bc /src/nvim/change.c | |
parent | 15c684b358b0165d0874ba08ab6ac0976c86cc0f (diff) | |
download | rneovim-6f41eaa2b5abd5c252428ba278a9fcc356e48c1d.tar.gz rneovim-6f41eaa2b5abd5c252428ba278a9fcc356e48c1d.tar.bz2 rneovim-6f41eaa2b5abd5c252428ba278a9fcc356e48c1d.zip |
vim-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 vim/vim#12367)
https://github.com/vim/vim/commit/5d01f86d99bc3a3fd92d4f4e9338a9e78e9ebe16
Diffstat (limited to 'src/nvim/change.c')
-rw-r--r-- | src/nvim/change.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index 1d6869990e..a9e7126afc 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -247,11 +247,24 @@ static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume, linenr_T wp->w_redr_type = UPD_VALID; } + linenr_T last = lnume + xtra - 1; // last line after the change + + // 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) + <= (unsigned)wp->w_skipcol + (wp->w_p_list && wp->w_p_lcs_chars.prec ? 1 : 3)))) { + wp->w_skipcol = 0; + } + // Check if a change in the buffer has invalidated the cached // values for the cursor. // Update the folds for this window. Can't postpone this, because // a following operator might work on the whole fold: ">>dd". - linenr_T last = lnume + xtra - 1; // last line after the change foldUpdate(wp, lnum, last); // The change may cause lines above or below the change to become |