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 +++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 test/functional/legacy/scroll_opt_spec.lua (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- 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 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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([[ -- 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 ++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 14 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- 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/functional/legacy/scroll_opt_spec.lua') 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: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 ++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- cgit From 8e4a4629cab3377ba6fd5e291cf5f17fb4ff8a5c Mon Sep 17 00:00:00 2001 From: Luuk van Baal 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 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- 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 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- 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 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- cgit From f3de7f44685c8ec99c1f5c7a624a668044c5aa19 Mon Sep 17 00:00:00 2001 From: Luuk van Baal 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 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- 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 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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([[ + << 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 ++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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([[ - << 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 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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<< 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 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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([[ + << 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/functional/legacy/scroll_opt_spec.lua') 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 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 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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<< 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 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- 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 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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 | ~ | -- 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 +++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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([[ + << 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 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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([[ + << 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 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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) -- 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/functional/legacy/scroll_opt_spec.lua') 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: 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/functional/legacy/scroll_opt_spec.lua') 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 | + << Date: Wed, 3 May 2023 07:21:09 +0800 Subject: vim-patch:9.0.1506: line number not displayed when using 'smoothscroll' (#23453) Problem: Line number not displayed when using 'smoothscroll'. Solution: Adjust condition for showing the line number. (closes vim/vim#12333) https://github.com/vim/vim/commit/88bb3e0a48f160134bdea98cd2b8bd3af86f9d6f --- test/functional/legacy/scroll_opt_spec.lua | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index b00ff0bc7a..8af23d2c26 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -179,6 +179,7 @@ describe('smoothscroll', function() exec([[ call setline(1, [ 'one ' .. 'word '->repeat(20), 'two ' .. 'long word '->repeat(7), 'line', 'line', 'line', ]) set smoothscroll scrolloff=5 + set splitkeep=topline set number cpo+=n :3 func g:DoRel() @@ -277,6 +278,53 @@ describe('smoothscroll', function() ~ | | ]]) + exec('botright split') + feed('gg') + 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@@@| + [No Name] [+] | + 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 @@@| + [No Name] [+] | + | + ]]) + 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@@@| + [No Name] [+] | + <<< 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 | + [No Name] [+] | + | + ]]) + 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@@@| + [No Name] [+] | + <<< 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 | + [No Name] [+] | + | + ]]) + exec('close') exec('call DoRel()') screen:expect([[ 2<<<^ong text very long text very long te| -- cgit From 3b2bd8d69e6c0a173562778fae6ece67d9adf52c Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 6 May 2023 17:33:42 +0200 Subject: vim-patch:9.0.1512: inserting lines when scrolling with 'smoothscroll' set Problem: Inserting lines when scrolling with 'smoothscroll' set. Solution: Adjust line height computation for w_skipcol. (Luuk van Baal, closes vim/vim#12350) https://github.com/vim/vim/commit/c8502f9b880b6d23baa4f9d28b60e1ceb442e35f --- test/functional/legacy/scroll_opt_spec.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 8af23d2c26..c3c99b506b 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -695,6 +695,30 @@ describe('smoothscroll', function() ]]) end) + -- oldtest: Test_smoothscroll_ins_lines() + it("this was unnecessarily inserting lines", function() + screen:try_resize(40, 6) + exec([=[ + set wrap smoothscroll scrolloff=0 conceallevel=2 concealcursor=nc + call setline(1, [ + \'line one' .. 'with lots of text in one line '->repeat(2), + \'line two', + \'line three', + \'line four', + \'line five' + \]) + ]=]) + feed('gjgk') + screen:expect([[ + << Date: Tue, 9 May 2023 01:44:31 +0200 Subject: vim-patch:9.0.1525: 'smoothscroll' does not always work properly (#23544) Problem: 'smoothscroll' does not always work properly. Solution: Do not reset w_skipcol after it was intentionally set. (Luuk van Baal, closes vim/vim#12360, closes vim/vim#12199, closes vim/vim#12323) https://github.com/vim/vim/commit/3ce8c389155fc1257082cdb0cef7801b49f6aaf9 --- test/functional/legacy/scroll_opt_spec.lua | 69 ++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 4 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index c3c99b506b..869763be3c 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -548,11 +548,11 @@ describe('smoothscroll', function() exec('set scrolloff=0') feed('0j') screen:expect([[ - <<repeat(&lines * &columns), + \(('_')->repeat(&columns - 2) .. 'xxx')->repeat(2) + \]) + autocmd CursorMoved * eval [line('w0'), line('w$')] + call search('xxx') + ]=]) + screen:expect([[ + <<<_____________________________________| + ________________________________________| + ______________________________________^xx| + x______________________________________x| + xx | + | + ]]) + end) + + -- oldtest: Test_smoothscroll_eob() + it("does not scroll halfway at end of buffer", function() + screen:try_resize(40, 10) + exec([[ + set smoothscroll + call setline(1, ['']->repeat(100)) + norm G + ]]) + -- does not scroll halfway when scrolling to end of buffer + screen:expect([[ + | + | + | + | + | + | + | + | + ^ | + | + ]]) + exec("call setline(92, 'a'->repeat(100))") + feed('G') + -- cursor is not placed below window + screen:expect([[ + << Date: Tue, 9 May 2023 22:41:02 +0200 Subject: vim-patch:9.0.1533: test for 'smoothscroll' is ineffective Problem: Test for 'smoothscroll' is ineffective. Solution: Change the order of testing "zb" and "zt". (Luuk van Baal, closes vim/vim#12366) https://github.com/vim/vim/commit/6f37e530d3e2d58ff055723047bf91d91af2632c --- test/functional/legacy/scroll_opt_spec.lua | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 869763be3c..e567d238b2 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -556,13 +556,13 @@ describe('smoothscroll', function() | ]]) -- Test zt/zz/zb that they work properly when a long line is above it - feed('zb') + feed('zt') screen:expect([[ - <<repeat(10)) .. ' end', 'four'])") feed('3Gztj') - screen:expect([[ - << Date: Thu, 11 May 2023 20:37:49 +0200 Subject: vim-patch:9.0.1543: display errors when making topline shorter Problem: Display errors when making topline shorter and 'smoothscroll' is set. Solution: Reset w_skipcol when the topline becomes shorter than its current value. (Luuk van Baal, closes vim/vim#12367) https://github.com/vim/vim/commit/5d01f86d99bc3a3fd92d4f4e9338a9e78e9ebe16 --- test/functional/legacy/scroll_opt_spec.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index e567d238b2..838ada4006 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -588,6 +588,9 @@ describe('smoothscroll', function() -- 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'])") + -- Currently visible lines were replaced, test that the lines and cursor + -- are correctly displayed. + screen:expect_unchanged() feed('3Gztj') screen:expect_unchanged() -- Repeat the step but this time start it when the line is smooth-scrolled by -- cgit From 02ef104d5bcd40c048e8011e0106f30389034674 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Fri, 19 May 2023 16:14:41 +0200 Subject: vim-patch:9.0.1564: display moves up and down with 'incsearch' and 'smoothscroll' Problem: Display moves up and down with 'incsearch' and 'smoothscroll'. Solution: Do not check if w_skipcol changed. (Luuk van Baal, closes vim/vim#12410, closes vim/vim#12409) https://github.com/vim/vim/commit/0222c2d103ad9298bec4dc8864cd80b4e7559db1 --- test/functional/legacy/scroll_opt_spec.lua | 35 +++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 838ada4006..056262939b 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -422,12 +422,41 @@ describe('smoothscroll', function() | ]]) feed('j') - screen:expect_unchanged() + 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 | + @ | + | + ]]) -- moving cursor down - whole bottom line shows feed('j') - screen:expect_unchanged() + screen:expect([[ + <<>> marker - no need to show whole line feed('2gj3l2k') screen:expect([[ -- cgit From cf0f83ebf0d74b11c1ffdc4d1066555f312a91ec Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Fri, 19 May 2023 18:42:54 +0200 Subject: vim-patch:9.0.1568: with 'smoothscroll' cursor may move below botline Problem: With 'smoothscroll' cursor may move below botline. Solution: Call redraw_later() if needed, Compute cursor row with adjusted condition. (Luuk van Baal, closes vim/vim#12415) https://github.com/vim/vim/commit/d49f646bf56b29d44bbb16e79bc877b59aab38ac --- test/functional/legacy/scroll_opt_spec.lua | 102 +++++++++++++++++++---------- 1 file changed, 68 insertions(+), 34 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 056262939b..cd4c2fda8b 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -422,42 +422,15 @@ describe('smoothscroll', function() | ]]) feed('j') - 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 | - @ | - | - ]]) + screen:expect_unchanged() -- moving cursor down - whole bottom line shows feed('j') - screen:expect([[ - <<>> marker - no need to show whole line + screen:expect_unchanged() + feed('4G') + screen:expect_unchanged() + -- moving cursor up right after the <<< marker - no need to show whole line feed('2gj3l2k') screen:expect([[ <<<^h some text with some text | @@ -469,7 +442,7 @@ describe('smoothscroll', function() with some text with some text | | ]]) - -- moving cursor up where the >>> marker is - whole top line shows + -- moving cursor up where the <<< marker is - whole top line shows feed('2j02k') screen:expect([[ ^Line with some text with some text with | @@ -805,6 +778,67 @@ describe('smoothscroll', function() ]]) end) + -- oldtest: Test_smoothscroll_incsearch() + it("does not reset skipcol when doing incremental search on the same word", function() + screen:try_resize(40, 8) + screen:set_default_attr_ids({ + [1] = {foreground = Screen.colors.Brown}, + [2] = {foreground = Screen.colors.Blue1, bold = true}, + [3] = {background = Screen.colors.Yellow1}, + [4] = {reverse = true}, + }) + exec([[ + set smoothscroll number scrolloff=0 incsearch + call setline(1, repeat([''], 20)) + call setline(11, repeat('a', 100)) + call setline(14, 'bbbb') + ]]) + feed('/b') + screen:expect([[ + {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa | + {1: 12 } | + {1: 13 } | + {1: 14 }{4:b}{3:bbb} | + {1: 15 } | + {1: 16 } | + {1: 17 } | + /b^ | + ]]) + feed('b') + screen:expect([[ + {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa | + {1: 12 } | + {1: 13 } | + {1: 14 }{4:bb}{3:bb} | + {1: 15 } | + {1: 16 } | + {1: 17 } | + /bb^ | + ]]) + feed('b') + screen:expect([[ + {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa | + {1: 12 } | + {1: 13 } | + {1: 14 }{4:bbb}b | + {1: 15 } | + {1: 16 } | + {1: 17 } | + /bbb^ | + ]]) + feed('b') + screen:expect([[ + {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa | + {1: 12 } | + {1: 13 } | + {1: 14 }{4:bbbb} | + {1: 15 } | + {1: 16 } | + {1: 17 } | + /bbbb^ | + ]]) + end) + it("works with virt_lines above and below", function() screen:try_resize(55, 7) exec([=[ -- cgit From 53f30de2becded95f9113b75367a9dd7563c183e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 4 Jun 2023 07:39:05 +0800 Subject: vim-patch:9.0.1602: stray character visible if marker on top of double-wide char (#23897) Problem: Stray character is visible if 'smoothscroll' marker is displayed on top of a double-wide character. Solution: When overwriting a double-width character with the 'smoothscroll' marker clear the second half. (closes vim/vim#12469) https://github.com/vim/vim/commit/ecb87dd7d3f7b9291092a7dd8fae1e59b9903252 --- test/functional/legacy/scroll_opt_spec.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index cd4c2fda8b..3320f96668 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -667,6 +667,32 @@ describe('smoothscroll', function() screen:expect(s1) end) + -- oldtest: Test_smoothscroll_marker_over_double_width_dump() + it('marker is drawn over double-width char correctly', function() + screen:try_resize(40, 6) + exec([[ + call setline(1, 'a'->repeat(&columns) .. '口'->repeat(10)) + setlocal smoothscroll + ]]) + screen:expect([[ + ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + 口口口口口口口口口口 | + ~ | + ~ | + ~ | + | + ]]) + feed('') + screen:expect([[ + <<< 口口口口口口口^口 | + ~ | + ~ | + ~ | + ~ | + | + ]]) + end) + -- oldtest: Test_smoothscroll_zero_width() it("does not divide by zero with a narrow window", function() screen:try_resize(12, 2) -- cgit From 9978a9996dae9b62763db6772e7f1f777caacb45 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Jun 2023 06:26:13 +0800 Subject: vim-patch:9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll' Problem: Display wrong when scrolling multiple lines with 'smoothscroll' set. Solution: Redraw when w_skipcol changed. (closes vim/vim#12477, closes vim/vim#12468) https://github.com/vim/vim/commit/3c802277604a6b21110e41bedfe4c937ba7c2b7d --- test/functional/legacy/scroll_opt_spec.lua | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 3320f96668..bb0ada15e9 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -865,6 +865,48 @@ describe('smoothscroll', function() ]]) end) + -- oldtest: Test_smoothscroll_multi_skipcol() + it('scrolling mulitple lines and stopping at non-zero skipcol', function() + screen:try_resize(40, 10) + screen:set_default_attr_ids({ + [0] = {foreground = Screen.colors.Blue, bold = true}, + [1] = {background = Screen.colors.Grey90}, + }) + exec([[ + setlocal cursorline scrolloff=0 smoothscroll + call setline(1, repeat([''], 9)) + call setline(3, repeat('a', 50)) + call setline(8, 'bbb') + call setline(9, 'ccc') + redraw + ]]) + screen:expect([[ + {1:^ }| + | + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaa | + | + | + | + | + bbb | + | + ]]) + feed('3') + screen:expect([[ + {0:<<<}{1:aaaaaa^a }| + | + | + | + | + bbb | + ccc | + {0:~ }| + {0:~ }| + | + ]]) + end) + it("works with virt_lines above and below", function() screen:try_resize(55, 7) exec([=[ -- cgit From fc908b500683215085ee6c12b41aa227332b7bbe Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Jun 2023 06:34:02 +0800 Subject: vim-patch:9.0.1610: display is wrong when 'smoothscroll' is set Problem: Display is wrong when 'smoothscroll' is set and scrolling multiple lines. Solution: Redraw with UPD_NOT_VALID when "skipcol" is or was set. (closes vim/vim#12490, closes vim/vim#12468) https://github.com/vim/vim/commit/d9a92dc70b20c76cef9ca186676583c92c14311c --- test/functional/legacy/scroll_opt_spec.lua | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index bb0ada15e9..a5a6aded79 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -874,10 +874,11 @@ describe('smoothscroll', function() }) exec([[ setlocal cursorline scrolloff=0 smoothscroll - call setline(1, repeat([''], 9)) + call setline(1, repeat([''], 8)) call setline(3, repeat('a', 50)) - call setline(8, 'bbb') - call setline(9, 'ccc') + call setline(4, repeat('a', 50)) + call setline(7, 'bbb') + call setline(8, 'ccc') redraw ]]) screen:expect([[ @@ -885,8 +886,8 @@ describe('smoothscroll', function() | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| aaaaaaaaaa | - | - | + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaa | | | bbb | @@ -895,13 +896,26 @@ describe('smoothscroll', function() feed('3') screen:expect([[ {0:<<<}{1:aaaaaa^a }| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaa | | | + bbb | + ccc | + {0:~ }| + {0:~ }| + | + ]]) + feed('2') + screen:expect([[ + {0:<<<}{1:aaaaaa^a }| | | bbb | ccc | {0:~ }| + {0:~ }| + {0:~ }| {0:~ }| | ]]) -- cgit 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 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') 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([[ -- cgit From 3b6fb3fefd0bde9bd0700987c4db549a7f4916ec Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 25 Jun 2023 08:15:45 +0800 Subject: vim-patch:9.0.1664: divide by zero when scrolling with 'smoothscroll' set Problem: Divide by zero when scrolling with 'smoothscroll' set. Solution: Avoid using a negative width. (closes vim/vim#12540, closes vim/vim#12528) https://github.com/vim/vim/commit/8154e642aa476e1a5d3de66c34e8289845b2b797 Co-authored-by: fullwaywang --- test/functional/legacy/scroll_opt_spec.lua | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 3b755ff3e8..165570e7ec 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -939,6 +939,48 @@ describe('smoothscroll', function() ]]) end) + -- oldtest: Test_smoothscroll_zero_width_scroll_cursor_bot() + it('does not divide by zero in zero-width window', function() + screen:try_resize(12, 19) + screen:set_default_attr_ids({ + [1] = {foreground = Screen.colors.Brown}; -- LineNr + [2] = {bold = true, reverse = true}; -- StatusLine + [3] = {reverse = true}; -- StatusLineNC + }) + exec([[ + silent normal yy + silent normal 19p + winsize 0 19 + vsplit + vertical resize 0 + set foldcolumn=1 + set number + set smoothscroll + silent normal 20G + ]]) + screen:expect([[ + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1: }│ | + {1:^ }│ | + {2:< }{3: Date: Tue, 27 Jun 2023 08:22:21 +0800 Subject: vim-patch:9.0.1667: regression test doesn't fail when fix is reverted Problem: Regression test doesn't fail when fix is reverted. Solution: Add "n" to 'cpoptions' instead of using :winsize. (closes vim/vim#12587, issue vim/vim#12528) https://github.com/vim/vim/commit/e42989374144a63d986b878618aeac328e35ac3b --- test/functional/legacy/scroll_opt_spec.lua | 47 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 165570e7ec..ae6a409762 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -941,16 +941,17 @@ describe('smoothscroll', function() -- oldtest: Test_smoothscroll_zero_width_scroll_cursor_bot() it('does not divide by zero in zero-width window', function() - screen:try_resize(12, 19) + screen:try_resize(40, 19) screen:set_default_attr_ids({ [1] = {foreground = Screen.colors.Brown}; -- LineNr - [2] = {bold = true, reverse = true}; -- StatusLine - [3] = {reverse = true}; -- StatusLineNC + [2] = {bold = true, foreground = Screen.colors.Blue}; -- NonText + [3] = {bold = true, reverse = true}; -- StatusLine + [4] = {reverse = true}; -- StatusLineNC }) exec([[ silent normal yy silent normal 19p - winsize 0 19 + set cpoptions+=n vsplit vertical resize 0 set foldcolumn=1 @@ -959,25 +960,25 @@ describe('smoothscroll', function() silent normal 20G ]]) screen:expect([[ - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1: }│ | - {1:^ }│ | - {2:< }{3: Date: Wed, 5 Jul 2023 16:30:23 +0800 Subject: fix(plines): don't return very large height on very long line (#24260) --- test/functional/legacy/scroll_opt_spec.lua | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index ae6a409762..b179338665 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -1109,4 +1109,44 @@ describe('smoothscroll', function() | ]]) end) + + it('works with very long line', function() + screen:set_default_attr_ids({ + [1] = {foreground = Screen.colors.Brown}, + [2] = {foreground = Screen.colors.Blue1, bold = true}, + }) + exec([[ + edit test/functional/fixtures/bigfile_oneline.txt + setlocal smoothscroll number + ]]) + screen:expect([[ + {1: 1 }^0000;;Cc;0;BN;;;;;N;NULL;;;| + {1: }; 0001;;Cc;0;BN;;;;;N;START| + {1: } OF HEADING;;;; 0002;;Cc;0;| + {1: }BN;;;;;N;START OF TEXT;;;; 0003;;Cc;0;BN;;;;;N;END OF TEXT;;;; | + {1: }0004;;Cc;0;BN;;;;;N;END OF | + {1: }TRANSMISSION;;;; 0005;;Cc;0| + {1: };BN;;;;;N;ENQUIRY;;;; 0006;| + {1: };Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; 0007;| + {1: };Cc;0;BN;;;;;N;BELL;;;; 000| + {1: }8;;Cc;0;BN;;;;;N;BACKSPACE;| + | + ]]) + feed('j') + screen:expect([[ + {2:<<<}{1: }CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo| + {1: };0;L;243AB;;;;N;;;;; 2F920;CJK COMPA| + {1: }TIBILITY IDEOGRAPH-2F920;Lo;0;L;7228| + {1: };;;;N;;;;; 2F921;CJK COMPATIBILITY I| + {1: }DEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;;| + {1: } 2F922;CJK COMPATIBILITY IDEOGRAPH-2| + {1: }F922;Lo;0;L;7250;;;;N;;;;; | + {1: 2 }^2F923;CJK COMPATIBILITY IDEOGRAPH-2F| + {1: }923;Lo;0;L;24608;;;;N;;;;; | + {1: 3 }2F924;CJK COMPATIBILITY IDEOGRAPH-2F| + {1: }924;Lo;0;L;7280;;;;N;;;;; | + | + ]]) + end) end) -- cgit From 2dc9ceb99c018b15dcf0c443cad46efecccaf94e Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 29 Oct 2023 09:02:32 +0100 Subject: docs: small fixes (#25585) Co-authored-by: tmummert Co-authored-by: parikshit adhikari --- test/functional/legacy/scroll_opt_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index b179338665..5b4bfb3caa 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -884,7 +884,7 @@ describe('smoothscroll', function() end) -- oldtest: Test_smoothscroll_multi_skipcol() - it('scrolling mulitple lines and stopping at non-zero skipcol', function() + it('scrolling multiple lines and stopping at non-zero skipcol', function() screen:try_resize(40, 10) screen:set_default_attr_ids({ [0] = {foreground = Screen.colors.Blue, bold = true}, -- cgit From f4d95c05b98c2ce2f70e73d4fe6a03cf54ed44cd Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 14 Nov 2023 23:28:56 +0100 Subject: vim-patch:9.0.2105: skipcol not reset when topline changed (#26042) Problem: Skipcol is not reset when topline changed scrolling cursor to top Solution: reset skipcol closes: vim/vim#13528 https://github.com/vim/vim/commit/bb800a7907209f7d349f87b76b3b9ca30b416298 --- test/functional/legacy/scroll_opt_spec.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 5b4bfb3caa..d4e4702f5e 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -982,6 +982,31 @@ describe('smoothscroll', function() ]]) end) + -- oldtest: Test_smoothscroll_cursor_top() + it('resets skipcol when scrolling cursor to top', function() + screen:try_resize(40, 12) + exec([[ + set smoothscroll scrolloff=2 + new | 11resize | wincmd j + call setline(1, ['line1', 'line2', 'line3'->repeat(20), 'line4']) + exe "norm G3\k" + ]]) + screen:expect([[ + | + [No Name] | + line1 | + line2 | + ^line3line3line3line3line3line3line3line3| + line3line3line3line3line3line3line3line3| + line3line3line3line3 | + line4 | + ~ | + ~ | + [No Name] [+] | + | + ]]) + end) + it("works with virt_lines above and below", function() screen:try_resize(55, 7) exec([=[ -- cgit From 6952b1951b6a60df8d477279f4451094fb51c413 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 17 Nov 2023 08:40:02 +0800 Subject: vim-patch:9.0.2107: [security]: FPE in adjust_plines_for_skipcol (#26082) Problem: [security]: FPE in adjust_plines_for_skipcol Solution: don't divide by zero, return zero Prevent a floating point exception when calculating w_skipcol (which can happen with a small window when the number option is set and cpo+=n). Add a test to verify https://github.com/vim/vim/commit/cb0b99f0672d8446585d26e998343dceca17d1ce Co-authored-by: Christian Brabandt --- test/functional/legacy/scroll_opt_spec.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/functional/legacy/scroll_opt_spec.lua') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index d4e4702f5e..8ac1141c2b 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear = helpers.clear local exec = helpers.exec local feed = helpers.feed +local assert_alive = helpers.assert_alive before_each(clear) @@ -1007,6 +1008,21 @@ describe('smoothscroll', function() ]]) end) + -- oldtest: Test_smoothscroll_crash() + it('does not crash with small window and cpo+=n', function() + screen:try_resize(40, 12) + exec([[ + 20 new + vsp + put =repeat('aaaa', 20) + set nu fdc=1 smoothscroll cpo+=n + vert resize 0 + exe "norm! 0\" + ]]) + feed('2') + assert_alive() + end) + it("works with virt_lines above and below", function() screen:try_resize(55, 7) exec([=[ -- cgit