diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-04-29 23:02:29 +0200 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2023-05-02 13:11:47 +0200 |
commit | f78130b2d84a950ed7a13a5cbd946cba6c5c68f7 (patch) | |
tree | 7cb2a110de6c9fdc7f48ba7ad5eb89709d4867a3 | |
parent | 35ed79a9150fed877e660395c64d6659bf0a07ec (diff) | |
download | rneovim-f78130b2d84a950ed7a13a5cbd946cba6c5c68f7.tar.gz rneovim-f78130b2d84a950ed7a13a5cbd946cba6c5c68f7.tar.bz2 rneovim-f78130b2d84a950ed7a13a5cbd946cba6c5c68f7.zip |
test: 'smoothscroll' works with virt_lines above and below
-rw-r--r-- | runtime/doc/news.txt | 3 | ||||
-rw-r--r-- | test/functional/legacy/scroll_opt_spec.lua | 73 |
2 files changed, 76 insertions, 0 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index f33cffa22e..bc357ac534 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -49,6 +49,9 @@ iterators |luaref-in|. • Added |vim.treesitter.query.omnifunc()| for treesitter query files (set by default). +• |'smoothscroll'| option to scroll by screen line rather than by text line +when |'wrap'| is set. + ============================================================================== CHANGED FEATURES *news-changed* 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('<C-E>') + screen:expect([[ + <<<e 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 | + virt_below2 | + | + ]]) + feed('<C-E>') + 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('<C-E>') + 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('<C-E>') + 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('<C-E>') + screen:expect([[ + <<<e text with some text with some text with some tex^t | + 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 | + ~ | + | + ]]) + end) end) |