From 3a1973debceca29e65c4f7c83d025cb3314ebaf2 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 17:08:35 +0200 Subject: vim-patch:9.0.0672: line partly shows with 'smoothscroll' and 'scrolloff' zero Problem: Cursor line only partly shows with 'smoothscroll' and 'scrolloff' zero. Solution: Do not use 'smoothscroll' when adjusting the bottom of the window. (closes vim/vim#11269) https://github.com/vim/vim/commit/9bab7a024393200bb2c03b3abddfda86436990a7 Co-authored-by: Bram Moolenaar --- src/nvim/move.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/nvim/move.c b/src/nvim/move.c index 5e85768865..0a91b12255 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -1627,6 +1627,7 @@ void scroll_cursor_bot(int min_scroll, int set_topbot) { int used; int scrolled = 0; + int min_scrolled = 1; int extra = 0; lineoff_T loff; lineoff_T boff; @@ -1676,6 +1677,12 @@ void scroll_cursor_bot(int min_scroll, int set_topbot) if (cln == curwin->w_botline) { scrolled -= curwin->w_empty_rows; } + min_scrolled = scrolled; + if (cln > curwin->w_botline && curwin->w_p_sms && curwin->w_p_wrap) { + for (linenr_T lnum = curwin->w_botline + 1; lnum <= cln; lnum++) { + min_scrolled += plines_win_nofill(curwin, lnum, true); + } + } } // Stop counting lines to scroll when @@ -1777,6 +1784,10 @@ void scroll_cursor_bot(int min_scroll, int set_topbot) if (line_count >= curwin->w_height_inner && line_count > min_scroll) { scroll_cursor_halfway(false, true); } else { + // With 'smoothscroll' scroll at least the height of the cursor line. + if (curwin->w_p_wrap && curwin->w_p_sms && line_count < min_scrolled) { + line_count = min_scrolled; + } scrollup(line_count, true); } -- cgit