From be11f80d018797b514ed7d01cde2e4c8f88cc8d2 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 01:55:00 +0200 Subject: vim-patch:9.0.0640: cannot scroll by screen line if a line wraps Problem: Cannot scroll by screen line if a line wraps. Solution: Add the 'smoothscroll' option. Only works for CTRL-E and CTRL-Y so far. https://github.com/vim/vim/commit/f6196f424474e2a9c160f2a995fc2691f82b58f9 vim-patch:9.0.0641: missing part of the new option code Problem: Missing part of the new option code. Solution: Add missing WV_SMS. https://github.com/vim/vim/commit/bbbda8fd81f6d720962b67ae885825bad9be4456 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 111 +++++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 48 ++++++++++++- 2 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 test/functional/legacy/scroll_opt_spec.lua (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua new file mode 100644 index 0000000000..0d0e9640a7 --- /dev/null +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -0,0 +1,111 @@ +local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') +local clear = helpers.clear +local exec = helpers.exec +local feed = helpers.feed + +before_each(clear) + +describe('smoothscroll', function() + local screen + + before_each(function() + screen = Screen.new(40, 12) + screen:attach() + end) + + -- oldtest: Test_smoothscroll_CtrlE_CtrlY() + it('works with and ', function() + exec([[ + call setline(1, [ 'line one', 'word '->repeat(20), 'line three', 'long word '->repeat(7), 'line', 'line', 'line', ]) + set smoothscroll + :5 + ]]) + local s0 = [[ + line one | + word word word word word word word word | + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | + ^line | + line | + line | + ~ | + | + ]] + local s1 = [[ + word word word word word word word word | + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | + ^line | + line | + line | + ~ | + ~ | + | + ]] + local s2 = [[ + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | + ^line | + line | + line | + ~ | + ~ | + ~ | + | + ]] + local s3 = [[ + word word word word | + line three | + long word long word long word long word | + long word long word long word | + ^line | + line | + line | + ~ | + ~ | + ~ | + ~ | + | + ]] + local s4 = [[ + line three | + long word long word long word long word | + long word long word long word | + ^line | + line | + line | + ~ | + ~ | + ~ | + ~ | + ~ | + | + ]] + feed('') + screen:expect(s1) + feed('') + screen:expect(s2) + feed('') + screen:expect(s3) + feed('') + screen:expect(s4) + feed('') + screen:expect(s3) + feed('') + screen:expect(s2) + feed('') + screen:expect(s1) + feed('') + screen:expect(s0) + end) +end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 64f4ced470..9375d4ad63 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -1,4 +1,7 @@ -" Test for reset 'scroll' +" Test for reset 'scroll' and 'smoothscroll' + +source check.vim +source screendump.vim func Test_reset_scroll() let scr = &l:scroll @@ -51,4 +54,47 @@ func Test_scolloff_even_line_count() bwipe! endfunc +func Test_smoothscroll_CtrlE_CtrlY() + CheckScreendump + + let lines =<< trim END + vim9script + setline(1, [ + 'line one', + 'word '->repeat(20), + 'line three', + 'long word '->repeat(7), + 'line', + 'line', + 'line', + ]) + set smoothscroll + :5 + END + call writefile(lines, 'XSmoothScroll', 'D') + let buf = RunVimInTerminal('-S XSmoothScroll', #{rows: 12, cols: 40}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_2', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_3', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_4', {}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_5', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_6', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_7', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_8', {}) + + call StopVimInTerminal(buf) +endfunc + + + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 9128fc79f0630e0d1e5bedf9bd32417ecd42c4f5 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 03:57:23 +0200 Subject: vim-patch:9.0.0644: 'smoothscroll' is not copied to a new window on :split Problem: 'smoothscroll' is not copied to a new window on :split. Solution: Copy the option value. Add a test. https://github.com/vim/vim/commit/b1fd26d208aadc96d3e8b9215f761150f40a9f91 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_options.vim | 104 +++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index f101f550d1..8fc86a99e3 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -721,7 +721,7 @@ func Test_backupskip() let &backupskip = backupskip endfunc -func Test_copy_winopt() +func Test_buf_copy_winopt() set hidden " Test copy option from current buffer in window @@ -775,6 +775,108 @@ func Test_copy_winopt() set hidden& endfunc +func Test_split_copy_options() + let values = [ + \['cursorbind', 1, 0], + \['fillchars', '"vert:-"', '"' .. &fillchars .. '"'], + \['list', 1, 0], + \['listchars', '"space:-"', '"' .. &listchars .. '"'], + \['number', 1, 0], + \['relativenumber', 1, 0], + \['scrollbind', 1, 0], + \['smoothscroll', 1, 0], + \['virtualedit', '"block"', '"' .. &virtualedit .. '"'], + "\ ['wincolor', '"Search"', '"' .. &wincolor .. '"'], + \['wrap', 0, 1], + \] + if has('linebreak') + let values += [ + \['breakindent', 1, 0], + \['breakindentopt', '"min:5"', '"' .. &breakindentopt .. '"'], + \['linebreak', 1, 0], + \['numberwidth', 7, 4], + \['showbreak', '"++"', '"' .. &showbreak .. '"'], + \] + endif + if has('rightleft') + let values += [ + \['rightleft', 1, 0], + \['rightleftcmd', '"search"', '"' .. &rightleftcmd .. '"'], + \] + endif + if has('statusline') + let values += [ + \['statusline', '"---%f---"', '"' .. &statusline .. '"'], + \] + endif + if has('spell') + let values += [ + \['spell', 1, 0], + \] + endif + if has('syntax') + let values += [ + \['cursorcolumn', 1, 0], + \['cursorline', 1, 0], + \['cursorlineopt', '"screenline"', '"' .. &cursorlineopt .. '"'], + \['colorcolumn', '"+1"', '"' .. &colorcolumn .. '"'], + \] + endif + if has('diff') + let values += [ + \['diff', 1, 0], + \] + endif + if has('conceal') + let values += [ + \['concealcursor', '"nv"', '"' .. &concealcursor .. '"'], + \['conceallevel', '3', &conceallevel], + \] + endif + if has('terminal') + let values += [ + \['termwinkey', '""', '"' .. &termwinkey .. '"'], + \['termwinsize', '"10x20"', '"' .. &termwinsize .. '"'], + \] + endif + if has('folding') + let values += [ + \['foldcolumn', '"5"', &foldcolumn], + \['foldenable', 0, 1], + \['foldexpr', '"2 + 3"', '"' .. &foldexpr .. '"'], + \['foldignore', '"+="', '"' .. &foldignore .. '"'], + \['foldlevel', 4, &foldlevel], + \['foldmarker', '">>,<<"', '"' .. &foldmarker .. '"'], + \['foldmethod', '"marker"', '"' .. &foldmethod .. '"'], + \['foldminlines', 3, &foldminlines], + \['foldnestmax', 17, &foldnestmax], + \['foldtext', '"closed"', '"' .. &foldtext .. '"'], + \] + endif + if has('signs') + let values += [ + \['signcolumn', '"number"', '"' .. &signcolumn .. '"'], + \] + endif + + " set options to non-default value + for item in values + exe $"let &{item[0]} = {item[1]}" + endfor + + " check values are set in new window + split + for item in values + exe $'call assert_equal({item[1]}, &{item[0]}, "{item[0]}")' + endfor + + " restore + close + for item in values + exe $"let &{item[0]} = {item[1]}" + endfor +endfunc + func Test_shortmess_F() new call assert_match('\[No Name\]', execute('file')) -- cgit From 69af5e8782e601fe9c1e39adf49ce16728719a73 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 04:00:38 +0200 Subject: vim-patch:9.0.0645: CTRL-Y does not stop at line 1 Problem: CTRL-Y does not stop at line 1. (John Marriott) Solution: Stop at line 1 when 'smoothscroll' is not set. (closes vim/vim#11261) https://github.com/vim/vim/commit/8df9748edb2ac8bd025e34e06194ac210667c97a Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 13 +++++++++++++ test/old/testdir/test_scroll_opt.vim | 13 +++++++++++++ 2 files changed, 26 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 0d0e9640a7..14dbe0caf9 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -14,6 +14,19 @@ describe('smoothscroll', function() screen:attach() end) + -- oldtest: Test_CtrlE_CtrlY_stop_at_end() + it('disabled does not break and stop at end', function() + exec([[ + enew + call setline(1, ['one', 'two']) + set number + ]]) + feed('') + screen:expect({any = " 1 ^one"}) + feed('') + screen:expect({any = " 2 ^two"}) + end) + -- oldtest: Test_smoothscroll_CtrlE_CtrlY() it('works with and ', function() exec([[ diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 9375d4ad63..ed3ffd83e7 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -54,6 +54,19 @@ func Test_scolloff_even_line_count() bwipe! endfunc +func Test_CtrlE_CtrlY_stop_at_end() + enew + call setline(1, ['one', 'two']) + set number + exe "normal \" + call assert_equal([" 1 one "], ScreenLines(1, 10)) + exe "normal \\\" + call assert_equal([" 2 two "], ScreenLines(1, 10)) + + bwipe! + set nonumber +endfunc + func Test_smoothscroll_CtrlE_CtrlY() CheckScreendump -- cgit From d6050e9bda7f8b080c577100ae94e017dc146c88 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 04:32:50 +0200 Subject: vim-patch:9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set Problem: with 'smoothscroll' set CTRL-E does not work properly when 'foldmethod' is set to "indent". (Yee Cheng Chin) Solution: Merge the code for scroling with folds and 'smoothscroll'. (closes vim/vim#11262) https://github.com/vim/vim/commit/6b2d4ff7148e0b416ba745d20d061e6f7bb53ee7 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 80 ++++++++++++++++++++++++------ test/old/testdir/test_scroll_opt.vim | 15 ++++++ 2 files changed, 81 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 14dbe0caf9..20976089e2 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -31,11 +31,10 @@ describe('smoothscroll', function() it('works with and ', function() exec([[ call setline(1, [ 'line one', 'word '->repeat(20), 'line three', 'long word '->repeat(7), 'line', 'line', 'line', ]) - set smoothscroll + set smoothscroll scrolloff=5 :5 ]]) - local s0 = [[ - line one | + local s1 = [[ word word word word word word word word | word word word word word word word word | word word word word | @@ -45,11 +44,11 @@ describe('smoothscroll', function() ^line | line | line | + ~ | ~ | | ]] - local s1 = [[ - word word word word word word word word | + local s2 = [[ word word word word word word word word | word word word word | line three | @@ -59,11 +58,11 @@ describe('smoothscroll', function() line | line | ~ | + ~ | ~ | | ]] - local s2 = [[ - word word word word word word word word | + local s3 = [[ word word word word | line three | long word long word long word long word | @@ -73,37 +72,80 @@ describe('smoothscroll', function() line | ~ | ~ | + ~ | ~ | | ]] - local s3 = [[ - word word word word | + local s4 = [[ line three | long word long word long word long word | long word long word long word | - ^line | line | line | + ^line | + ~ | ~ | ~ | ~ | ~ | | ]] - local s4 = [[ + local s5 = [[ + word word word word | line three | long word long word long word long word | long word long word long word | + line | + line | ^line | + ~ | + ~ | + ~ | + ~ | + | + ]] + local s6 = [[ + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | line | line | + ^line | ~ | ~ | ~ | + | + ]] + local s7 = [[ + word word word word word word word word | + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | + line | + line | + ^line | ~ | ~ | | ]] + local s8 = [[ + line one | + word word word word word word word word | + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | + line | + line | + ^line | + ~ | + | + ]] feed('') screen:expect(s1) feed('') @@ -113,12 +155,22 @@ describe('smoothscroll', function() feed('') screen:expect(s4) feed('') - screen:expect(s3) + screen:expect(s5) feed('') - screen:expect(s2) + screen:expect(s6) feed('') + screen:expect(s7) + feed('') + screen:expect(s8) + exec('set foldmethod=indent') + -- move the cursor so we can reuse the same dumps + feed('5G') screen:expect(s1) + feed('') + screen:expect(s2) + feed('7G') + screen:expect(s7) feed('') - screen:expect(s0) + screen:expect(s8) end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index ed3ffd83e7..c1f6c66642 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -105,6 +105,21 @@ func Test_smoothscroll_CtrlE_CtrlY() call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_smoothscroll_8', {}) + if has('folding') + call term_sendkeys(buf, ":set foldmethod=indent\") + " move the cursor so we can reuse the same dumps + call term_sendkeys(buf, "5G") + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_2', {}) + call term_sendkeys(buf, "7G") + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_7', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_8', {}) + endif + call StopVimInTerminal(buf) endfunc -- cgit From a43b28a34c568eb3e280e75a81424f80f0ed980b Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 13:11:33 +0200 Subject: vim-patch:9.0.0649: no indication the first line is broken for 'smoothscroll' Problem: No indication when the first line is broken for 'smoothscroll'. Solution: Show "<<<" in the first line. https://github.com/vim/vim/commit/406b5d89e18742ac6e6256ffc72fb70a27f0148b Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 20976089e2..ddbeca1a30 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -49,7 +49,7 @@ describe('smoothscroll', function() | ]] local s2 = [[ - word word word word word word word word | + << Date: Thu, 27 Apr 2023 04:52:52 +0200 Subject: vim-patch:9.0.0650: some tests are failing Problem: Some tests are failing. Solution: Adjust for "<<<" showing up. https://github.com/vim/vim/commit/0466d398a550623126fba3a2a08208a798b28bda Co-authored-by: Bram Moolenaar --- test/old/testdir/test_breakindent.vim | 20 ++++++++++---------- test/old/testdir/test_display.vim | 2 +- test/old/testdir/test_listlbr.vim | 2 +- test/old/testdir/test_listlbr_utf8.vim | 4 ++-- test/old/testdir/test_number.vim | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index 0d1753182e..f271e6f2ea 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -87,7 +87,7 @@ func Test_breakindent02_vartabs() endif " simple breakindent test with showbreak set call s:test_windows('setl briopt=min:0 sbr=>> vts=4') - let lines = s:screen_lines(line('.'),8) + let lines = s:screen_lines(line('.'), 8) let expect = [ \ " abcd", \ " >>qr", @@ -100,7 +100,7 @@ endfunc func Test_breakindent03() " simple breakindent test with showbreak set and briopt including sbr call s:test_windows('setl briopt=sbr,min:0 sbr=++') - let lines = s:screen_lines(line('.'),8) + let lines = s:screen_lines(line('.'), 8) let expect=[ \ " abcd", \ "++ qrst", @@ -117,7 +117,7 @@ func Test_breakindent03_vartabs() return endif call s:test_windows('setl briopt=sbr,min:0 sbr=++ vts=4') - let lines = s:screen_lines(line('.'),8) + let lines = s:screen_lines(line('.'), 8) let expect = [ \ " abcd", \ "++ qrst", @@ -132,7 +132,7 @@ func Test_breakindent04() " breakindent set with min width 18 set sbr=<<< call s:test_windows('setl sbr=NONE briopt=min:18') - let lines = s:screen_lines(line('.'),8) + let lines = s:screen_lines(line('.'), 8) let expect = [ \ " abcd", \ " qrstuv", @@ -150,7 +150,7 @@ func Test_breakindent04_vartabs() return endif call s:test_windows('setl sbr= briopt=min:18 vts=4') - let lines = s:screen_lines(line('.'),8) + let lines = s:screen_lines(line('.'), 8) let expect = [ \ " abcd", \ " qrstuv", @@ -583,7 +583,7 @@ func Test_breakindent16() redraw! let lines = s:screen_lines(1,10) let expect = [ - \ " 789012", + \ "<<< 789012", \ " 345678", \ " 901234", \ ] @@ -611,7 +611,7 @@ func Test_breakindent16_vartabs() redraw! let lines = s:screen_lines(1,10) let expect = [ - \ " 789012", + \ "<<< 789012", \ " 345678", \ " 901234", \ ] @@ -700,7 +700,7 @@ func Test_breakindent19_sbr_nextpage() norm! 5gj let lines = s:screen_lines(1, 20) let expect = [ - \ ">aaaaaaaaaaaaaaaaaaa", + \ "<<aaaaaaaaaaaaaaaaaaa", \ ">aaaaaaaaaaaaaaaaaaa", \ ] @@ -727,7 +727,7 @@ func Test_breakindent20_cpo_n_nextpage() redraw! let lines = s:screen_lines(1, 20) let expect = [ - \ "--1 aaaaaaaaaaaaaaaa", + \ "<<< aaaaaaaaaaaaaaaa", \ " aaaaaaaaaaaaaaaa", \ " aaaaaaaaaaaaaaaa", \ ] @@ -746,7 +746,7 @@ func Test_breakindent20_cpo_n_nextpage() norm! 5gj let lines = s:screen_lines(1, 20) let expect = [ - \ "--1 aaaaaaaaaaaaaa", + \ "<<< aaaaaaaaaaaaaa", \ " aaaaaaaaaaaaaa", \ " aaaaaaaaaaaaaa", \ ] diff --git a/test/old/testdir/test_display.vim b/test/old/testdir/test_display.vim index b642f39c9f..aae1030aac 100644 --- a/test/old/testdir/test_display.vim +++ b/test/old/testdir/test_display.vim @@ -146,7 +146,7 @@ func Test_display_listchars_precedes() let lines = ScreenLines([1,10], winwidth(0)+1) let expect = [ - \ "eAx\" let lines = s:screen_lines([1, 10], winwidth(0)) let expect = [ -\ "foobar foobar ", +\ "<<eAx\" let lines = s:screen_lines([1, 10], winwidth(0)) let expect = [ -\ "+foobar foobar ", +\ "<<', +\ '<<', \ '中aaaaaaaaaaaaaaaaa>', \ '中aaaaaaaaaaaaaaaaa>', \ '中aaaaaaaaaaaaaaaaa>', diff --git a/test/old/testdir/test_number.vim b/test/old/testdir/test_number.vim index 521b0cf706..cf777fd918 100644 --- a/test/old/testdir/test_number.vim +++ b/test/old/testdir/test_number.vim @@ -138,7 +138,7 @@ func Test_number_with_linewrap1() call s:validate_cursor() let lines = s:screen_lines(1, 3) let expect = [ -\ "--1 aaaa", +\ "<<< aaaa", \ " aaaa", \ " aaaa", \ ] -- cgit From f3b44cf23d9c240471826e4f35555ee85ded1e5b Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 27 Apr 2023 04:54:50 +0200 Subject: vim-patch:9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo' Problem: 'smoothscroll' not tested with 'number' and "n" in 'cpo'. Solution: Add tests, fix uncovered problem. https://github.com/vim/vim/commit/b6aab8f44beb8c5d99393abdc2c9faab085c72aa Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 99 ++++++++++++++++++++++++++++++ test/functional/ui/highlight_spec.lua | 2 +- test/functional/ui/popupmenu_spec.lua | 2 +- test/old/testdir/test_scroll_opt.vim | 35 +++++++++++ 4 files changed, 136 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index ddbeca1a30..8d2eade1a8 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -173,4 +173,103 @@ describe('smoothscroll', function() feed('') screen:expect(s8) end) + + -- oldtest: Test_smoothscroll_number() + it("works 'number' and 'cpo'+=n", function() + exec([[ + call setline(1, [ 'one ' .. 'word '->repeat(20), 'two ' .. 'long word '->repeat(7), 'line', 'line', 'line', ]) + set smoothscroll scrolloff=5 + set number cpo+=n + :3 + ]]) + screen:expect([[ + 1 one word word word word word word wo| + rd word word word word word word word wo| + rd word word word word word | + 2 two long word long word long word lo| + ng word long word long word long word | + 3 ^line | + 4 line | + 5 line | + ~ | + ~ | + ~ | + | + ]]) + feed('') + screen:expect([[ + <<') + screen:expect([[ + <<') + screen:expect([[ + <<< rd word word word word word word wor| + d word word word word word word | + 2 two long word long word long word lo| + ng word long word long word long wor| + d | + 3 ^line | + 4 line | + 5 line | + ~ | + ~ | + ~ | + | + ]]) + feed('') + screen:expect([[ + 1 one word word word word word word wo| + rd word word word word word word wor| + d word word word word word word | + 2 two long word long word long word lo| + ng word long word long word long wor| + d | + 3 ^line | + 4 line | + 5 line | + ~ | + ~ | + | + ]]) + end) end) diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 89b503141b..01895003ae 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -704,7 +704,7 @@ describe("'listchars' highlight", function() feed_command('set listchars=eol:¬,precedes:< list') feed('90ia') screen:expect([[ - {0:<}aaaaaaaaaaaaaaaaaaa| + {0:<<<}aaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaa| aaaaaaaaa^a{0:¬} | diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 0b71e12b6f..6c26c8ea39 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -2396,7 +2396,7 @@ describe('builtin popupmenu', function() -- can't draw the pum, but check we don't crash screen:try_resize(12,2) screen:expect([[ - text^ | + {1:<<<}t^ | {2:-- INSERT -} | ]]) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index c1f6c66642..f574286b09 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -123,6 +123,41 @@ func Test_smoothscroll_CtrlE_CtrlY() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_number() + CheckScreendump + + let lines =<< trim END + vim9script + setline(1, [ + 'one ' .. 'word '->repeat(20), + 'two ' .. 'long word '->repeat(7), + 'line', + 'line', + 'line', + ]) + set smoothscroll + set number cpo+=n + :3 + END + call writefile(lines, 'XSmoothNumber', 'D') + let buf = RunVimInTerminal('-S XSmoothNumber', #{rows: 12, cols: 40}) + + call VerifyScreenDump(buf, 'Test_smooth_number_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_number_2', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_number_3', {}) + + call term_sendkeys(buf, ":set cpo-=n\") + call VerifyScreenDump(buf, 'Test_smooth_number_4', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_number_5', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_number_6', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 181097e4434bbbd7482fd238a67c1e65f002e3ff Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 16:46:51 +0200 Subject: vim-patch:9.0.0654: breakindent test fails Problem: Breakindent test fails. Solution: Temporarily accept wrong result. https://github.com/vim/vim/commit/ec32c781a282398e3da27f4aec4b03fcd20f8b0d Co-authored-by: Bram Moolenaar --- test/old/testdir/test_breakindent.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index f271e6f2ea..de25f9b787 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -726,8 +726,9 @@ func Test_breakindent20_cpo_n_nextpage() norm! 5gj redraw! let lines = s:screen_lines(1, 20) + " FIXME: this is not the right result let expect = [ - \ "<<< aaaaaaaaaaaaaaaa", + \ "<< Date: Wed, 26 Apr 2023 16:54:23 +0200 Subject: vim-patch:9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff' Problem: Negative topline using CTRL-Y with 'smoothscroll' and 'diff'. (Ernie Rael) Solution: Only use 'smoothscroll' when 'wrap' is set. https://github.com/vim/vim/commit/1a58e1d97cfc72e501cbf63ad75f46f1bb4c8da2 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 29 +++++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 26 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 8d2eade1a8..90417d93f3 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -272,4 +272,33 @@ describe('smoothscroll', function() | ]]) end) + + -- oldtest: Test_smoothscroll_diff_mode() + it("works with diff mode", function() + screen:try_resize(40, 8) + exec([[ + let text = 'just some text here' + call setline(1, text) + set smoothscroll + diffthis + new + call setline(1, text) + set smoothscroll + diffthis + ]]) + screen:expect([[ + - ^just some text here | + ~ | + ~ | + [No Name] [+] | + - just some text here | + ~ | + [No Name] [+] | + | + ]]) + feed('') + screen:expect_unchanged() + feed('') + screen:expect_unchanged() + end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index f574286b09..53768de6fa 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -158,6 +158,32 @@ func Test_smoothscroll_number() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_diff_mode() + CheckScreendump + + let lines =<< trim END + vim9script + var text = 'just some text here' + setline(1, text) + set smoothscroll + diffthis + new + setline(1, text) + set smoothscroll + diffthis + END + call writefile(lines, 'XSmoothDiff', 'D') + let buf = RunVimInTerminal('-S XSmoothDiff', #{rows: 8}) + + call VerifyScreenDump(buf, 'Test_smooth_diff_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_diff_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_diff_1', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit 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 --- test/functional/legacy/scroll_opt_spec.lua | 26 ++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 90417d93f3..c63401cb02 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -301,4 +301,30 @@ describe('smoothscroll', function() feed('') screen:expect_unchanged() end) + + -- oldtest: Test_smoothscroll_wrap_scrolloff_zero() + it("works with zero 'scrolloff'", function() + screen:try_resize(40, 8) + exec([[ + call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7)) + set smoothscroll scrolloff=0 + :3 + ]]) + screen:expect([[ + <<j') + screen:expect_unchanged() + feed('G') + screen:expect_unchanged() + end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 53768de6fa..799db19298 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -184,6 +184,31 @@ func Test_smoothscroll_diff_mode() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_wrap_scrolloff_zero() + CheckScreendump + + let lines =<< trim END + vim9script + setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7)) + set smoothscroll scrolloff=0 + :3 + END + call writefile(lines, 'XSmoothWrap', 'D') + let buf = RunVimInTerminal('-S XSmoothWrap', #{rows: 8, cols: 40}) + + call VerifyScreenDump(buf, 'Test_smooth_wrap_1', {}) + + call term_sendkeys(buf, "j") + call VerifyScreenDump(buf, 'Test_smooth_wrap_2', {}) + + call term_sendkeys(buf, "\j") + call VerifyScreenDump(buf, 'Test_smooth_wrap_3', {}) + + call term_sendkeys(buf, "G") + call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {}) + + call StopVimInTerminal(buf) +endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From d95697d6d4533e84bbb9d262b355ee9f71bd7452 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 17:23:42 +0200 Subject: vim-patch:9.0.0673: first line wong with 'smoothscroll' and 'scrolloff' zero Problem: First line not scrolled properly with 'smoothscroll' and 'scrolloff' zero and using "k". Solution: Make sure the cursor position is visible. https://github.com/vim/vim/commit/46b54747c5d252c584571a321231bad9330018ec Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 15 ++++++++++++++- test/old/testdir/test_scroll_opt.vim | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index c63401cb02..fb4990ff00 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -307,7 +307,7 @@ describe('smoothscroll', function() screen:try_resize(40, 8) exec([[ call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7)) - set smoothscroll scrolloff=0 + set smoothscroll scrolloff=0 display= :3 ]]) screen:expect([[ @@ -322,9 +322,22 @@ describe('smoothscroll', function() ]]) feed('j') screen:expect_unchanged() + -- moving cursor down - whole bottom line shows feed('j') screen:expect_unchanged() feed('G') screen:expect_unchanged() + -- moving cursor up - whole top line shows + feed('2k') + screen:expect([[ + ^Line with some text with some text with | + some text with some text with some text | + with some text with some text | + Line with some text with some text with | + some text with some text with some text | + with some text with some text | + @ | + | + ]]) end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 799db19298..77e656cf9f 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -198,6 +198,7 @@ func Test_smoothscroll_wrap_scrolloff_zero() call VerifyScreenDump(buf, 'Test_smooth_wrap_1', {}) + " moving cursor down - whole bottom line shows call term_sendkeys(buf, "j") call VerifyScreenDump(buf, 'Test_smooth_wrap_2', {}) @@ -207,6 +208,10 @@ func Test_smoothscroll_wrap_scrolloff_zero() call term_sendkeys(buf, "G") call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {}) + " moving cursor up - whole top line shows + call term_sendkeys(buf, "2k") + call VerifyScreenDump(buf, 'Test_smooth_wrap_5', {}) + call StopVimInTerminal(buf) endfunc -- cgit From 7dc2c087e7c2071166772dc6b167c802612112fe Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 18:08:55 +0200 Subject: vim-patch:9.0.0677: breakindent test accepts wrong result Problem: Breakindent test accepts wrong result. Solution: Fix the number column and adjust the expected text. https://github.com/vim/vim/commit/06618f94f1c9ed73a84ad5d6a8e1933b0b8da846 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_breakindent.vim | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index de25f9b787..9cc398f64a 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -711,14 +711,14 @@ endfunc func Test_breakindent20_cpo_n_nextpage() let s:input = "" call s:test_windows('setl breakindent briopt=min:14 cpo+=n number') - call setline(1, repeat('a', 200)) + call setline(1, repeat('abcdefghijklmnopqrst', 10)) norm! 1gg redraw! let lines = s:screen_lines(1, 20) let expect = [ - \ " 1 aaaaaaaaaaaaaaaa", - \ " aaaaaaaaaaaaaaaa", - \ " aaaaaaaaaaaaaaaa", + \ " 1 abcdefghijklmnop", + \ " qrstabcdefghijkl", + \ " mnopqrstabcdefgh", \ ] call s:compare_lines(expect, lines) " Scroll down one screen line @@ -726,11 +726,10 @@ func Test_breakindent20_cpo_n_nextpage() norm! 5gj redraw! let lines = s:screen_lines(1, 20) - " FIXME: this is not the right result let expect = [ - \ "<< Date: Wed, 26 Apr 2023 20:30:39 +0200 Subject: vim-patch:9.0.0681: "<<<" shows for 'smoothscroll' even when 'showbreak is set Problem: "<<<" shows for 'smoothscroll' even when 'showbreak is set. Solution: When 'showbreak' is set do not display "<<<". https://github.com/vim/vim/commit/0937b9fb244949b7ce9bfcf8398d7495b9b6aa85 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_breakindent.vim | 2 +- test/old/testdir/test_listlbr_utf8.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index 9cc398f64a..3cbc1f4900 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -700,7 +700,7 @@ func Test_breakindent19_sbr_nextpage() norm! 5gj let lines = s:screen_lines(1, 20) let expect = [ - \ "<<aaaaaaaaaaaaaaaaaaa", \ ">aaaaaaaaaaaaaaaaaaa", \ ">aaaaaaaaaaaaaaaaaaa", \ ] diff --git a/test/old/testdir/test_listlbr_utf8.vim b/test/old/testdir/test_listlbr_utf8.vim index 47683696d1..15b248964f 100644 --- a/test/old/testdir/test_listlbr_utf8.vim +++ b/test/old/testdir/test_listlbr_utf8.vim @@ -167,7 +167,7 @@ func Test_visual_block_and_selection_exclusive() exe "norm! $3B\eAx\" let lines = s:screen_lines([1, 10], winwidth(0)) let expect = [ -\ "<< Date: Wed, 26 Apr 2023 21:56:31 +0200 Subject: vim-patch:9.0.0701: with 'smoothscroll' cursor position not adjusted in long line Problem: With 'smoothscroll' the cursor position s not adjusted in a long line. Solution: Move the cursor further up or down in the line. https://github.com/vim/vim/commit/8cf3459878198c5bb4a96f3c63214b2beccce341 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 56 ++++++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 28 +++++++++++++++ 2 files changed, 84 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index fb4990ff00..5c7c9cd55a 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -340,4 +340,60 @@ describe('smoothscroll', function() | ]]) end) + + -- oldtest: Test_smoothscroll_wrap_long_line() + it("adjusts the cursor position in a long line", function() + screen:try_resize(40, 6) + exec([[ + call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30))]) + set smoothscroll scrolloff=0 + normal 3G10|zt + ]]) + -- scrolling up, cursor moves screen line down + screen:expect([[ + Line with^ lots of text with lots of text| + with lots of text with lots of text wit| + h lots of text with lots of text with lo| + ts of text with lots of text with lots o| + f text with lots of text with lots of te| + | + ]]) + feed('') + screen:expect([[ + <<') + screen:expect([[ + <<< lots ^of text with lots of text with | + lots of text with lots of text with lots| + of text with lots of text with lots of | + text with lots of text with lots of text| + with lots of text with lots of text wit| + | + ]]) + -- scrolling down, cursor moves screen line up + feed('5') + screen:expect([[ + <<') + screen:expect([[ + Line with lots of text with lots of text| + with lots of text with lots of text wit| + h lots of text with lots of text with lo| + ts of text with lots of text with lots o| + f text wi^th lots of text with lots of te| + | + ]]) + end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 77e656cf9f..0041fbaa25 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -215,5 +215,33 @@ func Test_smoothscroll_wrap_scrolloff_zero() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_wrap_long_line() + CheckScreendump + + let lines =<< trim END + vim9script + setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30))]) + set smoothscroll scrolloff=0 + normal 3G10|zt + END + call writefile(lines, 'XSmoothWrap', 'D') + let buf = RunVimInTerminal('-S XSmoothWrap', #{rows: 6, cols: 40}) + call VerifyScreenDump(buf, 'Test_smooth_long_1', {}) + + " scrolling up, cursor moves screen line down + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_long_2', {}) + call term_sendkeys(buf, "5\") + call VerifyScreenDump(buf, 'Test_smooth_long_3', {}) + + " scrolling down, cursor moves screen line up + call term_sendkeys(buf, "5\") + call VerifyScreenDump(buf, 'Test_smooth_long_4', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_long_5', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit 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 From bf12a85a69f03bb5321fe0a32e1a9ac81f31750c Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 22:32:38 +0200 Subject: vim-patch:9.0.0734: cursor position invalid when scrolling with 'smoothscroll' Problem: Cursor position invalid when scrolling with 'smoothscroll' set. (Ernie Rael) Solution: Add w_valid_skipcol and clear flags when it changes. Adjust w_skipcol after moving the cursor. https://github.com/vim/vim/commit/2fbabd238a94022c99506e920186a5b6cdf15426 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 34 ++++++++++++++++++++++++------ test/old/testdir/test_scroll_opt.vim | 21 ++++++++++++++++++ 2 files changed, 49 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index be7d324908..a5660ae4d2 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -428,14 +428,36 @@ describe('smoothscroll', function() | ]]) -- 'scrolloff' set to 2, scrolling down, cursor moves screen line up - feed('gjgj') + feed('gj') + screen:expect_unchanged() + end) + + -- oldtest: Test_smoothscroll_one_long_line() + it("scrolls correctly when moving the cursor", function() + screen:try_resize(40, 6) + exec([[ + call setline(1, 'with lots of text '->repeat(7)) + set smoothscroll scrolloff=0 + ]]) + local s1 = [[ + ^with lots of text with lots of text with| + lots of text with lots of text with lot| + s of text with lots of text with lots of| + text | + ~ | + | + ]] + screen:expect(s1) + feed('') screen:expect([[ - <<repeat(7)) + set smoothscroll scrolloff=0 + END + call writefile(lines, 'XSmoothOneLong', 'D') + let buf = RunVimInTerminal('-S XSmoothOneLong', #{rows: 6, cols: 40}) + call VerifyScreenDump(buf, 'Test_smooth_one_long_1', {}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_one_long_2', {}) + + call term_sendkeys(buf, "0") + call VerifyScreenDump(buf, 'Test_smooth_one_long_1', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 9189c2d16260824db3f1a9633c17245c474baa9a Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 23:12:28 +0200 Subject: vim-patch:9.0.0735: breakindent and scrolloff tests fail Problem: Breakindent and scrolloff tests fail. Solution: Temporarily skip the assertions. https://github.com/vim/vim/commit/e42033e735febb163fdc57aadbc11787ca611ba9 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_breakindent.vim | 3 ++- test/old/testdir/test_normal.vim | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index 3cbc1f4900..76634a5ae5 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -731,7 +731,8 @@ func Test_breakindent20_cpo_n_nextpage() \ " mnopqrstabcdefgh", \ " ijklmnopqrstabcd", \ ] - call s:compare_lines(expect, lines) + " FIXME: this currently fails + " call s:compare_lines(expect, lines) setl briopt+=shift:2 norm! 1gg diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index fe8611d527..295c1b3d6a 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -3742,9 +3742,11 @@ func Test_normal_scroloff() call setline(1, repeat('a', 1000)) set scrolloff=10 normal gg10gj - call assert_equal(8, winline()) +" FIXME: currently get 10 +" call assert_equal(8, winline()) normal 10gj - call assert_equal(10, winline()) +" FIXME: currently get 9 +" call assert_equal(10, winline()) normal 10gk call assert_equal(3, winline()) set scrolloff& -- cgit From e8dfff5f288f5fcf4a11d62e973080600f05c980 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 23:23:50 +0200 Subject: vim-patch:9.0.0745: wrong cursor position when using "gj" and "gk" in a long line Problem: Wrong cursor position when using "gj" and "gk" in a long line. Solution: Adjust computations for the cursor position and skipcol. Re-enable tests that pass now, disable failing breakindent test. https://github.com/vim/vim/commit/4b6172e108fe06be47c09f8690dc54608be3ee80 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_breakindent.vim | 3 ++- test/old/testdir/test_normal.vim | 42 +++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index 76634a5ae5..2317cb8568 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -751,7 +751,8 @@ func Test_breakindent20_cpo_n_nextpage() \ " klmnopqrstabcd", \ " efghijklmnopqr", \ ] - call s:compare_lines(expect, lines) + " FIXME: this currently fails + " call s:compare_lines(expect, lines) call s:close_windows('set breakindent& briopt& cpo& number&') endfunc diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 295c1b3d6a..600e58848b 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -3738,17 +3738,45 @@ endfunc " Test for 'scrolloff' with a long line that doesn't fit in the screen func Test_normal_scroloff() 10new - 80vnew - call setline(1, repeat('a', 1000)) + 60vnew + call setline(1, ' 1 ' .. repeat('a', 57) + \ .. ' 2 ' .. repeat('b', 57) + \ .. ' 3 ' .. repeat('c', 57) + \ .. ' 4 ' .. repeat('d', 57) + \ .. ' 5 ' .. repeat('e', 57) + \ .. ' 6 ' .. repeat('f', 57) + \ .. ' 7 ' .. repeat('g', 57) + \ .. ' 8 ' .. repeat('h', 57) + \ .. ' 9 ' .. repeat('i', 57) + \ .. '10 ' .. repeat('j', 57) + \ .. '11 ' .. repeat('k', 57) + \ .. '12 ' .. repeat('l', 57) + \ .. '13 ' .. repeat('m', 57) + \ .. '14 ' .. repeat('n', 57) + \ .. '15 ' .. repeat('o', 57) + \ .. '16 ' .. repeat('p', 57) + \ .. '17 ' .. repeat('q', 57) + \ .. '18 ' .. repeat('r', 57) + \ .. '19 ' .. repeat('s', 57) + \ .. '20 ' .. repeat('t', 57) + \ .. '21 ' .. repeat('u', 57) + \ .. '22 ' .. repeat('v', 57) + \ .. '23 ' .. repeat('w', 57) + \ .. '24 ' .. repeat('x', 57) + \ .. '25 ' .. repeat('y', 57) + \ .. '26 ' .. repeat('z', 57) + \ ) set scrolloff=10 normal gg10gj -" FIXME: currently get 10 -" call assert_equal(8, winline()) + call assert_equal(6, winline()) normal 10gj -" FIXME: currently get 9 -" call assert_equal(10, winline()) + call assert_equal(6, winline()) normal 10gk - call assert_equal(3, winline()) + call assert_equal(6, winline()) + normal 0 + call assert_equal(1, winline()) + normal $ + call assert_equal(10, winline()) set scrolloff& close! endfunc -- cgit From 223c7173eea2a4abec75611bd70051ea0b4c5d20 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 23:36:59 +0200 Subject: vim-patch:9.0.0746: breakindent test cases are commented out Problem: Breakindent test cases are commented out. Solution: Adjust expected result to slightly different behavior. Correct computations for cursor position. https://github.com/vim/vim/commit/856c5d2bc7c3864f8b63a0ab3e376d5c5e51f1d5 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_breakindent.vim | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index 2317cb8568..f6c0e32adf 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -723,7 +723,7 @@ func Test_breakindent20_cpo_n_nextpage() call s:compare_lines(expect, lines) " Scroll down one screen line setl scrolloff=5 - norm! 5gj + norm! 6gj redraw! let lines = s:screen_lines(1, 20) let expect = [ @@ -731,8 +731,7 @@ func Test_breakindent20_cpo_n_nextpage() \ " mnopqrstabcdefgh", \ " ijklmnopqrstabcd", \ ] - " FIXME: this currently fails - " call s:compare_lines(expect, lines) + call s:compare_lines(expect, lines) setl briopt+=shift:2 norm! 1gg @@ -744,15 +743,14 @@ func Test_breakindent20_cpo_n_nextpage() \ ] call s:compare_lines(expect, lines) " Scroll down one screen line - norm! 5gj + norm! 6gj let lines = s:screen_lines(1, 20) let expect = [ \ "<<< qrstabcdefghij", \ " klmnopqrstabcd", \ " efghijklmnopqr", \ ] - " FIXME: this currently fails - " call s:compare_lines(expect, lines) + call s:compare_lines(expect, lines) call s:close_windows('set breakindent& briopt& cpo& number&') endfunc -- cgit From 6146400605af93ac48dae4393569c44e8a2e39d2 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 27 Apr 2023 00:57:48 +0200 Subject: vim-patch:9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu' Problem: Line number not visisble with 'smoothscroll', 'nu' and 'rnu'. Solution: Put the ">>>" after the line number instead of on top. https://github.com/vim/vim/commit/eb4de629315f2682d8b314462d02422ec98d751a Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 21 +++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 14 ++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index a5660ae4d2..5e54470bd4 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -181,6 +181,12 @@ describe('smoothscroll', function() set smoothscroll scrolloff=5 set number cpo+=n :3 + func g:DoRel() + set number relativenumber scrolloff=0 + :%del + call setline(1, [ 'one', 'very long text '->repeat(12), 'three', ]) + exe "normal 2Gzt\" + endfunc ]]) screen:expect([[ 1 one word word word word word word wo| @@ -271,6 +277,21 @@ describe('smoothscroll', function() ~ | | ]]) + exec('call DoRel()') + screen:expect([[ + 2<<repeat(12), + 'three', + ]) + exe "normal 2Gzt\" + enddef END call writefile(lines, 'XSmoothNumber', 'D') let buf = RunVimInTerminal('-S XSmoothNumber', #{rows: 12, cols: 40}) @@ -155,6 +166,9 @@ func Test_smoothscroll_number() call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_smooth_number_6', {}) + call term_sendkeys(buf, ":call DoRel()\") + call VerifyScreenDump(buf, 'Test_smooth_number_7', {}) + call StopVimInTerminal(buf) endfunc -- cgit From 72c525d5675bc017fa52bcc74a394db7d01e6359 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 27 Apr 2023 02:54:51 +0200 Subject: vim-patch:9.0.0758: "precedes" from 'listchars' overwritten by <<< Problem: "precedes" from 'listchars' overwritten by <<< for 'smoothscroll'. Solution: Keep the "precedes" character. https://github.com/vim/vim/commit/13cdde39520220bb856cba16626327c706752b51 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 32 ++++++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 25 +++++++++++++++++++++++ 2 files changed, 57 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 5e54470bd4..b5a571d8b5 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -294,6 +294,38 @@ describe('smoothscroll', function() ]]) end) + -- oldtest: Test_smoothscroll_list() + it("works with list mode", function() + screen:try_resize(40, 8) + exec([[ + set smoothscroll scrolloff=0 + set list + call setline(1, [ 'one', 'very long text '->repeat(12), 'three', ]) + exe "normal 2Gzt\" + ]]) + screen:expect([[ + <<repeat(12), + 'three', + ]) + exe "normal 2Gzt\" + END + call writefile(lines, 'XSmoothList', 'D') + let buf = RunVimInTerminal('-S XSmoothList', #{rows: 8, cols: 40}) + + call VerifyScreenDump(buf, 'Test_smooth_list_1', {}) + + call term_sendkeys(buf, ":set listchars+=precedes:#\") + call VerifyScreenDump(buf, 'Test_smooth_list_2', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_smoothscroll_diff_mode() CheckScreendump -- cgit From 0588329c8569553e3232e72889a28496a30aa54b Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 27 Apr 2023 03:15:46 +0200 Subject: vim-patch:9.0.0760: display test for 'listchars' "precedes" fails Problem: Display test for 'listchars' "precedes" fails. Solution: Correct the expected result. https://github.com/vim/vim/commit/297164cb7972beff35e375ccac4fbad8196ccbd7 Co-authored-by: Bram Moolenaar --- test/functional/ui/highlight_spec.lua | 2 +- test/old/testdir/test_display.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 01895003ae..89b503141b 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -704,7 +704,7 @@ describe("'listchars' highlight", function() feed_command('set listchars=eol:¬,precedes:< list') feed('90ia') screen:expect([[ - {0:<<<}aaaaaaaaaaaaaaaaa| + {0:<}aaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaa| aaaaaaaaa^a{0:¬} | diff --git a/test/old/testdir/test_display.vim b/test/old/testdir/test_display.vim index aae1030aac..b642f39c9f 100644 --- a/test/old/testdir/test_display.vim +++ b/test/old/testdir/test_display.vim @@ -146,7 +146,7 @@ func Test_display_listchars_precedes() let lines = ScreenLines([1,10], winwidth(0)+1) let expect = [ - \ "<< Date: Thu, 27 Apr 2023 03:36:31 +0200 Subject: vim-patch:9.0.0807: with 'smoothscroll' typing "0" may not go to the first column Problem: With 'smoothscroll' typing "0" may not go to the first column. Solution: Recompute w_cline_height when needed. Do not scroll up when it would move the cursor. https://github.com/vim/vim/commit/d5337efece7c68e9b4ce864532ea49b02453b674 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index b5a571d8b5..42d8f31d3c 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -482,7 +482,14 @@ describe('smoothscroll', function() ]]) -- 'scrolloff' set to 2, scrolling down, cursor moves screen line up feed('gj') - screen:expect_unchanged() + screen:expect([[ + << Date: Thu, 27 Apr 2023 05:27:31 +0200 Subject: vim-patch:9.0.0892: may redraw when not needed Problem: May redraw when not needed, causing slow scrolling. Solution: Do not redraw when w_skipcol doesn't change. When w_skipcol changes only redraw from the top. (issue vim/vim#11559) https://github.com/vim/vim/commit/f32fb93e431e4db95a8663d86dfeb6bffa5896f6 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_alot.vim | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/old/testdir/test_alot.vim b/test/old/testdir/test_alot.vim index 4a22315b9f..2a959f0834 100644 --- a/test/old/testdir/test_alot.vim +++ b/test/old/testdir/test_alot.vim @@ -17,7 +17,6 @@ source test_global.vim source test_move.vim source test_put.vim source test_reltime.vim -source test_scroll_opt.vim source test_searchpos.vim source test_set.vim source test_shift.vim -- cgit From a2f3855291a59254346545f9699084fe4fece31f Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 27 Apr 2023 17:51:47 +0200 Subject: vim-patch:9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is set Problem: 'smoothscroll' cursor calculations wrong when 'number' is set. Solution: Correct the code that computes the width. (closes vim/vim#11492) https://github.com/vim/vim/commit/01ee52bab6041450095c53f9469b1b266a7e3d4d Co-authored-by: Yee Cheng Chin --- test/functional/legacy/scroll_opt_spec.lua | 4 +- test/old/testdir/test_scroll_opt.vim | 66 ++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 42d8f31d3c..8f0286771a 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -279,8 +279,8 @@ describe('smoothscroll', function() ]]) exec('call DoRel()') screen:expect([[ - 2<<" + + " Move down another line to avoid blocking the <<< display + call s:check_col_calc(1, 2, 41) + exe "normal \" + call s:check_col_calc(1, 3, 41) + normal ggg$ + exe "normal \" + + " Move down only 1 line when we are out of the range of the <<< display + call s:check_col_calc(20, 1, 40) + exe "normal \" + call s:check_col_calc(20, 2, 40) + normal gg + + " Test number, where we have indented lines + setl number + call s:check_col_calc(5, 1, 1) + exe "normal \" + call s:check_col_calc(5, 2, 33) + exe "normal \" + call s:check_col_calc(5, 3, 33) + normal ggg$ + exe "normal \" + call s:check_col_calc(20, 1, 32) + exe "normal \" + call s:check_col_calc(20, 2, 32) + normal gg + + " Test number + showbreak, so test that the additional indentation works + setl number showbreak=+++ + call s:check_col_calc(5, 1, 1) + exe "normal \" + call s:check_col_calc(8, 2, 30) + exe "normal \" + call s:check_col_calc(8, 3, 30) + normal gg + + " Test number + cpo+=n mode, where wrapped lines aren't indented + setl number cpo+=n showbreak= + call s:check_col_calc(5, 1, 1) + exe "normal \" + call s:check_col_calc(1, 2, 37) + exe "normal \" + call s:check_col_calc(1, 3, 37) + normal gg + + bwipeout! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 0bcf2a6382eca34a827b678987e03874001d9610 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 27 Apr 2023 18:20:34 +0200 Subject: vim-patch:9.0.0898: with 'smoothscroll' cursor is one screen line too far down Problem: With 'smoothscroll' cursor is one screen line too far down. (Ernie Rael) Solution: Add a test that currently has the wrong result so that a fix can be made. (issue vim/vim#11436) https://github.com/vim/vim/commit/75ac25b4967cdcdfdf2d6c086a6e2308868c280a Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 30 ++++++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 23 +++++++++++++++++++++++ 2 files changed, 53 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 8f0286771a..2f88221032 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -520,4 +520,34 @@ describe('smoothscroll', function() feed('0') screen:expect(s1) end) + + -- oldtest: Test_smoothscroll_long_line_showbreak() + it("cursor is not one screen line too far down", function() + screen:try_resize(40, 6) + exec([[ + " a line that spans four screen lines + call setline(1, 'with lots of text in one line '->repeat(6)) + set smoothscroll scrolloff=0 showbreak=+++\ + ]]) + local s1 = [[ + ^with lots of text in one line with lots | + +++ of text in one line with lots of tex| + +++ t in one line with lots of text in o| + +++ ne line with lots of text in one lin| + +++ e with lots of text in one line | + | + ]] + screen:expect(s1) + feed('') + screen:expect([[ + +++ of text in one line with lots of tex| + +++ ^t in one line with lots of text in o| + +++ ne line with lots of text in one lin| + +++ e with lots of text in one line | + ~ | + | + ]]) + feed('0') + screen:expect(s1) + end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index c3600ab4a7..657172edea 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -325,6 +325,29 @@ func Test_smoothscroll_one_long_line() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_long_line_showbreak() + CheckScreendump + + let lines =<< trim END + vim9script + # a line that spans four screen lines + setline(1, 'with lots of text in one line '->repeat(6)) + set smoothscroll scrolloff=0 showbreak=+++\ + END + call writefile(lines, 'XSmoothLongShowbreak', 'D') + let buf = RunVimInTerminal('-S XSmoothLongShowbreak', #{rows: 6, cols: 40}) + call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {}) + + " FIXME: this currently has the cursor in screen line 2, should be one up. + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_2', {}) + + call term_sendkeys(buf, "0") + call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {}) + + call StopVimInTerminal(buf) +endfunc + " Test that if the current cursor is on a smooth scrolled line, we correctly " reposition it. Also check that we don't miscalculate the values by checking " the consistency between wincol() and col('.') as they are calculated -- cgit From 3621604029119a8806da006eb0468cf65e23b980 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 27 Apr 2023 18:35:25 +0200 Subject: vim-patch:9.0.0900: cursor moves too far with 'smoothscroll' Problem: Cursor moves too far with 'smoothscroll'. Solution: Only move as far as really needed. (Yee Cheng Chin, closes vim/vim#11504) https://github.com/vim/vim/commit/81ba26e9de24ca6b1c05b6ec03e53b21793f1a4b Co-authored-by: Yee Cheng Chin --- test/functional/legacy/scroll_opt_spec.lua | 32 +++++++++++++------- test/old/testdir/test_scroll_opt.vim | 47 +++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 2f88221032..a05470418f 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -279,8 +279,8 @@ describe('smoothscroll', function() ]]) exec('call DoRel()') screen:expect([[ - 2<<>> marker - no need to show whole line + feed('2gj3l2k') + screen:expect([[ + <<<^h some text with some text | + Line with some text with some text with | + some text with some text with some text | + with some text with some text | + Line with some text with some text with | + some text with some text with some text | + with some text with some text | + | + ]]) + -- moving cursor up where the >>> marker is - whole top line shows + feed('2j02k') screen:expect([[ ^Line with some text with some text with | some text with some text with some text | @@ -524,11 +536,9 @@ describe('smoothscroll', function() -- oldtest: Test_smoothscroll_long_line_showbreak() it("cursor is not one screen line too far down", function() screen:try_resize(40, 6) - exec([[ - " a line that spans four screen lines - call setline(1, 'with lots of text in one line '->repeat(6)) - set smoothscroll scrolloff=0 showbreak=+++\ - ]]) + -- a line that spans four screen lines + exec("call setline(1, 'with lots of text in one line '->repeat(6))") + exec('set smoothscroll scrolloff=0 showbreak=+++\\ ') local s1 = [[ ^with lots of text in one line with lots | +++ of text in one line with lots of tex| @@ -540,8 +550,8 @@ describe('smoothscroll', function() screen:expect(s1) feed('') screen:expect([[ - +++ of text in one line with lots of tex| - +++ ^t in one line with lots of text in o| + +++ ^of text in one line with lots of tex| + +++ t in one line with lots of text in o| +++ ne line with lots of text in one lin| +++ e with lots of text in one line | ~ | diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 657172edea..b9645898e8 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -247,10 +247,14 @@ func Test_smoothscroll_wrap_scrolloff_zero() call term_sendkeys(buf, "G") call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {}) - " moving cursor up - whole top line shows - call term_sendkeys(buf, "2k") + " moving cursor up right after the >>> marker - no need to show whole line + call term_sendkeys(buf, "2gj3l2k") call VerifyScreenDump(buf, 'Test_smooth_wrap_5', {}) + " moving cursor up where the >>> marker is - whole top line shows + call term_sendkeys(buf, "2j02k") + call VerifyScreenDump(buf, 'Test_smooth_wrap_6', {}) + call StopVimInTerminal(buf) endfunc @@ -338,7 +342,6 @@ func Test_smoothscroll_long_line_showbreak() let buf = RunVimInTerminal('-S XSmoothLongShowbreak', #{rows: 6, cols: 40}) call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {}) - " FIXME: this currently has the cursor in screen line 2, should be one up. call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_2', {}) @@ -370,10 +373,16 @@ func Test_smoothscroll_cursor_position() call s:check_col_calc(1, 2, 41) exe "normal \" call s:check_col_calc(1, 3, 41) - normal ggg$ + + normal gg3l exe "normal \" " Move down only 1 line when we are out of the range of the <<< display + call s:check_col_calc(4, 1, 24) + exe "normal \" + call s:check_col_calc(4, 2, 24) + normal ggg$ + exe "normal \" call s:check_col_calc(20, 1, 40) exe "normal \" call s:check_col_calc(20, 2, 40) @@ -383,9 +392,11 @@ func Test_smoothscroll_cursor_position() setl number call s:check_col_calc(5, 1, 1) exe "normal \" - call s:check_col_calc(5, 2, 33) + + " Move down only 1 line when the <<< display is on the number column + call s:check_col_calc(5, 1, 17) exe "normal \" - call s:check_col_calc(5, 3, 33) + call s:check_col_calc(5, 2, 17) normal ggg$ exe "normal \" call s:check_col_calc(20, 1, 32) @@ -393,13 +404,33 @@ func Test_smoothscroll_cursor_position() call s:check_col_calc(20, 2, 32) normal gg + setl numberwidth=1 + + " Move down another line when numberwidth is too short to cover the whole + " <<< display + call s:check_col_calc(3, 1, 1) + exe "normal \" + call s:check_col_calc(3, 2, 37) + exe "normal \" + call s:check_col_calc(3, 3, 37) + normal ggl + + " Only move 1 line down when we are just past the <<< display + call s:check_col_calc(4, 1, 2) + exe "normal \" + call s:check_col_calc(4, 1, 20) + exe "normal \" + call s:check_col_calc(4, 2, 20) + normal gg + setl numberwidth& + " Test number + showbreak, so test that the additional indentation works setl number showbreak=+++ call s:check_col_calc(5, 1, 1) exe "normal \" - call s:check_col_calc(8, 2, 30) + call s:check_col_calc(8, 1, 17) exe "normal \" - call s:check_col_calc(8, 3, 30) + call s:check_col_calc(8, 2, 17) normal gg " Test number + cpo+=n mode, where wrapped lines aren't indented -- cgit From 46646a9bb81b72d5579beade64006d6f3dc64d19 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 27 Apr 2023 19:40:00 +0200 Subject: vim-patch:9.0.0908: with 'smoothscroll' cursor may end up in wrong position Problem: With 'smoothscroll' cursor may end up in wrong position. Solution: Correct the computation of screen lines. (Yee Cheng Chin, closes vim/vim#11502) https://github.com/vim/vim/commit/361895d2a15b4b0bbbb4c009261eab5b3d69ebf1 Co-authored-by: Yee Cheng Chin --- test/functional/legacy/scroll_opt_spec.lua | 41 +++++++++++++++++++++++++++++- test/old/testdir/test_scroll_opt.vim | 26 ++++++++++++++++++- 2 files changed, 65 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index a05470418f..6c8ca2cf97 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -410,7 +410,7 @@ describe('smoothscroll', function() it("adjusts the cursor position in a long line", function() screen:try_resize(40, 6) exec([[ - call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30))]) + call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30)) .. ' end', 'four']) set smoothscroll scrolloff=0 normal 3G10|zt ]]) @@ -502,6 +502,45 @@ describe('smoothscroll', function() ith lots of text with lots of text with | | ]]) + -- 'scrolloff' set to 0, move cursor down one line. Cursor should move properly, + -- and since this is a really long line, it will be put on top of the screen. + exec('set scrolloff=0') + feed('0j') + screen:expect([[ + ^four | + ~ | + ~ | + ~ | + ~ | + | + ]]) + -- Repeat the step and move the cursor down again. + -- This time, use a shorter long line that is barely long enough to span more + -- than one window. Note that the cursor is at the bottom this time because + -- Vim prefers to do so if we are scrolling a few lines only. + exec("call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])") + feed('3Gztj') + screen:expect([[ + <<j') + screen:expect([[ + <<repeat(30))]) + setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30)) .. ' end', 'four']) set smoothscroll scrolloff=0 normal 3G10|zt END @@ -304,6 +304,30 @@ func Test_smoothscroll_wrap_long_line() call term_sendkeys(buf, "gj") call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_smooth_long_9', {}) + + " 'scrolloff' set to 0, move cursor down one line. + " Cursor should move properly, and since this is a really long line, it will + " be put on top of the screen. + call term_sendkeys(buf, ":set scrolloff=0\") + call term_sendkeys(buf, "0j") + call VerifyScreenDump(buf, 'Test_smooth_long_10', {}) + + " Repeat the step and move the cursor down again. + " This time, use a shorter long line that is barely long enough to span more + " than one window. Note that the cursor is at the bottom this time because + " Vim prefers to do so if we are scrolling a few lines only. + call term_sendkeys(buf, ":call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])\") + call term_sendkeys(buf, "3Gzt") + call term_sendkeys(buf, "j") + call VerifyScreenDump(buf, 'Test_smooth_long_11', {}) + + " Repeat the step but this time start it when the line is smooth-scrolled by + " one line. This tests that the offset calculation is still correct and + " still end up scrolling down to the next line with cursor at bottom of + " screen. + call term_sendkeys(buf, "3Gzt") + call term_sendkeys(buf, "\j") + call VerifyScreenDump(buf, 'Test_smooth_long_12', {}) call StopVimInTerminal(buf) endfunc -- cgit From 5ba11087b60eb7cbcaa1ea4ccbb0b1a6bcf3c1be Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Fri, 28 Apr 2023 03:59:53 +0200 Subject: vim-patch:9.0.0911: with 'smoothscroll' set mouse click position may be wrong Problem: With 'smoothscroll' set mouse click position may be wrong. Solution: Adjust computations for w_skipcol. (Yee Cheng Chin, closes vim/vim#11514) https://github.com/vim/vim/commit/e6392b102151ec69fad232bcf00591230cef8e1c Co-authored-by: Yee Cheng Chin --- test/old/testdir/test_scroll_opt.vim | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 8d1942e037..3707e211fc 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -2,6 +2,7 @@ source check.vim source screendump.vim +source mouse.vim func Test_reset_scroll() let scr = &l:scroll @@ -469,5 +470,65 @@ func Test_smoothscroll_cursor_position() bwipeout! endfunc +" Test that mouse picking is still accurate when we have smooth scrolled lines +func Test_smoothscroll_mouse_pos() + CheckNotGui + CheckUnix + + let save_mouse = &mouse + "let save_term = &term + "let save_ttymouse = &ttymouse + set mouse=a "term=xterm ttymouse=xterm2 + + call NewWindow(10, 20) + setl smoothscroll wrap + " First line will wrap to 3 physical lines. 2nd/3rd lines are short lines. + call setline(1, ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "line 2", "line 3"]) + + func s:check_mouse_click(row, col, buf_row, buf_col) + call MouseLeftClick(a:row, a:col) + + call assert_equal(a:col, wincol()) + call assert_equal(a:row, winline()) + call assert_equal(a:buf_row, line('.')) + call assert_equal(a:buf_col, col('.')) + endfunc + + " Check that clicking without scroll works first. + call s:check_mouse_click(3, 5, 1, 45) + call s:check_mouse_click(4, 1, 2, 1) + call s:check_mouse_click(4, 6, 2, 6) + call s:check_mouse_click(5, 1, 3, 1) + call s:check_mouse_click(5, 6, 3, 6) + + " Smooth scroll, and checks that this didn't mess up mouse clicking + exe "normal \" + call s:check_mouse_click(2, 5, 1, 45) + call s:check_mouse_click(3, 1, 2, 1) + call s:check_mouse_click(3, 6, 2, 6) + call s:check_mouse_click(4, 1, 3, 1) + call s:check_mouse_click(4, 6, 3, 6) + + exe "normal \" + call s:check_mouse_click(1, 5, 1, 45) + call s:check_mouse_click(2, 1, 2, 1) + call s:check_mouse_click(2, 6, 2, 6) + call s:check_mouse_click(3, 1, 3, 1) + call s:check_mouse_click(3, 6, 3, 6) + + " Make a new first line 11 physical lines tall so it's taller than window + " height, to test overflow calculations with really long lines wrapping. + normal gg + call setline(1, "12345678901234567890"->repeat(11)) + exe "normal 6\" + call s:check_mouse_click(5, 1, 1, 201) + call s:check_mouse_click(6, 1, 2, 1) + call s:check_mouse_click(7, 1, 3, 1) + + let &mouse = save_mouse + "let &term = save_term + "let &ttymouse = save_ttymouse +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From c25fd85c2e618535b7780b965a883cb20ab1aa1a Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Fri, 28 Apr 2023 12:32:39 +0200 Subject: vim-patch:9.0.0998: "gk" may reset skipcol when not needed Problem: "gk" may reset skipcol when not needed. Solution: Only reset skipcol if the cursor column is less. https://github.com/vim/vim/commit/1b73edd9ee40aec400f3611f59823cec5fd1c489 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_scroll_opt.vim | 46 ++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 3707e211fc..c8d0f51384 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -376,6 +376,12 @@ func Test_smoothscroll_long_line_showbreak() call StopVimInTerminal(buf) endfunc +func s:check_col_calc(win_col, win_line, buf_col) + call assert_equal(a:win_col, wincol()) + call assert_equal(a:win_line, winline()) + call assert_equal(a:buf_col, col('.')) +endfunc + " Test that if the current cursor is on a smooth scrolled line, we correctly " reposition it. Also check that we don't miscalculate the values by checking " the consistency between wincol() and col('.') as they are calculated @@ -385,12 +391,6 @@ func Test_smoothscroll_cursor_position() setl smoothscroll wrap call setline(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") - func s:check_col_calc(win_col, win_line, buf_col) - call assert_equal(a:win_col, wincol()) - call assert_equal(a:win_line, winline()) - call assert_equal(a:buf_col, col('.')) - endfunc - call s:check_col_calc(1, 1, 1) exe "normal \" @@ -467,9 +467,41 @@ func Test_smoothscroll_cursor_position() call s:check_col_calc(1, 3, 37) normal gg - bwipeout! + bwipe! endfunc +func Test_smoothscroll_cursor_scrolloff() + call NewWindow(10, 20) + setl smoothscroll wrap + setl scrolloff=3 + + " 120 chars are 6 screen lines + call setline(1, "abcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRST") + call setline(2, "below") + + call s:check_col_calc(1, 1, 1) + + " CTRL-E shows "<<" + call s:check_col_calc(1, 4, 81) + + " cursor on start of second line, "gk" moves into first line, skipcol doesn't + " change + exe "normal G0gk" + call s:check_col_calc(1, 5, 101) + + " move cursor left one window width worth, scrolls one screen line + exe "normal 20h" + call s:check_col_calc(1, 5, 81) + + " move cursor left one window width worth, scrolls one screen line + exe "normal 20h" + call s:check_col_calc(1, 4, 61) + + bwipe! +endfunc + + " Test that mouse picking is still accurate when we have smooth scrolled lines func Test_smoothscroll_mouse_pos() CheckNotGui -- cgit From 6fd7e3bea4c38e79c77fe506a45781ffd17ebe4f Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Fri, 28 Apr 2023 12:36:11 +0200 Subject: vim-patch:9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarily Problem: With 'smoothscroll' skipcol may be reset unnecessarily. Solution: Check the line does actually fit in the window. https://github.com/vim/vim/commit/b21b8e9ed081a6ef6b6745fe65d219b3ac046c3b Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 9 +-------- test/old/testdir/test_scroll_opt.vim | 7 +++++++ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 6c8ca2cf97..31d851f571 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -494,14 +494,7 @@ describe('smoothscroll', function() ]]) -- 'scrolloff' set to 2, scrolling down, cursor moves screen line up feed('gj') - screen:expect([[ - << Date: Fri, 28 Apr 2023 13:34:07 +0200 Subject: vim-patch:9.0.1121: cursor positioning and display problems with 'smoothscroll' Problem: Cursor positioning and display problems with 'smoothscroll' and using "zt", "zb" or "zz". Solution: Adjust computations and conditions. (Yee Cheng Chin, closes vim/vim#11764) https://github.com/vim/vim/commit/db4d88c2adfe8f8122341ac9d6cae27ef78451c8 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 28 ++++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 12 ++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 31d851f571..e58b95ecc1 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -499,6 +499,34 @@ describe('smoothscroll', function() -- and since this is a really long line, it will be put on top of the screen. exec('set scrolloff=0') feed('0j') + screen:expect([[ + <<repeat(10)) .. ' end', 'four'])\") call term_sendkeys(buf, "3Gzt") call term_sendkeys(buf, "j") - call VerifyScreenDump(buf, 'Test_smooth_long_11', {}) + call VerifyScreenDump(buf, 'Test_smooth_long_14', {}) " Repeat the step but this time start it when the line is smooth-scrolled by " one line. This tests that the offset calculation is still correct and @@ -328,7 +336,7 @@ func Test_smoothscroll_wrap_long_line() " screen. call term_sendkeys(buf, "3Gzt") call term_sendkeys(buf, "\j") - call VerifyScreenDump(buf, 'Test_smooth_long_12', {}) + call VerifyScreenDump(buf, 'Test_smooth_long_15', {}) call StopVimInTerminal(buf) endfunc -- cgit From 4e4383ffa2b9ec94e703ecbd6178737fc24f6866 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Fri, 28 Apr 2023 16:22:42 +0200 Subject: vim-patch:9.0.1247: divide by zero with 'smoothscroll' set and a narrow window Problem: Divide by zero with 'smoothscroll' set and a narrow window. Solution: Bail out when the window is too narrow. https://github.com/vim/vim/commit/870219c58c0804bdc55419b2e455c06ac715a835 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 26 ++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 27 +++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index e58b95ecc1..f9dc9e81ca 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -620,4 +620,30 @@ describe('smoothscroll', function() feed('0') screen:expect(s1) end) + + -- oldtest: Test_smoothscroll_zero_width() + it("does not divide by zero with a narrow window", function() + screen:try_resize(12, 2) + screen:set_default_attr_ids({ + [1] = {foreground = Screen.colors.Brown}, + [2] = {foreground = Screen.colors.Blue1, bold = true}, + }) + exec([[ + call setline(1, ['a'->repeat(100)]) + set wrap smoothscroll number laststatus=0 + wincmd v + wincmd v + wincmd v + wincmd v + ]]) + screen:expect([[ + {1: 1^ }│{1: }│{1: }│{1: }│{1: }| + | + ]]) + feed('llllllllllo') + screen:expect([[ + {2:<<<}{1: }aa^aaaaaa| + | + ]]) + end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 3c95c36b4f..4ed54591af 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -577,5 +577,32 @@ func Test_smoothscroll_mouse_pos() "let &ttymouse = save_ttymouse endfunc +" this was dividing by zero +func Test_smoothscrol_zero_width() + CheckScreendump + + let lines =<< trim END + winsize 0 0 + vsplit + vsplit + vsplit + vsplit + vsplit + sil norm H + set wrap + set smoothscroll + set number + END + call writefile(lines, 'XSmoothScrollZero', 'D') + let buf = RunVimInTerminal('-u NONE -i NONE -n -m -X -Z -e -s -S XSmoothScrollZero', #{rows: 6, cols: 60, wait_for_ruler: 0}) + call TermWait(buf, 3000) + call VerifyScreenDump(buf, 'Test_smoothscroll_zero_1', {}) + + call term_sendkeys(buf, ":sil norm \\\\\") + call VerifyScreenDump(buf, 'Test_smoothscroll_zero_2', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 7d5673b18b8b4ff085473b40fce317e760e48ce3 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 29 Apr 2023 00:16:37 +0200 Subject: vim-patch:9.0.1367: divide by zero in zero-width window Problem: Divide by zero in zero-width window. Solution: Check the width is positive. https://github.com/vim/vim/commit/e0f869196930ef5f25a0ac41c9215b09c9ce2d3c Co-authored-by: Bram Moolenaar --- test/old/testdir/test_window_cmd.vim | 39 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_window_cmd.vim b/test/old/testdir/test_window_cmd.vim index f938203736..f18d1719c0 100644 --- a/test/old/testdir/test_window_cmd.vim +++ b/test/old/testdir/test_window_cmd.vim @@ -1734,7 +1734,7 @@ func Test_splitkeep_options() " let &t_WS = save_WS endfunc -function Test_splitkeep_cmdwin_cursor_position() +func Test_splitkeep_cmdwin_cursor_position() set splitkeep=screen call setline(1, range(&lines)) @@ -1759,9 +1759,9 @@ function Test_splitkeep_cmdwin_cursor_position() %bwipeout! set splitkeep& -endfunction +endfunc -function Test_splitkeep_misc() +func Test_splitkeep_misc() set splitkeep=screen set splitbelow @@ -1794,7 +1794,7 @@ function Test_splitkeep_misc() set splitkeep& endfunc -function Test_splitkeep_callback() +func Test_splitkeep_callback() CheckScreendump let lines =<< trim END set splitkeep=screen @@ -1827,7 +1827,7 @@ function Test_splitkeep_callback() call StopVimInTerminal(buf) endfunc -function Test_splitkeep_fold() +func Test_splitkeep_fold() CheckScreendump let lines =<< trim END @@ -1857,9 +1857,9 @@ function Test_splitkeep_fold() call VerifyScreenDump(buf, 'Test_splitkeep_fold_4', {}) call StopVimInTerminal(buf) -endfunction +endfunc -function Test_splitkeep_status() +func Test_splitkeep_status() CheckScreendump let lines =<< trim END @@ -1877,9 +1877,9 @@ function Test_splitkeep_status() call VerifyScreenDump(buf, 'Test_splitkeep_status_1', {}) call StopVimInTerminal(buf) -endfunction +endfunc -function Test_new_help_window_on_error() +func Test_new_help_window_on_error() help change.txt execute "normal! /CTRL-@\" silent! execute "normal! \]" @@ -1889,7 +1889,26 @@ function Test_new_help_window_on_error() call assert_equal(wincount, winnr('$')) call assert_equal(expand(""), "'mod'") -endfunction +endfunc + +func Test_smoothscroll_in_zero_width_window() + let save_lines = &lines + let save_columns = &columns + + winsize 0 24 + set cpo+=n + exe "noremap 0 \n\L" + norm 000000 + set number smoothscroll + exe "norm \" + + only! + let &lines = save_lines + let &columns = save_columns + set cpo-=n + unmap 0 + set nonumber nosmoothscroll +endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From 35ed79a9150fed877e660395c64d6659bf0a07ec Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 29 Apr 2023 00:34:09 +0200 Subject: vim-patch:9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set Problem: Scrolling too many lines when 'wrap' and 'diff' are set. Solution: Only scroll by screenlines for 'diff' when 'wrap' is not set. (closes vim/vim#12211) https://github.com/vim/vim/commit/38d867f041349e1400c2cce9cac06f59ae6ccbb1 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_diffmode.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 0049398776..ac90aaaa02 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -1605,6 +1605,21 @@ func Test_diff_scroll() call delete('Xright') endfunc +" This was scrolling too many lines. +func Test_diff_scroll_wrap_on() + 20new + 40vsplit + call setline(1, map(range(1, 9), 'repeat(v:val, 200)')) + setlocal number diff so=0 + redraw + normal! jj + call assert_equal(1, winsaveview().topline) + normal! j + call assert_equal(2, winsaveview().topline) + bwipe! + bwipe! +endfunc + " This was trying to update diffs for a buffer being closed func Test_diff_only() silent! lfile -- cgit From f78130b2d84a950ed7a13a5cbd946cba6c5c68f7 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 29 Apr 2023 23:02:29 +0200 Subject: test: 'smoothscroll' works with virt_lines above and below --- test/functional/legacy/scroll_opt_spec.lua | 73 ++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index f9dc9e81ca..253b20df5c 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -646,4 +646,77 @@ describe('smoothscroll', function() | ]]) end) + + it("works with virt_lines above and below", function() + screen:try_resize(55, 7) + exec([=[ + call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(3)) + set smoothscroll + let ns = nvim_create_namespace('') + call nvim_buf_set_extmark(0, ns, 0, 0, {'virt_lines':[[['virt_below1']]]}) + call nvim_buf_set_extmark(0, ns, 1, 0, {'virt_lines':[[['virt_above1']]],'virt_lines_above':1}) + call nvim_buf_set_extmark(0, ns, 1, 0, {'virt_lines':[[['virt_below2']]]}) + call nvim_buf_set_extmark(0, ns, 2, 0, {'virt_lines':[[['virt_above2']]],'virt_lines_above':1}) + norm ggL + ]=]) + screen:expect([[ + Line with some text with some text with some text with | + some text with some text with some text with some text | + virt_below1 | + virt_above1 | + ^Line with some text with some text with some text with | + some text with some text with some text with some text | + | + ]]) + feed('') + screen:expect([[ + <<') + screen:expect([[ + virt_below1 | + virt_above1 | + ^Line with some text with some text with some text with | + some text with some text with some text with some text | + virt_below2 | + virt_above2 | + | + ]]) + feed('') + screen:expect([[ + virt_above1 | + ^Line with some text with some text with some text with | + some text with some text with some text with some text | + virt_below2 | + virt_above2 | + Line with some text with some text with some text wi@@@| + | + ]]) + feed('') + screen:expect([[ + ^Line with some text with some text with some text with | + some text with some text with some text with some text | + virt_below2 | + virt_above2 | + Line with some text with some text with some text with | + some text with some text with some text with some text | + | + ]]) + feed('') + screen:expect([[ + << Date: Sun, 30 Apr 2023 22:04:35 +0200 Subject: vim-patch:9.0.1502: no test for deleting the end of a long wrapped line Problem: No test for deleting the end of a long wrapped line. Solution: Add a test to check the right text is displayed. (Luuk van Baal, closes vim/vim#12318) https://github.com/vim/vim/commit/5b10a140983c16140d69a214494c4b8af8b34763 Co-authored-by: Luuk van Baal --- test/functional/legacy/display_spec.lua | 47 +++++++++++++++++++++++++++++++++ test/old/testdir/test_display.vim | 21 +++++++++++++++ 2 files changed, 68 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua index f9b78f5dcd..4952a5c4fe 100644 --- a/test/functional/legacy/display_spec.lua +++ b/test/functional/legacy/display_spec.lua @@ -194,4 +194,51 @@ describe('display', function() it('display "lastline" works correctly with multibyte fillchar', function() run_test_display_lastline(true) end) + + -- oldtest: Test_display_long_lastline + it('display "lastline" shows correct text when end of wrapped line is deleted', function() + local screen = Screen.new(35, 14) + screen:attach() + exec([[ + set display=lastline scrolloff=5 + call setline(1, [ + \'aaaaa'->repeat(100), + \'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7) + \]) + ]]) + feed('482|') + screen:expect([[ + <<repeat(100), + \'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7) + \]) + END + + call writefile(lines, 'XdispLongline', 'D') + let buf = RunVimInTerminal('-S XdispLongline', #{rows: 14, cols: 35}) + + call term_sendkeys(buf, "482|") + call VerifyScreenDump(buf, 'Test_display_long_line_1', {}) + call term_sendkeys(buf, "D") + call VerifyScreenDump(buf, 'Test_display_long_line_2', {}) + + call StopVimInTerminal(buf) +endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From 3b906af27fbd27a148ed6ca66e79b273ba5e8521 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Mon, 1 May 2023 14:42:30 +0200 Subject: test: 'smoothscroll' <<< marker shows with tabline, winbar and splits --- test/functional/legacy/scroll_opt_spec.lua | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 253b20df5c..b00ff0bc7a 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -719,4 +719,59 @@ describe('smoothscroll', function() | ]]) end) + + it('<<< marker shows with tabline, winbar and splits', function() + screen:try_resize(40, 12) + exec([[ + call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7)) + set smoothscroll scrolloff=0 + norm sj + ]]) + screen:expect([[ + <<') + screen:expect([[ + 2+ [No Name] | + <<k') + screen:expect([[ + 2+ [No Name] | + winbar | + <<