aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/autocmd/textchanged_spec.lua11
-rw-r--r--test/functional/core/startup_spec.lua1
-rw-r--r--test/functional/legacy/listlbr_utf8_spec.lua29
-rw-r--r--test/functional/terminal/tui_spec.lua28
-rw-r--r--test/functional/ui/mouse_spec.lua6
-rw-r--r--test/functional/ui/popupmenu_spec.lua70
-rw-r--r--test/old/testdir/test_autocmd.vim20
-rw-r--r--test/old/testdir/test_listlbr_utf8.vim21
-rw-r--r--test/old/testdir/test_tabpage.vim7
9 files changed, 184 insertions, 9 deletions
diff --git a/test/functional/autocmd/textchanged_spec.lua b/test/functional/autocmd/textchanged_spec.lua
index 850d67a18d..d501560dc1 100644
--- a/test/functional/autocmd/textchanged_spec.lua
+++ b/test/functional/autocmd/textchanged_spec.lua
@@ -180,3 +180,14 @@ it('TextChangedI and TextChanged', function()
validate_mixed_textchangedi({ 's', '<esc>' })
validate_mixed_textchangedi({ 'S', '<esc>' })
end)
+
+-- oldtest: Test_TextChanged_with_norm()
+it('TextChanged is triggered after :norm that enters Insert mode', function()
+ exec([[
+ let g:a = 0
+ au TextChanged * let g:a += 1
+ ]])
+ eq(0, eval('g:a'))
+ feed(':norm! ia<CR>')
+ eq(1, eval('g:a'))
+end)
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index f4a9c0c8d7..cc58226f48 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -73,6 +73,7 @@ describe('startup', function()
os.remove(testfile)
end)
clear({ args = { '--startuptime', testfile } })
+ assert_log('Embedded', testfile, 100)
assert_log('sourcing', testfile, 100)
assert_log("require%('vim%._editor'%)", testfile, 100)
end)
diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua
index d7f4c71af2..2788e7ae9f 100644
--- a/test/functional/legacy/listlbr_utf8_spec.lua
+++ b/test/functional/legacy/listlbr_utf8_spec.lua
@@ -1,12 +1,14 @@
-- Test for linebreak and list option in utf-8 mode
local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
local source = helpers.source
local feed = helpers.feed
+local exec = helpers.exec
local clear, expect = helpers.clear, helpers.expect
describe('linebreak', function()
- setup(clear)
+ before_each(clear)
-- luacheck: ignore 621 (Indentation)
-- luacheck: ignore 613 (Trailing whitespaces in a string)
@@ -208,4 +210,29 @@ describe('linebreak', function()
a b c¶
Screen attributes are the same!]])
end)
+
+ -- oldtest: Test_visual_ends_before_showbreak()
+ it("Visual area is correct when it ends before multibyte 'showbreak'", function()
+ local screen = Screen.new(60, 8)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [1] = { background = Screen.colors.LightGrey }, -- Visual
+ [2] = { bold = true }, -- ModeMsg
+ })
+ screen:attach()
+ exec([[
+ let &wrap = v:true
+ let &linebreak = v:true
+ let &showbreak = '↪ '
+ eval ['xxxxx ' .. 'y'->repeat(&columns - 6) .. ' zzzz']->setline(1)
+ normal! wvel
+ ]])
+ screen:expect([[
+ xxxxx |
+ {0:↪ }{1:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy}^ {1: }|
+ {0:↪ }zzzz |
+ {0:~ }|*4
+ {2:-- VISUAL --} |
+ ]])
+ end)
end)
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 9dd5b00b83..d63338845a 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -655,6 +655,20 @@ describe('TUI', function()
end
screen:expect_unchanged()
if esc then
+ feed_data('\027[<64;5;1M')
+ else
+ api.nvim_input_mouse('wheel', 'up', '', 0, 0, 4)
+ end
+ screen:expect([[
+ {1:p}opup menu test |
+ {4:~ }{14: foo }{4: }|
+ {4:~ }{13: bar }{4: }|
+ {4:~ }{13: baz }{4: }|
+ {5:[No Name] [+] }|
+ |
+ {3:-- TERMINAL --} |
+ ]])
+ if esc then
feed_data('\027[<35;7;4M')
else
api.nvim_input_mouse('move', '', '', 0, 3, 6)
@@ -669,6 +683,20 @@ describe('TUI', function()
{3:-- TERMINAL --} |
]])
if esc then
+ feed_data('\027[<65;7;4M')
+ else
+ api.nvim_input_mouse('wheel', 'down', '', 0, 3, 6)
+ end
+ screen:expect([[
+ {1:p}opup menu test |
+ {4:~ }{13: foo }{4: }|
+ {4:~ }{14: bar }{4: }|
+ {4:~ }{13: baz }{4: }|
+ {5:[No Name] [+] }|
+ |
+ {3:-- TERMINAL --} |
+ ]])
+ if esc then
feed_data('\027[<0;7;3M')
else
api.nvim_input_mouse('left', 'press', '', 0, 2, 6)
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index 6a1b3fb0ed..7f551c5ee5 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -188,6 +188,9 @@ describe('ui/mouse/input', function()
|
]])
feed('<LeftMouse><11,0>')
+ -- Prevent the case where screen:expect() with "unchanged" returns too early,
+ -- causing the click position to be overwritten by the next drag.
+ poke_eventloop()
screen:expect {
grid = [[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -282,6 +285,9 @@ describe('ui/mouse/input', function()
|
]])
feed('<LeftMouse><11,0>')
+ -- Prevent the case where screen:expect() with "unchanged" returns too early,
+ -- causing the click position to be overwritten by the next drag.
+ poke_eventloop()
screen:expect {
grid = [[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 1f7d187016..1f0d20f66d 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -3784,9 +3784,7 @@ describe('builtin popupmenu', function()
{n: bar }|
{n: baz }|
]],
- float_pos = {
- [4] = { -1, 'NW', 2, 1, 17, false, 250 },
- },
+ float_pos = { [4] = { -1, 'NW', 2, 1, 17, false, 250 } },
}
else
feed('<RightMouse><18,0>')
@@ -3969,7 +3967,38 @@ describe('builtin popupmenu', function()
end
eq(true, screen.options.mousemoveevent)
if multigrid then
- api.nvim_input_mouse('move', '', '', 2, 3, 6)
+ api.nvim_input_mouse('wheel', 'up', '', 2, 0, 4)
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*5
+ [3:--------------------------------]|
+ ## grid 2
+ ^popup menu test |
+ {1:~ }|*4
+ ## grid 3
+ :let g:menustr = 'foo' |
+ ## grid 4
+ {s: foo }|
+ {n: bar }|
+ {n: baz }|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
+ })
+ else
+ feed('<ScrollWheelUp><4,0>')
+ screen:expect([[
+ ^popup menu test |
+ {1:~ }{s: foo }{1: }|
+ {1:~ }{n: bar }{1: }|
+ {1:~ }{n: baz }{1: }|
+ {1:~ }|
+ :let g:menustr = 'foo' |
+ ]])
+ end
+ eq(true, screen.options.mousemoveevent)
+ if multigrid then
+ api.nvim_input_mouse('move', '', '', 4, 2, 3)
screen:expect({
grid = [[
## grid 1
@@ -4000,7 +4029,38 @@ describe('builtin popupmenu', function()
end
eq(true, screen.options.mousemoveevent)
if multigrid then
- api.nvim_input_mouse('left', 'press', '', 2, 2, 6)
+ api.nvim_input_mouse('wheel', 'down', '', 4, 2, 3)
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*5
+ [3:--------------------------------]|
+ ## grid 2
+ ^popup menu test |
+ {1:~ }|*4
+ ## grid 3
+ :let g:menustr = 'foo' |
+ ## grid 4
+ {n: foo }|
+ {s: bar }|
+ {n: baz }|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 3, false, 250 } },
+ })
+ else
+ feed('<ScrollWheelDown><6,3>')
+ screen:expect([[
+ ^popup menu test |
+ {1:~ }{n: foo }{1: }|
+ {1:~ }{s: bar }{1: }|
+ {1:~ }{n: baz }{1: }|
+ {1:~ }|
+ :let g:menustr = 'foo' |
+ ]])
+ end
+ eq(true, screen.options.mousemoveevent)
+ if multigrid then
+ api.nvim_input_mouse('left', 'press', '', 4, 1, 3)
screen:expect({
grid = [[
## grid 1
diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim
index 7926411dcd..0a28ae6147 100644
--- a/test/old/testdir/test_autocmd.vim
+++ b/test/old/testdir/test_autocmd.vim
@@ -2533,7 +2533,25 @@ func Test_TextChangedI_with_setline()
call assert_equal('', getline(1))
call assert_equal('', getline(2))
- call test_override('starting', 0)
+ call test_override('char_avail', 0)
+ bwipe!
+endfunc
+
+func Test_TextChanged_with_norm()
+ " For unknown reason this fails on MS-Windows
+ CheckNotMSWindows
+ CheckFeature terminal
+ let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})
+ call assert_equal('running', term_getstatus(buf))
+ call term_sendkeys(buf, ":let g:a=0\<cr>")
+ call term_wait(buf, 50)
+ call term_sendkeys(buf, ":au! TextChanged * :let g:a+=1\<cr>")
+ call term_wait(buf, 50)
+ call term_sendkeys(buf, ":norm! ia\<cr>")
+ call term_wait(buf, 50)
+ call term_sendkeys(buf, ":echo g:a\<cr>")
+ call term_wait(buf, 50)
+ call WaitForAssert({-> assert_match('^1.*$', term_getline(buf, 3))})
bwipe!
endfunc
diff --git a/test/old/testdir/test_listlbr_utf8.vim b/test/old/testdir/test_listlbr_utf8.vim
index 1bbbd2d2ae..313ff30cc4 100644
--- a/test/old/testdir/test_listlbr_utf8.vim
+++ b/test/old/testdir/test_listlbr_utf8.vim
@@ -9,6 +9,7 @@ CheckFeature conceal
CheckFeature signs
source view_util.vim
+source screendump.vim
func s:screen_lines(lnum, width) abort
return ScreenLines(a:lnum, a:width)
@@ -358,4 +359,24 @@ func Test_unprintable_char_on_wrap_column()
call s:close_windows()
endfunc
+" Test that Visual selection is drawn correctly when 'linebreak' is set and
+" selection ends before multibyte 'showbreak'.
+func Test_visual_ends_before_showbreak()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ &wrap = true
+ &linebreak = true
+ &showbreak = '↪ '
+ ['xxxxx ' .. 'y'->repeat(&columns - 6) .. ' zzzz']->setline(1)
+ normal! wvel
+ END
+ call writefile(lines, 'XvisualEndsBeforeShowbreak', 'D')
+ let buf = RunVimInTerminal('-S XvisualEndsBeforeShowbreak', #{rows: 6})
+ call VerifyScreenDump(buf, 'Test_visual_ends_before_showbreak', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/old/testdir/test_tabpage.vim b/test/old/testdir/test_tabpage.vim
index d335f3c1ee..adb9e13269 100644
--- a/test/old/testdir/test_tabpage.vim
+++ b/test/old/testdir/test_tabpage.vim
@@ -156,10 +156,13 @@ func Test_tabpage_drop()
tab split f3
normal! gt
call assert_equal(1, tabpagenr())
+ tab drop f4
+ call assert_equal(1, tabpagenr('#'))
tab drop f3
- call assert_equal(3, tabpagenr())
- call assert_equal(1, tabpagenr('#'))
+ call assert_equal(4, tabpagenr())
+ call assert_equal(2, tabpagenr('#'))
+ bwipe!
bwipe!
bwipe!
bwipe!