aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/window_cmd_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /test/functional/legacy/window_cmd_spec.lua
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.gz
rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.bz2
rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'test/functional/legacy/window_cmd_spec.lua')
-rw-r--r--test/functional/legacy/window_cmd_spec.lua110
1 files changed, 110 insertions, 0 deletions
diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua
index 0e9775060d..979b46ae47 100644
--- a/test/functional/legacy/window_cmd_spec.lua
+++ b/test/functional/legacy/window_cmd_spec.lua
@@ -3,8 +3,37 @@ local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local exec = helpers.exec
local exec_lua = helpers.exec_lua
+local command = helpers.command
local feed = helpers.feed
+-- oldtest: Test_window_cmd_ls0_split_scrolling()
+it('scrolling with laststatus=0 and :botright split', function()
+ clear('--cmd', 'set ruler')
+ local screen = Screen.new(40, 10)
+ screen:set_default_attr_ids({
+ [1] = {reverse = true}, -- StatusLineNC
+ })
+ screen:attach()
+ exec([[
+ set laststatus=0
+ call setline(1, range(1, 100))
+ normal! G
+ ]])
+ command('botright split')
+ screen:expect([[
+ 97 |
+ 98 |
+ 99 |
+ 100 |
+ {1:[No Name] [+] 100,1 Bot}|
+ 97 |
+ 98 |
+ 99 |
+ ^100 |
+ 100,1 Bot |
+ ]])
+end)
+
describe('splitkeep', function()
local screen
@@ -14,6 +43,61 @@ describe('splitkeep', function()
screen:attach()
end)
+ -- oldtest: Test_splitkeep_cursor()
+ it('does not adjust cursor in window that did not change size', function()
+ screen:try_resize(75, 8)
+ -- FIXME: bottom window is different without the "vsplit | close"
+ exec([[
+ vsplit | close
+ set scrolloff=5
+ set splitkeep=screen
+ autocmd CursorMoved * wincmd p | wincmd p
+ call setline(1, range(1, 200))
+ func CursorEqualize()
+ call cursor(100, 1)
+ wincmd =
+ endfunc
+ wincmd s
+ call CursorEqualize()
+ ]])
+
+ screen:expect([[
+ 99 |
+ ^100 |
+ 101 |
+ [No Name] [+] |
+ 5 |
+ 6 |
+ [No Name] [+] |
+ |
+ ]])
+
+ feed('j')
+ screen:expect([[
+ 100 |
+ ^101 |
+ 102 |
+ [No Name] [+] |
+ 5 |
+ 6 |
+ [No Name] [+] |
+ |
+ ]])
+
+ command('set scrolloff=0')
+ feed('G')
+ screen:expect([[
+ 198 |
+ 199 |
+ ^200 |
+ [No Name] [+] |
+ 5 |
+ 6 |
+ [No Name] [+] |
+ |
+ ]])
+ end)
+
-- oldtest: Test_splitkeep_callback()
it('does not scroll when split in callback', function()
exec([[
@@ -116,6 +200,7 @@ describe('splitkeep', function()
-- oldtest: Test_splitkeep_fold()
it('does not scroll when window has closed folds', function()
exec([[
+ set commentstring=/*%s*/
set splitkeep=screen
set foldmethod=marker
set number
@@ -224,4 +309,29 @@ describe('splitkeep', function()
|
]])
end)
+
+ -- oldtest: Test_splitkeep_skipcol()
+ it('skipcol is not reset unnecessarily and is copied to new window', function()
+ screen:try_resize(40, 12)
+ exec([[
+ set splitkeep=topline smoothscroll splitbelow scrolloff=0
+ call setline(1, 'with lots of text in one line '->repeat(6))
+ norm 2
+ wincmd s
+ ]])
+ screen:expect([[
+ <<<e line with lots of text in one line |
+ with lots of text in one line with lots |
+ of text in one line |
+ ~ |
+ [No Name] [+] |
+ <<<e line with lots of text in one line |
+ ^with lots of text in one line with lots |
+ of text in one line |
+ ~ |
+ ~ |
+ [No Name] [+] |
+ |
+ ]])
+ end)
end)