aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2024-05-16 21:31:10 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2024-05-17 20:28:14 +0200
commitf178b8ba4963345879c3a1291ab81805d17c2e0e (patch)
tree10758be1c958f804c20ddd67ef3e407b5de09104 /src
parent50749f8df89d7a74ea17d51b28e737e043ac6c51 (diff)
downloadrneovim-f178b8ba4963345879c3a1291ab81805d17c2e0e.tar.gz
rneovim-f178b8ba4963345879c3a1291ab81805d17c2e0e.tar.bz2
rneovim-f178b8ba4963345879c3a1291ab81805d17c2e0e.zip
vim-patch:9.1.0414: Unable to leave long line with 'smoothscroll' and 'scrolloff'
Problem: Unable to leave long line with 'smoothscroll' and 'scrolloff'. Corrupted screen near the end of a long line with 'scrolloff'. (Ernie Rael, after 9.1.0280) Solution: Only correct cursor in case scroll_cursor_bot() was not itself called to make the cursor visible. Avoid adjusting for 'scrolloff' beyond the text line height (Luuk van Baal) https://github.com/vim/vim/commit/b32055e504ebd4f6183a93b92b08d61dad61c841 vim-patch:9.1.0416: some screen dump tests can be improved Problem: some screen dump tests can be improved (after 9.1.0414) Solution: Make sure screen state changes properly and is captured in the screen dumps (Luuk van Baal) https://github.com/vim/vim/commit/2e642734f4be506483315b8881748a7ef45854f4
Diffstat (limited to 'src')
-rw-r--r--src/nvim/move.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c
index ef4346da76..074eb0354c 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -1579,8 +1579,20 @@ void adjust_skipcol(void)
redraw_later(curwin, UPD_NOT_VALID);
return; // don't scroll in the other direction now
}
- colnr_T col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols;
int row = 0;
+ colnr_T col = curwin->w_virtcol + scrolloff_cols;
+
+ // Avoid adjusting for 'scrolloff' beyond the text line height.
+ if (scrolloff_cols > 0) {
+ int size = win_linetabsize(curwin, curwin->w_topline,
+ ml_get(curwin->w_topline), (colnr_T)MAXCOL);
+ size = width1 + width2 * ((size - width1 + width2 - 1) / width2);
+ while (col > size) {
+ col -= width2;
+ }
+ }
+ col -= curwin->w_skipcol;
+
if (col >= width1) {
col -= width1;
row++;
@@ -2114,7 +2126,10 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
wp->w_valid |= VALID_TOPLINE;
wp->w_viewport_invalid = true;
- cursor_correct_sms(wp);
+ // Make sure cursor is still visible after adjusting skipcol for "zb".
+ if (set_topbot) {
+ cursor_correct_sms(wp);
+ }
}
/// Recompute topline to put the cursor halfway across the window