aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/conceal_spec.lua33
-rw-r--r--test/functional/legacy/display_spec.lua47
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua825
-rw-r--r--test/functional/ui/decorations_spec.lua117
-rw-r--r--test/functional/ui/diff_spec.lua2
-rw-r--r--test/functional/ui/mouse_spec.lua11
-rw-r--r--test/functional/ui/multigrid_spec.lua1008
-rw-r--r--test/functional/ui/popupmenu_spec.lua275
-rw-r--r--test/functional/ui/spell_spec.lua139
-rw-r--r--test/old/testdir/test_alot.vim1
-rw-r--r--test/old/testdir/test_breakindent.vim44
-rw-r--r--test/old/testdir/test_conceal.vim26
-rw-r--r--test/old/testdir/test_diffmode.vim15
-rw-r--r--test/old/testdir/test_display.vim21
-rw-r--r--test/old/testdir/test_filetype.vim1
-rw-r--r--test/old/testdir/test_let.vim64
-rw-r--r--test/old/testdir/test_listlbr.vim2
-rw-r--r--test/old/testdir/test_listlbr_utf8.vim2
-rw-r--r--test/old/testdir/test_normal.vim117
-rw-r--r--test/old/testdir/test_number.vim2
-rw-r--r--test/old/testdir/test_options.vim104
-rw-r--r--test/old/testdir/test_scroll_opt.vim565
-rw-r--r--test/old/testdir/test_window_cmd.vim39
23 files changed, 3284 insertions, 176 deletions
diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua
index 429cf9dc03..6aaa93f886 100644
--- a/test/functional/legacy/conceal_spec.lua
+++ b/test/functional/legacy/conceal_spec.lua
@@ -474,6 +474,39 @@ describe('Conceal', function()
]])
end)
+ -- oldtest: Test_conceal_linebreak()
+ it('with linebreak', function()
+ local screen = Screen.new(75, 8)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ })
+ screen:attach()
+ exec([[
+ let &wrap = v:true
+ let &conceallevel = 2
+ let &concealcursor = 'nc'
+ let &linebreak = v:true
+ let &showbreak = '+ '
+ let line = 'a`a`a`a`'
+ \ .. 'a'->repeat(&columns - 15)
+ \ .. ' b`b`'
+ \ .. 'b'->repeat(&columns - 10)
+ \ .. ' cccccc'
+ eval ['x'->repeat(&columns), '', line]->setline(1)
+ syntax region CodeSpan matchgroup=Delimiter start=/\z(`\+\)/ end=/\z1/ concealends
+ ]])
+ screen:expect([[
+ ^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
+ |
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {0:+ }bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
+ {0:+ }cccccc |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
-- Tests for correct display (cursor column position) with +conceal and tabulators.
-- oldtest: Test_conceal_cursor_pos()
it('cursor and column position with conceal and tabulators', function()
diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua
index f9b78f5dcd..f1cd8d1aac 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([[
+ <<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaa^aaaaaaaaa|
+ aaaaaaaaaa |
+ |
+ ]])
+ feed('D')
+ screen:expect([[
+ <<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ aaaaaaaaaaaaaaaaaaaaaaaaa^a |
+ bbbbb bbbbb bbbbb bbbbb bbbbb bb@@@|
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
new file mode 100644
index 0000000000..8af23d2c26
--- /dev/null
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -0,0 +1,825 @@
+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_CtrlE_CtrlY_stop_at_end()
+ it('disabled does not break <C-E> and <C-Y> stop at end', function()
+ exec([[
+ enew
+ call setline(1, ['one', 'two'])
+ set number
+ ]])
+ feed('<C-Y>')
+ screen:expect({any = " 1 ^one"})
+ feed('<C-E><C-E><C-E>')
+ screen:expect({any = " 2 ^two"})
+ end)
+
+ -- oldtest: Test_smoothscroll_CtrlE_CtrlY()
+ it('works with <C-E> and <C-E>', function()
+ exec([[
+ call setline(1, [ 'line one', 'word '->repeat(20), 'line three', 'long word '->repeat(7), 'line', 'line', 'line', ])
+ set smoothscroll scrolloff=5
+ :5
+ ]])
+ 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 = [[
+ <<<d 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 = [[
+ <<<d 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 |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s5 = [[
+ <<<d word word word |
+ line three |
+ long word long word long word long word |
+ long word long word long word |
+ line |
+ line |
+ ^line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]]
+ local s6 = [[
+ <<<d 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('<C-E>')
+ screen:expect(s1)
+ feed('<C-E>')
+ screen:expect(s2)
+ feed('<C-E>')
+ screen:expect(s3)
+ feed('<C-E>')
+ screen:expect(s4)
+ feed('<C-Y>')
+ screen:expect(s5)
+ feed('<C-Y>')
+ screen:expect(s6)
+ feed('<C-Y>')
+ screen:expect(s7)
+ feed('<C-Y>')
+ screen:expect(s8)
+ exec('set foldmethod=indent')
+ -- move the cursor so we can reuse the same dumps
+ feed('5G<C-E>')
+ screen:expect(s1)
+ feed('<C-E>')
+ screen:expect(s2)
+ feed('7G<C-Y>')
+ screen:expect(s7)
+ feed('<C-Y>')
+ 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 splitkeep=topline
+ 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\<C-E>"
+ endfunc
+ ]])
+ 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('<C-E>')
+ screen:expect([[
+ <<<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('<C-E>')
+ screen:expect([[
+ <<<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 |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ exec('set cpo-=n')
+ screen:expect([[
+ <<< 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('<C-Y>')
+ 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('<C-Y>')
+ 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 |
+ ~ |
+ ~ |
+ |
+ ]])
+ 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('<C-E>')
+ 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('<C-E>')
+ 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|
+ xt very long text very long text ver|
+ y long text very long text very long|
+ text very long text very long text |
+ 1 three |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ --No lines in buffer-- |
+ ]])
+ 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\<C-E>"
+ ]])
+ screen:expect([[
+ <<<t very long text very long text very |
+ ^long text very long text very long text |
+ very long text very long text very long |
+ text very long text- |
+ three |
+ ~ |
+ ~ |
+ |
+ ]])
+ exec('set listchars+=precedes:#')
+ screen:expect([[
+ #ext very long text very long text very |
+ ^long text very long text very long text |
+ very long text very long text very long |
+ text very long text- |
+ three |
+ ~ |
+ ~ |
+ |
+ ]])
+ 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('<C-Y>')
+ screen:expect_unchanged()
+ feed('<C-E>')
+ 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 display=
+ :3
+ ]])
+ 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 |
+ |
+ ]])
+ feed('j')
+ screen:expect_unchanged()
+ -- moving cursor down - whole bottom line shows
+ feed('<C-E>j')
+ screen:expect_unchanged()
+ feed('G')
+ 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 |
+ 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 |
+ 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)
+
+ -- 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)) .. ' end', 'four'])
+ 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('<C-E>')
+ screen:expect([[
+ <<<th lot^s 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|
+ xt with lots of text with lots of text w|
+ |
+ ]])
+ feed('5<C-E>')
+ 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<C-Y>')
+ screen:expect([[
+ <<<th 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|
+ xt with l^ots of text with lots of text w|
+ |
+ ]])
+ feed('<C-Y>')
+ 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|
+ |
+ ]])
+ -- 'scrolloff' set to 1, scrolling up, cursor moves screen line down
+ exec('set scrolloff=1')
+ feed('10|<C-E>')
+ screen:expect([[
+ <<<th 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|
+ xt with lots of text with lots of text w|
+ |
+ ]])
+ -- 'scrolloff' set to 1, scrolling down, cursor moves screen line up
+ feed('<C-E>gjgj<C-Y>')
+ screen:expect([[
+ <<<th 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|
+ xt with lots of text with lots of text w|
+ |
+ ]])
+ -- 'scrolloff' set to 2, scrolling up, cursor moves screen line down
+ exec('set scrolloff=2')
+ feed('10|<C-E>')
+ screen:expect([[
+ <<<th lots of text with lots of text wit|
+ h lots of text with lots of text with lo|
+ ts of tex^t with lots of text with lots o|
+ f text with lots of text with lots of te|
+ xt with lots of text with lots of text w|
+ |
+ ]])
+ -- 'scrolloff' set to 2, scrolling down, cursor moves screen line up
+ feed('<C-E>gj<C-Y>')
+ screen:expect_unchanged()
+ -- '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([[
+ <<<of text with lots of text with lots o|
+ f text with lots of text end |
+ ^four |
+ ~ |
+ ~ |
+ |
+ ]])
+ -- Test zt/zz/zb that they work properly when a long line is above it
+ feed('zb')
+ screen:expect([[
+ <<<th 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 end |
+ ^four |
+ |
+ ]])
+ feed('zz')
+ screen:expect([[
+ <<<of text with lots of text with lots o|
+ f text with lots of text end |
+ ^four |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('zt')
+ 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([[
+ <<<th 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 end |
+ ^four |
+ |
+ ]])
+ -- 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.
+ feed('3Gzt<C-E>j')
+ screen:expect([[
+ <<<th 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 end |
+ fou^r |
+ |
+ ]])
+ 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('<C-E>')
+ screen:expect([[
+ <<<ts of text with lots of text with lot|
+ ^s of text with lots of text with lots of|
+ text |
+ ~ |
+ ~ |
+ |
+ ]])
+ 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)
+ -- 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|
+ +++ 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('<C-E>')
+ 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)
+
+ -- 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('llllllllll<C-W>o')
+ screen:expect([[
+ {2:<<<}{1: }aa^aaaaaa|
+ |
+ ]])
+ 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)
+
+ 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([[
+ <<<e 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 |
+ [No Name] [+] |
+ <<<e 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 te@@@|
+ [No Name] [+] |
+ |
+ ]])
+ exec('set showtabline=2')
+ feed('<C-E>')
+ screen:expect([[
+ 2+ [No Name] |
+ <<<e 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 |
+ [No Name] [+] |
+ <<<e text with some text with some text |
+ ^with some text with some text |
+ Line with some text with some text wi@@@|
+ [No Name] [+] |
+ |
+ ]])
+ exec('set winbar=winbar')
+ feed('<C-w>k<C-E>')
+ screen:expect([[
+ 2+ [No Name] |
+ winbar |
+ <<<e 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 te@@@|
+ [No Name] [+] |
+ winbar |
+ <<<e text with some text with some text |
+ with some text with some text |
+ [No Name] [+] |
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 5792c9703d..f531878bc6 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -8,6 +8,7 @@ local exec_lua = helpers.exec_lua
local exec = helpers.exec
local expect_events = helpers.expect_events
local meths = helpers.meths
+local curbufmeths = helpers.curbufmeths
local command = helpers.command
describe('decorations providers', function()
@@ -31,8 +32,9 @@ describe('decorations providers', function()
[12] = {foreground = tonumber('0x990000')};
[13] = {background = Screen.colors.LightBlue};
[14] = {background = Screen.colors.WebGray, foreground = Screen.colors.DarkBlue};
- [15] = {special = Screen.colors.Blue1, undercurl = true},
+ [15] = {special = Screen.colors.Blue, undercurl = true},
[16] = {special = Screen.colors.Red, undercurl = true},
+ [17] = {foreground = Screen.colors.Red},
}
end)
@@ -201,14 +203,14 @@ describe('decorations providers', function()
feed "gg0"
screen:expect{grid=[[
- ^I am well written text. |
- {15:i} am not capitalized. |
- I am a {16:speling} {16:mistakke}. |
- |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- |
+ ^I am well written text. |
+ {15:i} am not capitalized. |
+ I am a {16:speling} {16:mistakke}. |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]]}
feed "]s"
@@ -216,14 +218,14 @@ describe('decorations providers', function()
{ "spell", 1000, 1, 1, 0, 1, -1 };
}
screen:expect{grid=[[
- I am well written text. |
- {15:^i} am not capitalized. |
- I am a {16:speling} {16:mistakke}. |
- |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- |
+ I am well written text. |
+ {15:^i} am not capitalized. |
+ I am a {16:speling} {16:mistakke}. |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]]}
feed "]s"
@@ -231,43 +233,68 @@ describe('decorations providers', function()
{ "spell", 1000, 1, 2, 7, 2, -1 };
}
screen:expect{grid=[[
- I am well written text. |
- {15:i} am not capitalized. |
- I am a {16:^speling} {16:mistakke}. |
- |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- |
+ I am well written text. |
+ {15:i} am not capitalized. |
+ I am a {16:^speling} {16:mistakke}. |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]]}
- -- spell=false with lower priority doesn't disable spell
+ -- spell=false with higher priority does disable spell
local ns = meths.create_namespace "spell"
- local id = helpers.curbufmeths.set_extmark(ns, 0, 0, { priority = 30, end_row = 2, end_col = 23, spell = false })
+ local id = curbufmeths.set_extmark(ns, 0, 0, { priority = 30, end_row = 2, end_col = 23, spell = false })
screen:expect{grid=[[
- I am well written text. |
- i am not capitalized. |
- I am a ^speling mistakke. |
- |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- |
+ I am well written text. |
+ i am not capitalized. |
+ I am a ^speling mistakke. |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]]}
- -- spell=false with higher priority does disable spell
- helpers.curbufmeths.set_extmark(ns, 0, 0, { id = id, priority = 10, end_row = 2, end_col = 23, spell = false })
+ feed "]s"
+ screen:expect{grid=[[
+ I am well written text. |
+ i am not capitalized. |
+ I am a ^speling mistakke. |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {17:search hit BOTTOM, continuing at TOP} |
+ ]]}
+ command('echo ""')
+
+ -- spell=false with lower priority doesn't disable spell
+ curbufmeths.set_extmark(ns, 0, 0, { id = id, priority = 10, end_row = 2, end_col = 23, spell = false })
+
+ screen:expect{grid=[[
+ I am well written text. |
+ {15:i} am not capitalized. |
+ I am a {16:^speling} {16:mistakke}. |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+ feed "]s"
screen:expect{grid=[[
- I am well written text. |
- {15:i} am not capitalized. |
- I am a {16:^speling} {16:mistakke}. |
- |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- |
+ I am well written text. |
+ {15:i} am not capitalized. |
+ I am a {16:speling} {16:^mistakke}. |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]]}
end)
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index dbdf3823ec..0f551e3044 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -1325,6 +1325,7 @@ it('win_update redraws lines properly', function()
]]}
end)
+-- oldtest: Test_diff_rnu()
it('diff updates line numbers below filler lines', function()
clear()
local screen = Screen.new(40, 14)
@@ -1401,6 +1402,7 @@ it('diff updates line numbers below filler lines', function()
]])
end)
+-- oldtest: Test_diff_with_scroll_and_change()
it('Align the filler lines when changing text in diff mode', function()
clear()
local screen = Screen.new(40, 20)
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index d9b9cf9f1b..2c0a00c74f 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -1861,5 +1861,16 @@ describe('ui/mouse/input', function()
feed('<Down><CR>')
eq({1, 9}, meths.win_get_cursor(0))
eq('ran away', funcs.getreg('"'))
+
+ -- Test for right click inside visual selection at bottom of window with winbar
+ command('setlocal winbar=WINBAR')
+ feed('2yyP')
+ funcs.setreg('"', '')
+ feed('G$vbb')
+ meths.input_mouse('right', 'press', '', 0, 4, 61)
+ meths.input_mouse('right', 'release', '', 0, 4, 61)
+ feed('<Down><CR>')
+ eq({4, 20}, meths.win_get_cursor(0))
+ eq('the moon', funcs.getreg('"'))
end)
end)
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 2525314b8e..4c04bcb54e 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -37,6 +37,10 @@ describe('ext_multigrid', function()
[18] = {bold = true, foreground = Screen.colors.Magenta},
[19] = {foreground = Screen.colors.Brown},
[20] = {background = Screen.colors.LightGrey},
+ [21] = {background = Screen.colors.LightMagenta},
+ [22] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue},
+ [23] = {background = Screen.colors.Grey90},
+ [24] = {background = Screen.colors.Grey},
})
end)
@@ -884,7 +888,6 @@ describe('ext_multigrid', function()
it('gets written till grid width', function()
insert(('a'):rep(60).."\n")
-
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
@@ -927,8 +930,95 @@ describe('ext_multigrid', function()
]]}
end)
+ it('"g$" works correctly with double-width characters and no wrapping', function()
+ command('set nowrap')
+ insert(('a'):rep(58) .. ('哦'):rep(3))
+ feed('0')
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa哦|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]]}
+ feed('g$')
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^哦|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]]}
+ end)
+
it('wraps with grid width', function()
- insert(('b'):rep(80).."\n")
+ insert(('b'):rep(160).."\n")
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
@@ -947,7 +1037,8 @@ describe('ext_multigrid', function()
[3:-----------------------------------------------------]|
## grid 2
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- bbbbbbbbbbbbbbbbbbbb |
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
^ |
{1:~ }|
{1:~ }|
@@ -965,6 +1056,47 @@ describe('ext_multigrid', function()
{1:~ }|
{1:~ }|
{1:~ }|
+ ## grid 3
+ |
+ ]]}
+ feed('2gk')
+ command('setlocal cursorline cursorlineopt=screenline')
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ {23:^bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb}|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
{1:~ }|
## grid 3
|
@@ -1060,6 +1192,255 @@ describe('ext_multigrid', function()
|
]]}
end)
+
+ it('anchored float window "bufpos"', function()
+ insert(('c'):rep(1111))
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccc^c |
+ {1:~ }|
+ ## grid 3
+ |
+ ]]}
+ local float_buf = meths.create_buf(false, false)
+ meths.open_win(float_buf, false, {
+ relative = 'win',
+ win = curwin(),
+ bufpos = {0, 1018},
+ anchor = 'SE',
+ width = 5,
+ height = 5,
+ })
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc|
+ cccccccccccccccccccccccccccccc^c |
+ {1:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {21: }|
+ {22:~ }|
+ {22:~ }|
+ {22:~ }|
+ {22:~ }|
+ ]], float_pos={
+ [4] = {{id = 1001}, "SE", 2, 16, 58, true, 50};
+ }}
+ end)
+
+ it('completion popup position', function()
+ insert(('\n'):rep(14) .. ('foo bar '):rep(7))
+ feed('A<C-X><C-N>')
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- Keyword Local completion (^N^P) }{15:match 1 of 2} |
+ ## grid 4
+ {24: foo}|
+ {21: bar}|
+ ]], float_pos={
+ [4] = {{id = -1}, "NW", 2, 15, 55, false, 100};
+ }}
+ feed('<C-E><Esc>')
+
+ command('setlocal rightleft')
+ feed('o<C-X><C-N>')
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ rab oof rab oof rab oof rab oof rab oof rab oof rab oof|
+ ^ oof|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ ## grid 3
+ {7:-- Keyword Local completion (^N^P) }{15:match 1 of 2} |
+ ## grid 4
+ {24: oof}|
+ {21: rab}|
+ ]], float_pos={
+ [4] = {{id = -1}, "NW", 2, 16, 45, false, 100};
+ }}
+ feed('<C-E><Esc>')
+
+ command('set wildoptions+=pum')
+ feed(':sign un<Tab>')
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ [2:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ rab oof rab oof rab oof rab oof rab oof rab oof rab oof|
+ |
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ ## grid 3
+ :sign undefine^ |
+ ## grid 4
+ {24: undefine }|
+ {21: unplace }|
+ ]], float_pos={
+ [4] = {{id = -1}, "SW", 1, 13, 5, false, 250};
+ }}
+ end)
end)
it('multiline messages scroll over windows', function()
@@ -2003,7 +2384,7 @@ describe('ext_multigrid', function()
{1:~ }|
]]}
- meths.input_mouse('left', 'press', '', 1,8, 26)
+ meths.input_mouse('left', 'press', '', 1, 8, 26)
poke_eventloop()
meths.input_mouse('left', 'drag', '', 1, 6, 30)
screen:expect{grid=[[
@@ -2044,6 +2425,625 @@ describe('ext_multigrid', function()
{1:~ }|
{1:~ }|
]]}
+
+ command('aunmenu PopUp | vmenu PopUp.Copy y')
+
+ funcs.setreg('"', '')
+ meths.input_mouse('left', 'press', '2', 2, 1, 6)
+ screen:expect{grid=[[
+ ## grid 1
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {12:[No Name] [+] }|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] }{11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be {20:clicke}^d |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be {20:clicked} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ meths.input_mouse('right', 'press', '', 2, 1, 6)
+ meths.input_mouse('right', 'release', '', 2, 1, 6)
+ screen:expect{grid=[[
+ ## grid 1
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {12:[No Name] [+] }|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] }{11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be {20:clicke}^d |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be {20:clicked} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 6
+ {21: Copy }|
+ ]], float_pos={
+ [6] = {{id = -1}, "NW", 2, 2, 5, false, 250};
+ }}
+ feed('<Down><CR>')
+ screen:expect{grid=[[
+ ## grid 1
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {12:[No Name] [+] }|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] }{11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be ^clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo |
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ eq('clicked', funcs.getreg('"'))
+
+ funcs.setreg('"', '')
+ meths.input_mouse('left', 'press', '2', 4, 0, 64)
+ screen:expect{grid=[[
+ ## grid 1
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do {20:eiusm}^o |
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ meths.input_mouse('right', 'press', '', 4, 0, 64)
+ meths.input_mouse('right', 'release', '', 4, 0, 64)
+ screen:expect{grid=[[
+ ## grid 1
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do {20:eiusm}^o |
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 6
+ {21: Copy }|
+ ]], float_pos={
+ [6] = {{id = -1}, "NW", 4, 1, 63, false, 250};
+ }}
+ feed('<Down><CR>')
+ screen:expect{grid=[[
+ ## grid 1
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ^eiusmo |
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ eq('eiusmo', funcs.getreg('"'))
+
+ command('wincmd J')
+ screen:try_resize_grid(4, 7, 10)
+ screen:expect{grid=[[
+ ## grid 1
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ Lorem i|
+ psum do|
+ lor sit|
+ amet, |
+ consect|
+ etur ad|
+ ipiscin|
+ g elit,|
+ sed do|
+ ^eiusmo|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+
+ funcs.setreg('"', '')
+ meths.input_mouse('left', 'press', '2', 4, 9, 1)
+ screen:expect{grid=[[
+ ## grid 1
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ Lorem i|
+ psum do|
+ lor sit|
+ amet, |
+ consect|
+ etur ad|
+ ipiscin|
+ g elit,|
+ sed do|
+ {20:eiusm}^o|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ meths.input_mouse('right', 'press', '', 4, 9, 1)
+ meths.input_mouse('right', 'release', '', 4, 9, 1)
+ screen:expect{grid=[[
+ ## grid 1
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ Lorem i|
+ psum do|
+ lor sit|
+ amet, |
+ consect|
+ etur ad|
+ ipiscin|
+ g elit,|
+ sed do|
+ {20:eiusm}^o|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 6
+ {21: Copy }|
+ ]], float_pos={
+ [6] = {{id = -1}, "SW", 4, 9, 0, false, 250};
+ }}
+ feed('<Down><CR>')
+ screen:expect{grid=[[
+ ## grid 1
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ Lorem i|
+ psum do|
+ lor sit|
+ amet, |
+ consect|
+ etur ad|
+ ipiscin|
+ g elit,|
+ sed do|
+ ^eiusmo|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ eq('eiusmo', funcs.getreg('"'))
+
+ screen:try_resize_grid(4, 7, 11)
+ screen:expect{grid=[[
+ ## grid 1
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ ^Lorem i|
+ psum do|
+ lor sit|
+ amet, |
+ consect|
+ etur ad|
+ ipiscin|
+ g elit,|
+ sed do|
+ eiusmo|
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+
+ funcs.setreg('"', '')
+ meths.input_mouse('left', 'press', '2', 4, 9, 1)
+ screen:expect{grid=[[
+ ## grid 1
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ Lorem i|
+ psum do|
+ lor sit|
+ amet, |
+ consect|
+ etur ad|
+ ipiscin|
+ g elit,|
+ sed do|
+ {20:eiusm}^o|
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ meths.input_mouse('right', 'press', '', 4, 9, 1)
+ meths.input_mouse('right', 'release', '', 4, 9, 1)
+ screen:expect{grid=[[
+ ## grid 1
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {7:-- VISUAL --} |
+ ## grid 4
+ Lorem i|
+ psum do|
+ lor sit|
+ amet, |
+ consect|
+ etur ad|
+ ipiscin|
+ g elit,|
+ sed do|
+ {20:eiusm}^o|
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 6
+ {21: Copy }|
+ ]], float_pos={
+ [6] = {{id = -1}, "NW", 4, 10, 0, false, 250};
+ }}
+ feed('<Down><CR>')
+ screen:expect{grid=[[
+ ## grid 1
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ [5:------------------------------]│[2:----------------------]|
+ {12:[No Name] [+] [No Name] [+] }|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ [4:-----------------------------------------------------]|
+ {11:[No Name] [+] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ Lorem i|
+ psum do|
+ lor sit|
+ amet, |
+ consect|
+ etur ad|
+ ipiscin|
+ g elit,|
+ sed do|
+ ^eiusmo|
+ {1:~ }|
+ ## grid 5
+ some text |
+ to be clicked |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ eq('eiusmo', funcs.getreg('"'))
end)
it('supports mouse drag with mouse=a', function()
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 0b71e12b6f..76038472bd 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -5,6 +5,7 @@ local clear, feed = helpers.clear, helpers.feed
local source = helpers.source
local insert = helpers.insert
local meths = helpers.meths
+local async_meths = helpers.async_meths
local command = helpers.command
local funcs = helpers.funcs
local eq = helpers.eq
@@ -1978,6 +1979,54 @@ describe('builtin popupmenu', function()
{2:-- }{5:match 1 of 4} |
]])
end
+
+ feed('\n<c-x><c-n>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [4:-----------]│[2:--------------------]|
+ [4:-----------]│[2:--------------------]|
+ [4:-----------]│[2:--------------------]|
+ [4:-----------]│[2:--------------------]|
+ [4:-----------]│[2:--------------------]|
+ [4:-----------]│[2:--------------------]|
+ {3:<Name] [+] }{4:[No Name] [+] }|
+ [3:--------------------------------]|
+ ## grid 2
+ aaa aab aac |
+ bbb aaa |
+ c aaabcdef ccc aaa |
+ aaa^ |
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {2:-- }{5:match 1 of 6} |
+ ## grid 4
+ aaa aab aac|
+ bbb aaa |
+ c aaabcdef |
+ ccc aaa |
+ aaa |
+ {1:~ }|
+ ## grid 5
+ {s: aaa }{c: }|
+ {n: aab }{s: }|
+ {n: aac }{s: }|
+ ]], float_pos={
+ [5] = {{id = -1}, "NW", 2, 4, -1, false, 100};
+ }}
+ else
+ screen:expect([[
+ aaa aab aac│aaa aab aac |
+ bbb aaa │bbb aaa |
+ c aaabcdef │c aaabcdef ccc aaa |
+ ccc aaa │aaa^ |
+ aaa {s: aaa }{c: }{1: }|
+ {1:~ }{n: aab }{s: }{1: }|
+ {3:<Name] [+] }{n: aac }{s: }{4: }|
+ {2:-- }{5:match 1 of 6} |
+ ]])
+ end
end)
if not multigrid then
@@ -2396,7 +2445,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 -} |
]])
@@ -2488,10 +2537,10 @@ describe('builtin popupmenu', function()
funcs.complete(16, {'word', 'choice', 'text', 'thing'})
screen:expect([[
^ tfelthgir emos|
- {1: }{n: drow}{1: ~}|
- {1: }{n: eciohc}{1: ~}|
- {1: }{n: txet}{1: ~}|
- {1: }{n: gniht}{1: ~}|
+ {1: }{n: drow }{1: ~}|
+ {1: }{n: eciohc }{1: ~}|
+ {1: }{n: txet }{1: ~}|
+ {1: }{n: gniht }{1: ~}|
{1: ~}|
{1: ~}|
{1: ~}|
@@ -2512,10 +2561,10 @@ describe('builtin popupmenu', function()
feed('<c-n>')
screen:expect([[
^ drow tfelthgir emos|
- {1: }{s: drow}{1: ~}|
- {1: }{n: eciohc}{1: ~}|
- {1: }{n: txet}{1: ~}|
- {1: }{n: gniht}{1: ~}|
+ {1: }{s: drow }{1: ~}|
+ {1: }{n: eciohc }{1: ~}|
+ {1: }{n: txet }{1: ~}|
+ {1: }{n: gniht }{1: ~}|
{1: ~}|
{1: ~}|
{1: ~}|
@@ -2609,10 +2658,11 @@ describe('builtin popupmenu', function()
end
it('with rightleft vsplits', function()
- screen:try_resize(40, 8)
+ screen:try_resize(40, 6)
command('set rightleft')
command('rightbelow vsplit')
- command("set completeopt+=noinsert,noselect")
+ command('set completeopt+=noinsert,noselect')
+ command('set pumheight=2')
feed('isome rightleft ')
funcs.complete(16, {'word', 'choice', 'text', 'thing'})
if multigrid then
@@ -2622,8 +2672,6 @@ describe('builtin popupmenu', function()
[2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
- [2:-------------------]│[4:--------------------]|
- [2:-------------------]│[4:--------------------]|
{3:[No Name] [+] }{4:[No Name] [+] }|
[3:----------------------------------------]|
## grid 2
@@ -2631,8 +2679,6 @@ describe('builtin popupmenu', function()
{1: ~}|
{1: ~}|
{1: ~}|
- {1: ~}|
- {1: ~}|
## grid 3
{2:-- INSERT --} |
## grid 4
@@ -2640,28 +2686,134 @@ describe('builtin popupmenu', function()
{1: ~}|
{1: ~}|
{1: ~}|
- {1: ~}|
- {1: ~}|
## grid 5
- {n: drow}|
- {n: eciohc}|
- {n: txet}|
- {n: gniht}|
+ {c: }{n: drow }|
+ {s: }{n: eciohc }|
]], float_pos={
[5] = {{id = -1}, "NW", 4, 1, -11, false, 100};
}}
else
screen:expect([[
tfelthgir emos│ ^ tfelthgir emos|
- {1: }{n: drow}{1: ~}|
- {1: }{n: eciohc}{1: ~}|
- {1: }{n: txet}{1: ~}|
- {1: }{n: gniht}{1: ~}|
+ {1: }{c: }{n: drow }{1: ~}|
+ {1: }{s: }{n: eciohc }{1: ~}|
{1: ~}│{1: ~}|
{3:[No Name] [+] }{4:[No Name] [+] }|
{2:-- INSERT --} |
]])
end
+ feed('<C-E><CR>')
+ funcs.complete(1, {'word', 'choice', 'text', 'thing'})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ {3:[No Name] [+] }{4:[No Name] [+] }|
+ [3:----------------------------------------]|
+ ## grid 2
+ tfelthgir emos|
+ |
+ {1: ~}|
+ {1: ~}|
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ tfelthgir emos|
+ ^ |
+ {1: ~}|
+ {1: ~}|
+ ## grid 5
+ {c: }{n: drow}|
+ {s: }{n: eciohc}|
+ ]], float_pos={
+ [5] = {{id = -1}, "NW", 4, 2, 4, false, 100};
+ }}
+ else
+ screen:expect([[
+ tfelthgir emos│ tfelthgir emos|
+ │ ^ |
+ {1: ~}│{1: }{c: }{n: drow}|
+ {1: ~}│{1: }{s: }{n: eciohc}|
+ {3:[No Name] [+] }{4:[No Name] [+] }|
+ {2:-- INSERT --} |
+ ]])
+ end
+ feed('<C-E>')
+ async_meths.call_function('input', {'', '', 'sign'})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ {3:[No Name] [+] }{4:[No Name] [+] }|
+ [3:----------------------------------------]|
+ ## grid 2
+ tfelthgir emos|
+ |
+ {1: ~}|
+ {1: ~}|
+ ## grid 3
+ ^ |
+ ## grid 4
+ tfelthgir emos|
+ |
+ {1: ~}|
+ {1: ~}|
+ ]]}
+ else
+ screen:expect([[
+ tfelthgir emos│ tfelthgir emos|
+ │ |
+ {1: ~}│{1: ~}|
+ {1: ~}│{1: ~}|
+ {3:[No Name] [+] }{4:[No Name] [+] }|
+ ^ |
+ ]])
+ end
+ command('set wildoptions+=pum')
+ feed('<Tab>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ [2:-------------------]│[4:--------------------]|
+ {3:[No Name] [+] }{4:[No Name] [+] }|
+ [3:----------------------------------------]|
+ ## grid 2
+ tfelthgir emos|
+ |
+ {1: ~}|
+ {1: ~}|
+ ## grid 3
+ define^ |
+ ## grid 4
+ tfelthgir emos|
+ |
+ {1: ~}|
+ {1: ~}|
+ ## grid 5
+ {s:define }{c: }|
+ {n:jump }{s: }|
+ ]], float_pos={
+ [5] = {{id = -1}, "SW", 1, 5, 0, false, 250};
+ }}
+ else
+ screen:expect([[
+ tfelthgir emos│ tfelthgir emos|
+ │ |
+ {1: ~}│{1: ~}|
+ {s:define }{c: }{1: ~}│{1: ~}|
+ {n:jump }{s: }{3: }{4:[No Name] [+] }|
+ define^ |
+ ]])
+ end
end)
if not multigrid then
@@ -4357,6 +4509,79 @@ describe('builtin popupmenu', function()
]])
end
eq('foo', meths.get_var('menustr'))
+
+ command('setlocal winbar=WINBAR')
+ if multigrid then
+ meths.input_mouse('right', 'press', '', 6, 1, 14)
+ screen:expect({grid=[[
+ ## grid 1
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ {3:[No Name] [+] }|
+ [5:---------------]│[6:----------------]|
+ [5:---------------]│[6:----------------]|
+ [3:--------------------------------]|
+ ## grid 2
+ popup menu test |
+ {1:~ }|
+ ## grid 3
+ :let g:menustr = 'foo' |
+ ## grid 4
+ {n: foo}|
+ {n: bar}|
+ {n: baz}|
+ ## grid 5
+ popup menu test|
+ {1:~ }|
+ ## grid 6
+ {2:WINBAR }|
+ ^popup menu test |
+ ]], float_pos={[4] = {{id = -1}, "SW", 6, 1, 12, false, 250}}})
+ else
+ feed('<RightMouse><30,4>')
+ screen:expect([[
+ popup menu test |
+ {1:~ }{n: foo}|
+ {3:[No Name] [+] }{n: bar}|
+ popup menu test│{2:WINBAR }{n: baz}|
+ {1:~ }│^popup menu test |
+ :let g:menustr = 'foo' |
+ ]])
+ end
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 1, 2)
+ screen:expect({grid=[[
+ ## grid 1
+ [2:--------------------------------]|
+ [2:--------------------------------]|
+ {3:[No Name] [+] }|
+ [5:---------------]│[6:----------------]|
+ [5:---------------]│[6:----------------]|
+ [3:--------------------------------]|
+ ## grid 2
+ popup menu test |
+ {1:~ }|
+ ## grid 3
+ :let g:menustr = 'bar' |
+ ## grid 5
+ popup menu test|
+ {1:~ }|
+ ## grid 6
+ {2:WINBAR }|
+ ^popup menu test |
+ ]]})
+ else
+ feed('<LeftMouse><31,2>')
+ screen:expect([[
+ popup menu test |
+ {1:~ }|
+ {3:[No Name] [+] }|
+ popup menu test│{2:WINBAR }|
+ {1:~ }│^popup menu test |
+ :let g:menustr = 'bar' |
+ ]])
+ end
+ eq('bar', meths.get_var('menustr'))
end)
if not multigrid then
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua
index 361f83d1ce..15819aef40 100644
--- a/test/functional/ui/spell_spec.lua
+++ b/test/functional/ui/spell_spec.lua
@@ -6,6 +6,8 @@ local clear = helpers.clear
local feed = helpers.feed
local insert = helpers.insert
local command = helpers.command
+local meths = helpers.meths
+local curbufmeths = helpers.curbufmeths
local is_os = helpers.is_os
describe("'spell'", function()
@@ -18,11 +20,13 @@ describe("'spell'", function()
screen:set_default_attr_ids( {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {special = Screen.colors.Red, undercurl = true},
- [2] = {special = Screen.colors.Blue1, undercurl = true},
+ [2] = {special = Screen.colors.Blue, undercurl = true},
[3] = {foreground = tonumber('0x6a0dad')},
[4] = {foreground = Screen.colors.Magenta},
[5] = {bold = true, foreground = Screen.colors.SeaGreen},
[6] = {foreground = Screen.colors.Red},
+ [7] = {foreground = Screen.colors.Blue},
+ [8] = {foreground = Screen.colors.Blue, special = Screen.colors.Red, undercurl = true},
})
end)
@@ -74,93 +78,180 @@ describe("'spell'", function()
]])
end)
- it('"noplainbuffer" and syntax #20385', function()
+ it('extmarks, "noplainbuffer" and syntax #20385 #23398', function()
command('set filetype=c')
command('syntax on')
command('set spell')
insert([[
#include <stdbool.h>
- bool func(void);]])
+ bool func(void);
+ // I am a speling mistakke]])
+ feed('ge')
screen:expect([[
{3:#include }{4:<stdbool.h>} |
- {5:bool} func({5:void})^; |
+ {5:bool} func({5:void}); |
+ {7:// I am a }{8:spelin^g}{7: }{8:mistakke} |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
+ |
+ ]])
+ feed(']s')
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} func({5:void}); |
+ {7:// I am a }{8:speling}{7: }{8:^mistakke} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ feed(']s')
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} func({5:void}); |
+ {7:// I am a }{8:^speling}{7: }{8:mistakke} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {6:search hit BOTTOM, continuing at TOP} |
+ ]])
+ command('echo ""')
+ local ns = meths.create_namespace("spell")
+ -- extmark with spell=true enables spell
+ local id = curbufmeths.set_extmark(ns, 1, 4, { end_row = 1, end_col = 10, spell = true })
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} {1:func}({5:void}); |
+ {7:// I am a }{8:^speling}{7: }{8:mistakke} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
{0:~ }|
|
]])
feed('[s')
screen:expect([[
{3:#include }{4:<stdbool.h>} |
- {5:bool} func({5:void})^; |
+ {5:bool} {1:^func}({5:void}); |
+ {7:// I am a }{8:speling}{7: }{8:mistakke} |
+ {0:~ }|
+ {0:~ }|
{0:~ }|
{0:~ }|
+ |
+ ]])
+ curbufmeths.del_extmark(ns, id)
+ -- extmark with spell=false disables spell
+ id = curbufmeths.set_extmark(ns, 2, 18, { end_row = 2, end_col = 26, spell = false })
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} ^func({5:void}); |
+ {7:// I am a }{8:speling}{7: mistakke} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ feed('[s')
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} func({5:void}); |
+ {7:// I am a }{8:^speling}{7: mistakke} |
+ {0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{6:search hit TOP, continuing at BOTTOM} |
]])
+ command('echo ""')
+ curbufmeths.del_extmark(ns, id)
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} func({5:void}); |
+ {7:// I am a }{8:^speling}{7: }{8:mistakke} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ feed(']s')
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} func({5:void}); |
+ {7:// I am a }{8:speling}{7: }{8:^mistakke} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
-- "noplainbuffer" shouldn't change spellchecking behavior with syntax enabled
command('set spelloptions+=noplainbuffer')
screen:expect_unchanged()
- feed(']s')
+ feed('[s')
screen:expect([[
{3:#include }{4:<stdbool.h>} |
- {5:bool} func({5:void})^; |
- {0:~ }|
+ {5:bool} func({5:void}); |
+ {7:// I am a }{8:^speling}{7: }{8:mistakke} |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
- {6:search hit BOTTOM, continuing at TOP} |
+ |
]])
-- no spellchecking with "noplainbuffer" and syntax disabled
command('syntax off')
screen:expect([[
#include <stdbool.h> |
- bool func(void)^; |
+ bool func(void); |
+ // I am a ^speling mistakke |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
- {0:~ }|
- {6:search hit BOTTOM, continuing at TOP} |
+ |
]])
- feed('[s')
+ feed(']s')
screen:expect([[
#include <stdbool.h> |
- bool func(void)^; |
+ bool func(void); |
+ // I am a ^speling mistakke |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
- {0:~ }|
- {6:search hit TOP, continuing at BOTTOM} |
+ {6:search hit BOTTOM, continuing at TOP} |
]])
+ command('echo ""')
-- everything is spellchecked without "noplainbuffer" with syntax disabled
command('set spelloptions&')
screen:expect([[
#include <{1:stdbool}.h> |
- {1:bool} {1:func}(void)^; |
- {0:~ }|
+ {1:bool} {1:func}(void); |
+ // I am a {1:^speling} {1:mistakke} |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
- {6:search hit TOP, continuing at BOTTOM} |
+ |
]])
- feed(']s')
+ feed('[s')
screen:expect([[
- #include <{1:^stdbool}.h> |
- {1:bool} {1:func}(void); |
- {0:~ }|
+ #include <{1:stdbool}.h> |
+ {1:bool} {1:^func}(void); |
+ // I am a {1:speling} {1:mistakke} |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
- {6:search hit BOTTOM, continuing at TOP} |
+ |
]])
end)
+
end)
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
diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim
index 0d1753182e..f6c0e32adf 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",
\ ]
@@ -711,25 +711,25 @@ 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
setl scrolloff=5
- norm! 5gj
+ norm! 6gj
redraw!
let lines = s:screen_lines(1, 20)
let expect = [
- \ "--1 aaaaaaaaaaaaaaaa",
- \ " aaaaaaaaaaaaaaaa",
- \ " aaaaaaaaaaaaaaaa",
+ \ "<<< qrstabcdefghijkl",
+ \ " mnopqrstabcdefgh",
+ \ " ijklmnopqrstabcd",
\ ]
call s:compare_lines(expect, lines)
@@ -737,18 +737,18 @@ func Test_breakindent20_cpo_n_nextpage()
norm! 1gg
let lines = s:screen_lines(1, 20)
let expect = [
- \ " 1 aaaaaaaaaaaaaaaa",
- \ " aaaaaaaaaaaaaa",
- \ " aaaaaaaaaaaaaa",
+ \ " 1 abcdefghijklmnop",
+ \ " qrstabcdefghij",
+ \ " klmnopqrstabcd",
\ ]
call s:compare_lines(expect, lines)
" Scroll down one screen line
- norm! 5gj
+ norm! 6gj
let lines = s:screen_lines(1, 20)
let expect = [
- \ "--1 aaaaaaaaaaaaaa",
- \ " aaaaaaaaaaaaaa",
- \ " aaaaaaaaaaaaaa",
+ \ "<<< qrstabcdefghij",
+ \ " klmnopqrstabcd",
+ \ " efghijklmnopqr",
\ ]
call s:compare_lines(expect, lines)
diff --git a/test/old/testdir/test_conceal.vim b/test/old/testdir/test_conceal.vim
index e3b8f767b8..63e17d8f2f 100644
--- a/test/old/testdir/test_conceal.vim
+++ b/test/old/testdir/test_conceal.vim
@@ -188,6 +188,32 @@ func Test_conceal_resize_term()
call StopVimInTerminal(buf)
endfunc
+func Test_conceal_linebreak()
+ CheckScreendump
+
+ let code =<< trim [CODE]
+ vim9script
+ &wrap = true
+ &conceallevel = 2
+ &concealcursor = 'nc'
+ &linebreak = true
+ &showbreak = '+ '
+ var line: string = 'a`a`a`a`'
+ .. 'a'->repeat(&columns - 15)
+ .. ' b`b`'
+ .. 'b'->repeat(&columns - 10)
+ .. ' cccccc'
+ ['x'->repeat(&columns), '', line]->setline(1)
+ syntax region CodeSpan matchgroup=Delimiter start=/\z(`\+\)/ end=/\z1/ concealends
+ [CODE]
+ call writefile(code, 'XTest_conceal_linebreak', 'D')
+ let buf = RunVimInTerminal('-S XTest_conceal_linebreak', {'rows': 8})
+ call VerifyScreenDump(buf, 'Test_conceal_linebreak_1', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+endfunc
+
" Tests for correct display (cursor column position) with +conceal and
" tabulators. Need to run this test in a separate Vim instance. Otherwise the
" screen is not updated (lazy redraw) and the cursor position is wrong.
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
diff --git a/test/old/testdir/test_display.vim b/test/old/testdir/test_display.vim
index b642f39c9f..f27a8362a9 100644
--- a/test/old/testdir/test_display.vim
+++ b/test/old/testdir/test_display.vim
@@ -478,5 +478,26 @@ func Test_display_lastline()
call assert_fails(':set fillchars=lastline:〇', 'E474:')
endfunc
+func Test_display_long_lastline()
+ CheckScreendump
+
+ let lines =<< trim END
+ set display=lastline
+ call setline(1, [
+ \'aaaaa'->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
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index 789430fc84..2d7a24090f 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -346,6 +346,7 @@ let s:filename_checks = {
\ 'lsl': ['file.lsl'],
\ 'lss': ['file.lss'],
\ 'lua': ['file.lua', 'file.rockspec', 'file.nse', '.luacheckrc', '.busted'],
+ \ 'luau': ['file.luau'],
\ 'lynx': ['lynx.cfg'],
\ 'lyrics': ['file.lrc'],
\ 'm3build': ['m3makefile', 'm3overrides'],
diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim
index 0d84164274..bf119bdeab 100644
--- a/test/old/testdir/test_let.vim
+++ b/test/old/testdir/test_let.vim
@@ -338,7 +338,43 @@ func Test_let_heredoc_fails()
call assert_report('No exception thrown')
catch /E488:/
catch
- call assert_report("Caught exception: " .. v:exception)
+ call assert_report('Caught exception: ' .. v:exception)
+ endtry
+
+ try
+ let &commentstring =<< trim TEXT
+ change
+ insert
+ append
+ TEXT
+ call assert_report('No exception thrown')
+ catch /E730:/
+ catch
+ call assert_report('Caught exception: ' .. v:exception)
+ endtry
+
+ try
+ let $SOME_ENV_VAR =<< trim TEXT
+ change
+ insert
+ append
+ TEXT
+ call assert_report('No exception thrown')
+ catch /E730:/
+ catch
+ call assert_report('Caught exception: ' .. v:exception)
+ endtry
+
+ try
+ let @r =<< trim TEXT
+ change
+ insert
+ append
+ TEXT
+ call assert_report('No exception thrown')
+ catch /E730:/
+ catch
+ call assert_report('Caught exception: ' .. v:exception)
endtry
let text =<< trim END
@@ -504,6 +540,32 @@ E
z
END
call assert_equal([' x', ' \y', ' z'], [a, b, c])
+
+ " unpack assignment without whitespace
+ let[a,b,c]=<<END
+change
+insert
+append
+END
+ call assert_equal(['change', 'insert', 'append'], [a, b, c])
+
+ " curly braces name and list slice assignment
+ let foo_3_bar = ['', '', '']
+ let foo_{1 + 2}_bar[ : ] =<< END
+change
+insert
+append
+END
+ call assert_equal(['change', 'insert', 'append'], foo_3_bar)
+
+ " dictionary key containing brackets and spaces
+ let d = {'abc] 123': 'baz'}
+ let d[d['abc] 123'] .. '{'] =<< END
+change
+insert
+append
+END
+ call assert_equal(['change', 'insert', 'append'], d['baz{'])
endfunc
" Test for evaluating Vim expressions in a heredoc using {expr}
diff --git a/test/old/testdir/test_listlbr.vim b/test/old/testdir/test_listlbr.vim
index a746779e73..2e66fd4ccb 100644
--- a/test/old/testdir/test_listlbr.vim
+++ b/test/old/testdir/test_listlbr.vim
@@ -223,7 +223,7 @@ func Test_virtual_block_and_vbA()
exe "norm! $3B\<C-v>eAx\<Esc>"
let lines = s:screen_lines([1, 10], winwidth(0))
let expect = [
-\ "foobar foobar ",
+\ "<<<bar foobar ",
\ "foobar foobar ",
\ "foobar foobar ",
\ "foobar foobar ",
diff --git a/test/old/testdir/test_listlbr_utf8.vim b/test/old/testdir/test_listlbr_utf8.vim
index df1ed78119..15b248964f 100644
--- a/test/old/testdir/test_listlbr_utf8.vim
+++ b/test/old/testdir/test_listlbr_utf8.vim
@@ -266,7 +266,7 @@ func Test_chinese_char_on_wrap_column()
norm! $
redraw!
let expect=[
-\ '中aaaaaaaaaaaaaaaaa>',
+\ '<<<aaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
\ '中aaaaaaaaaaaaaaaaa>',
diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim
index fe8611d527..330a16dffb 100644
--- a/test/old/testdir/test_normal.vim
+++ b/test/old/testdir/test_normal.vim
@@ -250,9 +250,10 @@ func Test_normal_formatexpr_returns_nonzero()
setlocal formatexpr=Format()
normal VGgq
call assert_equal(['one two'], getline(1, '$'))
+
setlocal formatexpr=
delfunc Format
- close!
+ bwipe!
endfunc
" Test for using a script-local function for 'formatexpr'
@@ -1329,7 +1330,7 @@ func Test_vert_scroll_cmds()
call assert_equal(15, line('w$'))
set foldenable&
- close!
+ bwipe!
endfunc
func Test_scroll_in_ex_mode()
@@ -2350,7 +2351,7 @@ func Test_normal_section()
call assert_equal(2, line('.'))
call assert_equal(-1, foldclosedend(line('.')))
- close!
+ bwipe!
endfunc
" Test for changing case using u, U, gu, gU and ~ (tilde) commands
@@ -2447,7 +2448,8 @@ func Test_normal_changecase_turkish()
" can't use Turkish locale
throw 'Skipped: Turkish locale not available'
endtry
- close!
+
+ bwipe!
endfunc
" Test for r (replace) command
@@ -2524,7 +2526,6 @@ endfunc
" Test for g`, g;, g,, g&, gv, gk, gj, gJ, g0, g^, g_, gm, g$, gM, g CTRL-G,
" gi and gI commands
func Test_normal33_g_cmd2()
- CheckFeature jumplist
call Setup_NewWindow()
" Test for g`
clearjumps
@@ -2982,7 +2983,8 @@ func Test_normal_nvend()
call assert_equal([4, 5], [line('.'), col('.')])
exe "normal! \<C-End>"
call assert_equal([10, 6], [line('.'), col('.')])
- close!
+
+ bwipe!
endfunc
" Test for cw cW ce
@@ -3479,12 +3481,11 @@ func Test_java_motion()
call assert_equal([7, 8, 15], [line('.'), col('.'), virtcol('.')])
call assert_equal(-1, foldclosedend(7))
- close!
+ bwipe!
endfunc
" Tests for g cmds
func Test_normal_gdollar_cmd()
- CheckFeature jumplist
call Setup_NewWindow()
" Make long lines that will wrap
%s/$/\=repeat(' foobar', 10)/
@@ -3595,7 +3596,8 @@ func Test_normal_yank_with_excmd()
let @a = ''
call feedkeys("\"ay:if v:true\<CR>normal l\<CR>endif\<CR>", 'xt')
call assert_equal('f', @a)
- close!
+
+ bwipe!
endfunc
" Test for supplying a count to a normal-mode command across a cursorhold call
@@ -3617,7 +3619,8 @@ func Test_normal_cursorhold_with_count()
au!
augroup END
au! normalcHoldTest
- close!
+
+ bwipe!
delfunc s:cHold
endfunc
@@ -3641,7 +3644,8 @@ func Test_horiz_motion()
call assert_equal(11, col('.'))
exe "normal! $\<C-BS>"
call assert_equal(10, col('.'))
- close!
+
+ bwipe!
endfunc
" Test for using a : command in operator pending mode
@@ -3649,7 +3653,7 @@ func Test_normal_colon_op()
new
call setline(1, ['one', 'two'])
call assert_beeps("normal! Gc:d\<CR>")
- close!
+ bwipe!
endfunc
" Test for d and D commands
@@ -3674,7 +3678,7 @@ func Test_normal_delete_cmd()
call assert_fails('normal D', 'E21:')
call assert_fails('normal d$', 'E21:')
- close!
+ bwipe!
endfunc
" Test for deleting or changing characters across lines with 'whichwrap'
@@ -3694,7 +3698,8 @@ func Test_normal_op_across_lines()
call setline(1, ['one two', 'three four'])
exe "norm! $3x"
call assert_equal(['one twhree four'], getline(1, '$'))
- close!
+
+ bwipe!
set whichwrap&
endfunc
@@ -3732,23 +3737,54 @@ func Test_normal_word_move()
normal 3Gyb
call assert_equal("two\n ", @")
- close!
+ bwipe!
endfunc
" Test for 'scrolloff' with a long line that doesn't fit in the screen
-func Test_normal_scroloff()
+func Test_normal_scrolloff()
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
- call assert_equal(8, winline())
+ call assert_equal(6, winline())
normal 10gj
- 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!
+ bwipe!
endfunc
" Test for vertical scrolling with CTRL-F and CTRL-B with a long line
@@ -3768,7 +3804,8 @@ func Test_normal_vert_scroll_longline()
exe "normal \<C-B>\<C-B>"
call assert_equal(5, line('.'))
call assert_equal(5, winline())
- close!
+
+ bwipe!
endfunc
" Test for jumping in a file using %
@@ -3781,7 +3818,8 @@ func Test_normal_percent_jump()
call feedkeys('50%', 'xt')
call assert_equal(50, line('.'))
call assert_equal(-1, foldclosedend(50))
- close!
+
+ bwipe!
endfunc
" Test for << and >> commands to shift text by 'shiftwidth'
@@ -3874,24 +3912,25 @@ func Test_mouse_shape_after_failed_change()
CheckCanRunGui
let lines =<< trim END
+ vim9script
set mouseshape+=o:busy
setlocal nomodifiable
- let g:mouse_shapes = []
-
- func SaveMouseShape(timer)
- let g:mouse_shapes += [getmouseshape()]
- endfunc
-
- func SaveAndQuit(timer)
- call writefile(g:mouse_shapes, 'Xmouseshapes')
- quit
- endfunc
+ var mouse_shapes = []
- call timer_start(50, {_ -> feedkeys('c')})
- call timer_start(100, 'SaveMouseShape')
- call timer_start(150, {_ -> feedkeys('c')})
- call timer_start(200, 'SaveMouseShape')
- call timer_start(250, 'SaveAndQuit')
+ feedkeys('c')
+ timer_start(50, (_) => {
+ mouse_shapes += [getmouseshape()]
+ timer_start(50, (_) => {
+ feedkeys('c')
+ timer_start(50, (_) => {
+ mouse_shapes += [getmouseshape()]
+ timer_start(50, (_) => {
+ writefile(mouse_shapes, 'Xmouseshapes')
+ quit
+ })
+ })
+ })
+ })
END
call writefile(lines, 'Xmouseshape.vim', 'D')
call RunVim([], [], "-g -S Xmouseshape.vim")
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",
\ ]
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', '"<C-X>"', '"' .. &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'))
diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim
index 64f4ced470..8402fa51e2 100644
--- a/test/old/testdir/test_scroll_opt.vim
+++ b/test/old/testdir/test_scroll_opt.vim
@@ -1,4 +1,8 @@
-" Test for reset 'scroll'
+" Test for reset 'scroll' and 'smoothscroll'
+
+source check.vim
+source screendump.vim
+source mouse.vim
func Test_reset_scroll()
let scr = &l:scroll
@@ -51,4 +55,563 @@ 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 \<C-Y>"
+ call assert_equal([" 1 one "], ScreenLines(1, 10))
+ exe "normal \<C-E>\<C-E>\<C-E>"
+ call assert_equal([" 2 two "], ScreenLines(1, 10))
+
+ bwipe!
+ set nonumber
+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, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_1', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_2', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_3', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_4', {})
+
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_5', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_6', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_7', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_8', {})
+
+ if has('folding')
+ call term_sendkeys(buf, ":set foldmethod=indent\<CR>")
+ " move the cursor so we can reuse the same dumps
+ call term_sendkeys(buf, "5G")
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_1', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_2', {})
+ call term_sendkeys(buf, "7G")
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_7', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_8', {})
+ endif
+
+ 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 splitkeep=topline
+ set number cpo+=n
+ :3
+
+ def g:DoRel()
+ set number relativenumber scrolloff=0
+ :%del
+ setline(1, [
+ 'one',
+ 'very long text '->repeat(12),
+ 'three',
+ ])
+ exe "normal 2Gzt\<C-E>"
+ enddef
+ 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, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_2', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_3', {})
+
+ call term_sendkeys(buf, ":set cpo-=n\<CR>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_4', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_5', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_6', {})
+
+ call term_sendkeys(buf, ":botright split\<CR>gg")
+ call VerifyScreenDump(buf, 'Test_smooth_number_7', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_8', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_9', {})
+ call term_sendkeys(buf, ":close\<CR>")
+
+ call term_sendkeys(buf, ":call DoRel()\<CR>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_10', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
+func Test_smoothscroll_list()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ set smoothscroll scrolloff=0
+ set list
+ setline(1, [
+ 'one',
+ 'very long text '->repeat(12),
+ 'three',
+ ])
+ exe "normal 2Gzt\<C-E>"
+ 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:#\<CR>")
+ call VerifyScreenDump(buf, 'Test_smooth_list_2', {})
+
+ 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, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smooth_diff_1', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_diff_1', {})
+
+ 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', {})
+
+ " moving cursor down - whole bottom line shows
+ call term_sendkeys(buf, "j")
+ call VerifyScreenDump(buf, 'Test_smooth_wrap_2', {})
+
+ call term_sendkeys(buf, "\<C-E>j")
+ call VerifyScreenDump(buf, 'Test_smooth_wrap_3', {})
+
+ call term_sendkeys(buf, "G")
+ call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {})
+
+ " 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
+
+func Test_smoothscroll_wrap_long_line()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30)) .. ' end', 'four'])
+ 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, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_2', {})
+ call term_sendkeys(buf, "5\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_3', {})
+
+ " scrolling down, cursor moves screen line up
+ call term_sendkeys(buf, "5\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_4', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ 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\<CR>")
+ call term_sendkeys(buf, "10|\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_6', {})
+
+ " 'scrolloff' set to 1, scrolling down, cursor moves screen line up
+ call term_sendkeys(buf, "\<C-E>")
+ call term_sendkeys(buf, "gjgj")
+ call term_sendkeys(buf, "\<C-Y>")
+ 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\<CR>")
+ call term_sendkeys(buf, "10|\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_8', {})
+
+ " 'scrolloff' set to 2, scrolling down, cursor moves screen line up
+ call term_sendkeys(buf, "\<C-E>")
+ call term_sendkeys(buf, "gj")
+ call term_sendkeys(buf, "\<C-Y>")
+ 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\<CR>")
+ call term_sendkeys(buf, "0j")
+ call VerifyScreenDump(buf, 'Test_smooth_long_10', {})
+
+ " Test zt/zz/zb that they work properly when a long line is above it
+ call term_sendkeys(buf, "zb")
+ call VerifyScreenDump(buf, 'Test_smooth_long_11', {})
+ call term_sendkeys(buf, "zz")
+ call VerifyScreenDump(buf, 'Test_smooth_long_12', {})
+ call term_sendkeys(buf, "zt")
+ call VerifyScreenDump(buf, 'Test_smooth_long_13', {})
+
+ " 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'])\<CR>")
+ call term_sendkeys(buf, "3Gzt")
+ call term_sendkeys(buf, "j")
+ 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
+ " still end up scrolling down to the next line with cursor at bottom of
+ " screen.
+ call term_sendkeys(buf, "3Gzt")
+ call term_sendkeys(buf, "\<C-E>j")
+ call VerifyScreenDump(buf, 'Test_smooth_long_15', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
+func Test_smoothscroll_one_long_line()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ setline(1, 'with lots of text '->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, "\<C-E>")
+ 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
+
+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', {})
+
+ call term_sendkeys(buf, "\<C-E>")
+ 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
+
+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
+" separately in code.
+func Test_smoothscroll_cursor_position()
+ call NewWindow(10, 20)
+ setl smoothscroll wrap
+ call setline(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
+
+ call s:check_col_calc(1, 1, 1)
+ exe "normal \<C-E>"
+
+ " Move down another line to avoid blocking the <<< display
+ call s:check_col_calc(1, 2, 41)
+ exe "normal \<C-Y>"
+ call s:check_col_calc(1, 3, 41)
+
+ normal gg3l
+ exe "normal \<C-E>"
+
+ " 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 \<C-Y>"
+ call s:check_col_calc(4, 2, 24)
+ normal ggg$
+ exe "normal \<C-E>"
+ call s:check_col_calc(20, 1, 40)
+ exe "normal \<C-Y>"
+ 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 \<C-E>"
+
+ " Move down only 1 line when the <<< display is on the number column
+ call s:check_col_calc(5, 1, 17)
+ exe "normal \<C-Y>"
+ call s:check_col_calc(5, 2, 17)
+ normal ggg$
+ exe "normal \<C-E>"
+ call s:check_col_calc(20, 1, 32)
+ exe "normal \<C-Y>"
+ 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 \<C-E>"
+ call s:check_col_calc(3, 2, 37)
+ exe "normal \<C-Y>"
+ 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 \<C-E>"
+ call s:check_col_calc(4, 1, 20)
+ exe "normal \<C-Y>"
+ 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 \<C-E>"
+ call s:check_col_calc(8, 1, 17)
+ exe "normal \<C-Y>"
+ call s:check_col_calc(8, 2, 17)
+ 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 \<C-E>"
+ call s:check_col_calc(1, 2, 37)
+ exe "normal \<C-Y>"
+ call s:check_col_calc(1, 3, 37)
+ normal gg
+
+ 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 "<<<DEFG...", cursor move four lines down
+ exe "normal \<C-E>"
+ 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)
+
+ " cursor on last line, "gk" should not cause a scroll
+ set scrolloff=0
+ normal G0
+ call s:check_col_calc(1, 7, 1)
+ normal gk
+ call s:check_col_calc(1, 6, 101)
+
+ bwipe!
+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 \<C-E>"
+ 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 \<C-E>"
+ 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\<C-E>"
+ 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
+
+" 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 \<C-V>\<C-W>\<C-V>\<C-N>\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_zero_2', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
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-@\<CR>"
silent! execute "normal! \<C-W>]"
@@ -1889,7 +1889,26 @@ function Test_new_help_window_on_error()
call assert_equal(wincount, winnr('$'))
call assert_equal(expand("<cword>"), "'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 \<C-W>n\<C-W>L"
+ norm 000000
+ set number smoothscroll
+ exe "norm \<C-Y>"
+
+ only!
+ let &lines = save_lines
+ let &columns = save_columns
+ set cpo-=n
+ unmap 0
+ set nonumber nosmoothscroll
+endfunc
" vim: shiftwidth=2 sts=2 expandtab