diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-12 07:24:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 07:24:13 +0800 |
commit | d6e898b44fbd6b18b3ca23f780ffaedc343961f1 (patch) | |
tree | c72abf5286e3c89e6889c89cf3500e9008bda678 /src/nvim/change.c | |
parent | 30a0299bc6d1ceedd04d897cf56b298dd3ded0cd (diff) | |
parent | 6f41eaa2b5abd5c252428ba278a9fcc356e48c1d (diff) | |
download | rneovim-d6e898b44fbd6b18b3ca23f780ffaedc343961f1.tar.gz rneovim-d6e898b44fbd6b18b3ca23f780ffaedc343961f1.tar.bz2 rneovim-d6e898b44fbd6b18b3ca23f780ffaedc343961f1.zip |
Merge pull request #23558 from luukvbaal/smoothscroll
vim-patch:9.0.{1530,1533,1542,1543}
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 |