From 36c98b47a3526dc61d149f951f8b8e3a677c26eb Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 22:15:25 +0200 Subject: vim-patch:9.0.0707: with 'smoothscroll' cursor position not adjusted in long line Problem: With 'smoothscroll' and 'scrolloff' non-zero the cursor position is not properly adjusted in a long line. Solution: Move the cursor further up or down in the line. https://github.com/vim/vim/commit/118c235112854f34182d968613d7fe98be3b290b Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 42 ++++++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 22 ++++++++++++++++ 2 files changed, 64 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 5c7c9cd55a..be7d324908 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -395,5 +395,47 @@ describe('smoothscroll', function() f text wi^th lots of text with lots of te| | ]]) + -- 'scrolloff' set to 1, scrolling up, cursor moves screen line down + exec('set scrolloff=1') + feed('10|') + screen:expect([[ + <<gjgj') + screen:expect([[ + <<') + screen:expect([[ + <<gjgj') + screen:expect([[ + <<") call VerifyScreenDump(buf, 'Test_smooth_long_5', {}) + " 'scrolloff' set to 1, scrolling up, cursor moves screen line down + call term_sendkeys(buf, ":set scrolloff=1\") + call term_sendkeys(buf, "10|\") + call VerifyScreenDump(buf, 'Test_smooth_long_6', {}) + + " 'scrolloff' set to 1, scrolling down, cursor moves screen line up + call term_sendkeys(buf, "\") + call term_sendkeys(buf, "gjgj") + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_long_7', {}) + + " 'scrolloff' set to 2, scrolling up, cursor moves screen line down + call term_sendkeys(buf, ":set scrolloff=2\") + call term_sendkeys(buf, "10|\") + call VerifyScreenDump(buf, 'Test_smooth_long_8', {}) + + " 'scrolloff' set to 2, scrolling down, cursor moves screen line up + call term_sendkeys(buf, "\") + call term_sendkeys(buf, "gj") + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_long_9', {}) + call StopVimInTerminal(buf) endfunc -- cgit