From 9deef1aa227717a2c73ab1d4ad2c883d9b3c2f24 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Jun 2023 07:13:08 +0800 Subject: vim-patch:9.0.1612: "skipcol" not reset when using multi-byte characters (#23928) Problem: "skipcol" not reset when using multi-byte characters. Solution: Compare with w_virtcol instead of w_cursor.col. (closes vim/vim#12457) https://github.com/vim/vim/commit/15d4747ffd197ffa5b5a41a852a1fe93b6cc35fd Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 18 ++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 15 +++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index a5a6aded79..3b755ff3e8 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -174,6 +174,24 @@ describe('smoothscroll', function() screen:expect(s8) end) + -- oldtest: Test_smoothscroll_multibyte() + it('works with multibyte characters', function() + screen:try_resize(40, 6) + exec([[ + set scrolloff=0 smoothscroll + call setline(1, [repeat('ϛ', 45), repeat('2', 36)]) + exe "normal G35l\k" + ]]) + screen:expect([[ + ϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛ^ϛϛϛϛϛ| + ϛϛϛϛϛ | + 222222222222222222222222222222222222 | + ~ | + ~ | + | + ]]) + end) + -- oldtest: Test_smoothscroll_number() it("works 'number' and 'cpo'+=n", function() exec([[ diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index f9f33b20eb..d7be074168 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -124,6 +124,21 @@ func Test_smoothscroll_CtrlE_CtrlY() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_multibyte() + CheckScreendump + + let lines =<< trim END + set scrolloff=0 smoothscroll + call setline(1, [repeat('ϛ', 45), repeat('2', 36)]) + exe "normal G35l\k" + END + call writefile(lines, 'XSmoothMultibyte', 'D') + let buf = RunVimInTerminal('-S XSmoothMultibyte', #{rows: 6, cols: 40}) + call VerifyScreenDump(buf, 'Test_smoothscroll_multi_1', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_smoothscroll_number() CheckScreendump -- cgit