aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:15:05 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:27:38 +0000
commitc5d770d311841ea5230426cc4c868e8db27300a8 (patch)
treedd21f70127b4b8b5f109baefc8ecc5016f507c91 /test/functional/ui
parent9be89f131f87608f224f0ee06d199fcd09d32176 (diff)
parent081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff)
downloadrneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/bufhl_spec.lua1
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua1
-rw-r--r--test/functional/ui/cmdline_spec.lua115
-rw-r--r--test/functional/ui/cursor_spec.lua1
-rw-r--r--test/functional/ui/decorations_spec.lua9
-rw-r--r--test/functional/ui/diff_spec.lua114
-rw-r--r--test/functional/ui/embed_spec.lua77
-rw-r--r--test/functional/ui/float_spec.lua40
-rw-r--r--test/functional/ui/fold_spec.lua19
-rw-r--r--test/functional/ui/highlight_spec.lua80
-rw-r--r--test/functional/ui/hlstate_spec.lua47
-rw-r--r--test/functional/ui/inccommand_spec.lua13
-rw-r--r--test/functional/ui/inccommand_user_spec.lua35
-rw-r--r--test/functional/ui/input_spec.lua3
-rw-r--r--test/functional/ui/linematch_spec.lua4
-rw-r--r--test/functional/ui/messages_spec.lua216
-rw-r--r--test/functional/ui/mode_spec.lua3
-rw-r--r--test/functional/ui/mouse_spec.lua975
-rw-r--r--test/functional/ui/multibyte_spec.lua24
-rw-r--r--test/functional/ui/multigrid_spec.lua3
-rw-r--r--test/functional/ui/options_spec.lua10
-rw-r--r--test/functional/ui/output_spec.lua3
-rw-r--r--test/functional/ui/popupmenu_spec.lua449
-rw-r--r--test/functional/ui/quickfix_spec.lua1
-rw-r--r--test/functional/ui/screen.lua93
-rw-r--r--test/functional/ui/screen_basic_spec.lua10
-rw-r--r--test/functional/ui/scrollbind_spec.lua1
-rw-r--r--test/functional/ui/searchhl_spec.lua1
-rw-r--r--test/functional/ui/sign_spec.lua358
-rw-r--r--test/functional/ui/spell_spec.lua80
-rw-r--r--test/functional/ui/statuscolumn_spec.lua472
-rw-r--r--test/functional/ui/statusline_spec.lua137
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua1
-rw-r--r--test/functional/ui/tabline_spec.lua63
-rw-r--r--test/functional/ui/title_spec.lua1
-rw-r--r--test/functional/ui/wildmode_spec.lua5
-rw-r--r--test/functional/ui/winbar_spec.lua25
37 files changed, 1931 insertions, 1559 deletions
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 5590db5bc4..b7cf8504ff 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -16,7 +16,6 @@ describe('Buffer highlighting', function()
clear()
command('syntax on')
screen = Screen.new(40, 8)
- screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { foreground = Screen.colors.Fuchsia }, -- String
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua
index 1c6f19245a..0ee994ba0a 100644
--- a/test/functional/ui/cmdline_highlight_spec.lua
+++ b/test/functional/ui/cmdline_highlight_spec.lua
@@ -24,7 +24,6 @@ end
before_each(function()
clear()
screen = Screen.new(40, 8)
- screen:attach()
source([[
highlight RBP1 guibg=Red
highlight RBP2 guibg=Yellow
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 6edfb4a49c..0221c1e0b0 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -13,30 +13,12 @@ local eq = t.eq
local is_os = t.is_os
local api = n.api
-local function new_screen(opt)
- local screen = Screen.new(25, 5)
- screen:attach(opt)
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Blue1 },
- [2] = { reverse = true },
- [3] = { bold = true, reverse = true },
- [4] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [5] = { bold = true, foreground = Screen.colors.SeaGreen4 },
- [6] = { foreground = Screen.colors.Magenta },
- [7] = { bold = true, foreground = Screen.colors.Brown },
- [8] = { foreground = Screen.colors.Black, background = Screen.colors.LightGrey },
- [9] = { bold = true },
- [10] = { background = Screen.colors.Yellow1 },
- })
- return screen
-end
-
local function test_cmdline(linegrid)
local screen
before_each(function()
clear()
- screen = new_screen({ rgb = true, ext_cmdline = true, ext_linegrid = linegrid })
+ screen = Screen.new(25, 5, { rgb = true, ext_cmdline = true, ext_linegrid = linegrid })
end)
it('works', function()
@@ -189,7 +171,7 @@ local function test_cmdline(linegrid)
},
{
firstc = '=',
- content = { { '1', 6 }, { '+', 7 }, { '2', 6 } },
+ content = { { '1', 26 }, { '+', 15 }, { '2', 26 } },
pos = 3,
},
}
@@ -503,29 +485,24 @@ local function test_cmdline(linegrid)
map <f5> :let x = input({'prompt':'>','highlight':'RainBowParens'})<cr>
"map <f5> :let x = input({'prompt':'>'})<cr>
]])
- screen:set_default_attr_ids({
- RBP1 = { background = Screen.colors.Red },
- RBP2 = { background = Screen.colors.Yellow },
- EOB = { bold = true, foreground = Screen.colors.Blue1 },
- })
feed('<f5>(a(b)a)')
screen:expect {
grid = [[
^ |
- {EOB:~ }|*3
+ {1:~ }|*3
|
]],
cmdline = {
{
prompt = '>',
content = {
- { '(', 'RBP1' },
+ { '(', 30 },
{ 'a' },
- { '(', 'RBP2' },
+ { '(', 10 },
{ 'b' },
- { ')', 'RBP2' },
+ { ')', 10 },
{ 'a' },
- { ')', 'RBP1' },
+ { ')', 30 },
},
pos = 7,
},
@@ -865,7 +842,7 @@ describe('cmdline redraw', function()
local screen
before_each(function()
clear()
- screen = new_screen({ rgb = true })
+ screen = Screen.new(25, 5, { rgb = true })
end)
it('with timer', function()
@@ -929,17 +906,17 @@ describe('cmdline redraw', function()
|
{1:~ }|*3
{2:[No Name] }|
- {1::}^a{8:bc} |
+ {1::}^a{17:bc} |
{1:~ }|*2
{3:[Command Line] }|
- {9:-- VISUAL --} |
+ {5:-- VISUAL --} |
]])
feed('<C-C>')
screen:expect([[
|
{1:~ }|*3
{2:[No Name] }|
- {1::}a{8:bc} |
+ {1::}a{17:bc} |
{1:~ }|*2
{3:[Command Line] }|
:^abc |
@@ -1030,7 +1007,7 @@ describe('statusline is redrawn on entering cmdline', function()
before_each(function()
clear()
- screen = new_screen()
+ screen = Screen.new(25, 5)
command('set laststatus=2')
end)
@@ -1093,61 +1070,61 @@ describe('statusline is redrawn on entering cmdline', function()
feed(':echoerr doesnotexist<cr>')
screen:expect {
grid = [[
- {9:c1 }|
+ {5:c1 }|
|
{3:c1 }|
|
{1:~ }|*5
{3: }|
- {4:E121: Undefined variable: doesnotex}|
- {4:ist} |
- {5:Press ENTER or type command to cont}|
- {5:inue}^ |
+ {9:E121: Undefined variable: doesnotex}|
+ {9:ist} |
+ {6:Press ENTER or type command to cont}|
+ {6:inue}^ |
]],
}
feed(':echoerr doesnotexist<cr>')
screen:expect {
grid = [[
- {9:c2 }|
+ {5:c2 }|
|
{3:c2 }|
|
{1:~ }|*2
{3: }|
- {4:E121: Undefined variable: doesnotex}|
- {4:ist} |
- {5:Press ENTER or type command to cont}|
- {4:E121: Undefined variable: doesnotex}|
- {4:ist} |
- {5:Press ENTER or type command to cont}|
- {5:inue}^ |
+ {9:E121: Undefined variable: doesnotex}|
+ {9:ist} |
+ {6:Press ENTER or type command to cont}|
+ {9:E121: Undefined variable: doesnotex}|
+ {9:ist} |
+ {6:Press ENTER or type command to cont}|
+ {6:inue}^ |
]],
}
feed(':echoerr doesnotexist<cr>')
screen:expect {
grid = [[
- {9:c3 }|
+ {5:c3 }|
|
{3:c3 }|
{3: }|
- {4:E121: Undefined variable: doesnotex}|
- {4:ist} |
- {5:Press ENTER or type command to cont}|
- {4:E121: Undefined variable: doesnotex}|
- {4:ist} |
- {5:Press ENTER or type command to cont}|
- {4:E121: Undefined variable: doesnotex}|
- {4:ist} |
- {5:Press ENTER or type command to cont}|
- {5:inue}^ |
+ {9:E121: Undefined variable: doesnotex}|
+ {9:ist} |
+ {6:Press ENTER or type command to cont}|
+ {9:E121: Undefined variable: doesnotex}|
+ {9:ist} |
+ {6:Press ENTER or type command to cont}|
+ {9:E121: Undefined variable: doesnotex}|
+ {9:ist} |
+ {6:Press ENTER or type command to cont}|
+ {6:inue}^ |
]],
}
feed('<cr>')
screen:expect {
grid = [[
- {9:n3 }|
+ {5:n3 }|
^ |
{3:n3 }|
|
@@ -1202,12 +1179,6 @@ end)
it('tabline is not redrawn in Ex mode #24122', function()
clear()
local screen = Screen.new(60, 5)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [1] = { bold = true, reverse = true }, -- MsgSeparator
- [2] = { reverse = true }, -- TabLineFill
- })
- screen:attach()
exec([[
set showtabline=2
@@ -1224,7 +1195,7 @@ it('tabline is not redrawn in Ex mode #24122', function()
grid = [[
{2:foo }|
|
- {1: }|
+ {3: }|
Entering Ex mode. Type "visual" to go to Normal mode. |
:^ |
]],
@@ -1233,7 +1204,7 @@ it('tabline is not redrawn in Ex mode #24122', function()
feed('echo 1<CR>')
screen:expect {
grid = [[
- {1: }|
+ {3: }|
Entering Ex mode. Type "visual" to go to Normal mode. |
:echo 1 |
1 |
@@ -1247,7 +1218,6 @@ describe('cmdline height', function()
it('does not crash resized screen #14263', function()
local screen = Screen.new(25, 10)
- screen:attach()
command('set cmdheight=9999')
screen:try_resize(25, 5)
assert_alive()
@@ -1268,7 +1238,6 @@ describe('cmdheight=0', function()
before_each(function()
clear()
screen = Screen.new(25, 5)
- screen:attach()
end)
it('with redrawdebug=invalid resize -1', function()
@@ -1535,7 +1504,7 @@ describe('cmdheight=0', function()
it('with silent! at startup', function()
clear { args = { '-c', 'set cmdheight=0', '-c', 'autocmd VimEnter * silent! call Foo()' } }
- screen:attach()
+ screen = Screen.new(25, 5)
-- doesn't crash while not displaying silent! error message
screen:expect {
grid = [[
@@ -1547,7 +1516,7 @@ describe('cmdheight=0', function()
it('with multigrid', function()
clear { args = { '--cmd', 'set cmdheight=0' } }
- screen:attach { ext_multigrid = true }
+ screen = Screen.new(25, 5, { ext_multigrid = true })
api.nvim_buf_set_lines(0, 0, -1, true, { 'p' })
screen:expect {
grid = [[
@@ -1710,7 +1679,7 @@ describe('cmdheight=0', function()
it('can be resized with external messages', function()
clear()
- screen = new_screen({ rgb = true, ext_messages = true })
+ screen = Screen.new(25, 5, { rgb = true, ext_messages = true })
command('set laststatus=2 mouse=a')
command('resize -1')
screen:expect([[
diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua
index 619153724b..d7c0657820 100644
--- a/test/functional/ui/cursor_spec.lua
+++ b/test/functional/ui/cursor_spec.lua
@@ -12,7 +12,6 @@ describe('ui/cursor', function()
before_each(function()
clear()
screen = Screen.new(25, 5)
- screen:attach()
end)
it("'guicursor' is published as a UI event", function()
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 042975f898..fbf16f3afe 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -20,7 +20,6 @@ describe('decorations providers', function()
before_each(function()
clear()
screen = Screen.new(40, 8)
- screen:attach()
screen:set_default_attr_ids {
[1] = {bold=true, foreground=Screen.colors.Blue};
[2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red};
@@ -766,7 +765,6 @@ describe('extmark decorations', function()
before_each( function()
clear()
screen = Screen.new(50, 15)
- screen:attach()
screen:set_default_attr_ids {
[1] = {bold=true, foreground=Screen.colors.Blue};
[2] = {foreground = Screen.colors.Brown};
@@ -1964,7 +1962,7 @@ describe('extmark decorations', function()
]]}
end)
- pending('highlight applies to a full TAB in visual block mode', function()
+ it('highlight applies to a full TAB in visual block mode', function()
screen:try_resize(50, 8)
command('hi! Visual guifg=NONE guibg=LightGrey')
api.nvim_buf_set_lines(0, 0, -1, true, {'asdf', '\tasdf', '\tasdf', '\tasdf', 'asdf'})
@@ -2501,7 +2499,6 @@ describe('decorations: inline virtual text', function()
before_each( function()
clear()
screen = Screen.new(50, 3)
- screen:attach()
screen:set_default_attr_ids {
[1] = {bold=true, foreground=Screen.colors.Blue};
[2] = {foreground = Screen.colors.Brown};
@@ -4121,7 +4118,6 @@ describe('decorations: virtual lines', function()
before_each(function()
clear()
screen = Screen.new(50, 12)
- screen:attach()
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Blue, background = Screen.colors.Yellow },
}
@@ -5046,7 +5042,6 @@ describe('decorations: signs', function()
before_each(function()
clear()
screen = Screen.new(50, 10)
- screen:attach()
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Blue, background = Screen.colors.Yellow },
}
@@ -5662,7 +5657,6 @@ describe('decorations: virt_text', function()
before_each(function()
clear()
screen = Screen.new(50, 10)
- screen:attach()
end)
it('avoids regression in #17638', function()
@@ -5737,7 +5731,6 @@ describe('decorations: window scoped', function()
before_each(function()
clear()
screen = Screen.new(20, 10)
- screen:attach()
screen:add_extra_attr_ids {
[100] = { special = Screen.colors.Red, undercurl = true },
[101] = { url = 'https://example.com' },
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index d6a04f90f6..95159011f1 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -53,7 +53,6 @@ describe('Diff mode screen', function()
feed('<c-w>w:diffthis<cr><c-w>w')
screen = Screen.new(40, 16)
- screen:attach()
end)
it('Add a line in beginning of file 2', function()
@@ -1172,7 +1171,6 @@ end)
it('win_update redraws lines properly', function()
local screen
screen = Screen.new(50, 10)
- screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
@@ -1250,7 +1248,6 @@ end)
-- oldtest: Test_diff_rnu()
it('diff updates line numbers below filler lines', function()
local screen = Screen.new(40, 14)
- screen:attach()
exec([[
call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
vnew
@@ -1310,7 +1307,6 @@ end)
-- oldtest: Test_diff_with_scroll_and_change()
it('Align the filler lines when changing text in diff mode', function()
local screen = Screen.new(40, 20)
- screen:attach()
exec([[
call setline(1, range(1, 15))
vnew
@@ -1376,7 +1372,6 @@ end)
it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function()
local screen = Screen.new(60, 6)
- screen:attach()
eq('0', api.nvim_get_option_value('foldcolumn', {}))
command('diffsplit | bd')
screen:expect([[
@@ -1389,7 +1384,6 @@ end)
it("'relativenumber' doesn't draw beyond end of window in diff mode #29403", function()
local screen = Screen.new(60, 12)
- screen:attach()
command('set relativenumber')
feed('10aa<CR><Esc>gg')
command('vnew')
@@ -1433,7 +1427,6 @@ it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', fun
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Blue, bold = true, background = Screen.colors.Red },
}
- screen:attach()
exec([[
call setline(1, ['a', 'b', "c\n", 'd', 'e', 'f', 'g'])
vnew
@@ -1510,7 +1503,6 @@ end)
-- oldtest: Test_diff_breakindent_after_filler()
it("diff mode draws 'breakindent' correctly after filler lines", function()
local screen = Screen.new(45, 8)
- screen:attach()
exec([[
set laststatus=0 diffopt+=followwrap breakindent breakindentopt=min:0
call setline(1, ['a', ' ' .. repeat('c', 50)])
@@ -1562,7 +1554,6 @@ it('diff mode overlapped diff blocks will be merged', function()
]])
local screen = Screen.new(35, 20)
- screen:attach()
command('set winwidth=10 diffopt=filler,internal')
command('args Xdifile1 Xdifile2 | vert all | windo diffthis')
@@ -2054,3 +2045,108 @@ it('diff mode overlapped diff blocks will be merged', function()
|
]])
end)
+
+-- oldtest: Test_diff_topline_noscroll()
+it('diff mode does not scroll with line("w0")', function()
+ local screen = Screen.new(45, 20)
+ exec([[
+ set scrolloff=5
+ call setline(1, range(1,60))
+ vnew
+ call setline(1, range(1,10) + range(50,60))
+ windo diffthis
+ norm! G
+ exe "norm! 30\<C-y>"
+ ]])
+ screen:expect([[
+ {7: }9 │{7: }9 |
+ {7: }10 │{7: }10 |
+ {7: }{23:--------------------}│{7: }{22:11 }|
+ {7: }{23:--------------------}│{7: }{22:12 }|
+ {7: }{23:--------------------}│{7: }{22:13 }|
+ {7: }{23:--------------------}│{7: }{22:14 }|
+ {7: }{23:--------------------}│{7: }{22:15 }|
+ {7: }{23:--------------------}│{7: }{22:16 }|
+ {7: }{23:--------------------}│{7: }{22:17 }|
+ {7: }{23:--------------------}│{7: }{22:18 }|
+ {7: }{23:--------------------}│{7: }{22:19 }|
+ {7: }{23:--------------------}│{7: }{22:20 }|
+ {7: }{23:--------------------}│{7: }{22:^21 }|
+ {7: }{23:--------------------}│{7: }{22:22 }|
+ {7: }{23:--------------------}│{7: }{22:23 }|
+ {7: }{23:--------------------}│{7: }{22:24 }|
+ {7: }{23:--------------------}│{7: }{22:25 }|
+ {7: }{23:--------------------}│{7: }{22:26 }|
+ {2:[No Name] [+] }{3:[No Name] [+] }|
+ |
+ ]])
+ command([[echo line('w0', 1001)]])
+ screen:expect([[
+ {7: }9 │{7: }9 |
+ {7: }10 │{7: }10 |
+ {7: }{23:--------------------}│{7: }{22:11 }|
+ {7: }{23:--------------------}│{7: }{22:12 }|
+ {7: }{23:--------------------}│{7: }{22:13 }|
+ {7: }{23:--------------------}│{7: }{22:14 }|
+ {7: }{23:--------------------}│{7: }{22:15 }|
+ {7: }{23:--------------------}│{7: }{22:16 }|
+ {7: }{23:--------------------}│{7: }{22:17 }|
+ {7: }{23:--------------------}│{7: }{22:18 }|
+ {7: }{23:--------------------}│{7: }{22:19 }|
+ {7: }{23:--------------------}│{7: }{22:20 }|
+ {7: }{23:--------------------}│{7: }{22:^21 }|
+ {7: }{23:--------------------}│{7: }{22:22 }|
+ {7: }{23:--------------------}│{7: }{22:23 }|
+ {7: }{23:--------------------}│{7: }{22:24 }|
+ {7: }{23:--------------------}│{7: }{22:25 }|
+ {7: }{23:--------------------}│{7: }{22:26 }|
+ {2:[No Name] [+] }{3:[No Name] [+] }|
+ 9 |
+ ]])
+ feed('<C-W>p')
+ screen:expect([[
+ {7: }{23:--------------------}│{7: }{22:39 }|
+ {7: }{23:--------------------}│{7: }{22:40 }|
+ {7: }{23:--------------------}│{7: }{22:41 }|
+ {7: }{23:--------------------}│{7: }{22:42 }|
+ {7: }{23:--------------------}│{7: }{22:43 }|
+ {7: }{23:--------------------}│{7: }{22:44 }|
+ {7: }{23:--------------------}│{7: }{22:45 }|
+ {7: }{23:--------------------}│{7: }{22:46 }|
+ {7: }{23:--------------------}│{7: }{22:47 }|
+ {7: }{23:--------------------}│{7: }{22:48 }|
+ {7: }{23:--------------------}│{7: }{22:49 }|
+ {7: }^50 │{7: }50 |
+ {7: }51 │{7: }51 |
+ {7: }52 │{7: }52 |
+ {7: }53 │{7: }53 |
+ {7: }54 │{7: }54 |
+ {7: }55 │{7: }55 |
+ {7:+ }{13:+-- 5 lines: 56····}│{7:+ }{13:+-- 5 lines: 56····}|
+ {3:[No Name] [+] }{2:[No Name] [+] }|
+ 9 |
+ ]])
+ feed('<C-W>p')
+ screen:expect([[
+ {7: }{23:--------------------}│{7: }{22:39 }|
+ {7: }{23:--------------------}│{7: }{22:40 }|
+ {7: }{23:--------------------}│{7: }{22:41 }|
+ {7: }{23:--------------------}│{7: }{22:42 }|
+ {7: }{23:--------------------}│{7: }{22:43 }|
+ {7: }{23:--------------------}│{7: }{22:^44 }|
+ {7: }{23:--------------------}│{7: }{22:45 }|
+ {7: }{23:--------------------}│{7: }{22:46 }|
+ {7: }{23:--------------------}│{7: }{22:47 }|
+ {7: }{23:--------------------}│{7: }{22:48 }|
+ {7: }{23:--------------------}│{7: }{22:49 }|
+ {7: }50 │{7: }50 |
+ {7: }51 │{7: }51 |
+ {7: }52 │{7: }52 |
+ {7: }53 │{7: }53 |
+ {7: }54 │{7: }54 |
+ {7: }55 │{7: }55 |
+ {7:+ }{13:+-- 5 lines: 56····}│{7:+ }{13:+-- 5 lines: 56····}|
+ {2:[No Name] [+] }{3:[No Name] [+] }|
+ 9 |
+ ]])
+end)
diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua
index e1abd43e20..977141ae3e 100644
--- a/test/functional/ui/embed_spec.lua
+++ b/test/functional/ui/embed_spec.lua
@@ -25,34 +25,31 @@ local function test_embed(ext_linegrid)
clear { args_rm = { '--headless' }, args = { ... } }
-- attach immediately after startup, for early UI
- screen = Screen.new(60, 8)
- screen:attach { ext_linegrid = ext_linegrid }
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [2] = { bold = true, foreground = Screen.colors.SeaGreen4 },
- [3] = { bold = true, foreground = Screen.colors.Blue1 },
- [4] = { bold = true, foreground = Screen.colors.Green },
- [5] = { bold = true, reverse = true },
- [6] = { foreground = Screen.colors.NvimLightGrey3, background = Screen.colors.NvimDarkGrey3 },
- [7] = { foreground = Screen.colors.NvimDarkRed },
- [8] = { foreground = Screen.colors.NvimDarkCyan },
- })
+ screen = Screen.new(60, 8, { ext_linegrid = ext_linegrid })
+ screen:add_extra_attr_ids {
+ [100] = { foreground = Screen.colors.NvimDarkCyan },
+ [101] = { foreground = Screen.colors.NvimDarkRed },
+ [102] = {
+ background = Screen.colors.NvimDarkGrey3,
+ foreground = Screen.colors.NvimLightGrey3,
+ },
+ }
end
it('can display errors', function()
startup('--cmd', 'echoerr invalid+')
screen:expect([[
|*4
- {6: }|
- {7:Error detected while processing pre-vimrc command line:} |
- {7:E121: Undefined variable: invalid} |
- {8:Press ENTER or type command to continue}^ |
+ {102: }|
+ {9:Error detected while processing pre-vimrc command line:} |
+ {9:E121: Undefined variable: invalid} |
+ {6:Press ENTER or type command to continue}^ |
]])
feed('<cr>')
screen:expect([[
^ |
- {3:~ }|*6
+ {1:~ }|*6
|
]])
end)
@@ -64,11 +61,11 @@ local function test_embed(ext_linegrid)
startup('--cmd', 'echoerr "foo"', '--cmd', 'color default', '--cmd', 'echoerr "bar"')
screen:expect([[
|*3
- {6: }|
- {7:Error detected while processing pre-vimrc command line:} |
- {7:foo} |
- {7:bar} |
- {8:Press ENTER or type command to continue}^ |
+ {102: }|
+ {9:Error detected while processing pre-vimrc command line:} |
+ {9:foo} |
+ {101:bar} |
+ {100:Press ENTER or type command to continue}^ |
]])
end)
@@ -77,11 +74,11 @@ local function test_embed(ext_linegrid)
screen:expect {
grid = [[
|*3
- {6: }|
- {7:Error detected while processing pre-vimrc command line:} |
- {7:foo} |
- {7:bar} |
- {8:Press ENTER or type command to continue}^ |
+ {102: }|
+ {9:Error detected while processing pre-vimrc command line:} |
+ {9:foo} |
+ {9:bar} |
+ {6:Press ENTER or type command to continue}^ |
]],
condition = function()
eq(Screen.colors.Green, screen.default_colors.rgb_bg)
@@ -112,13 +109,10 @@ describe('--embed UI', function()
clear { args_rm = { '--headless' }, io_extra = pipe.read, env = { NVIM_LOG_FILE = testlog } }
-- attach immediately after startup, for early UI
- local screen = Screen.new(40, 8)
+ -- rpc_async: Avoid hanging. #24888
+ local screen = Screen.new(40, 8, { stdin_fd = 3 }, false)
screen.rpc_async = true -- Avoid hanging. #24888
- screen:attach { stdin_fd = 3 }
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue1 },
- [2] = { bold = true },
- }
+ screen:attach()
writer:write 'hello nvim\nfrom external input\n'
writer:shutdown(function()
@@ -139,7 +133,7 @@ describe('--embed UI', function()
^ |
from external input |
{1:~ }|*4
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]]
if not is_os('win') then
@@ -170,13 +164,9 @@ describe('--embed UI', function()
clear { args_rm = { '--headless' }, args = { '-q', '-' }, io_extra = pipe.read }
-- attach immediately after startup, for early UI
- local screen = Screen.new(60, 8)
+ local screen = Screen.new(60, 8, { stdin_fd = 3 }, false)
screen.rpc_async = true -- Avoid hanging. #24888
- screen:attach { stdin_fd = 3 }
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue1 },
- [2] = { bold = true },
- }
+ screen:attach()
writer:write [[Xbadfile.c:4:12: error: expected ';' before '}' token]]
writer:shutdown(function()
@@ -202,7 +192,7 @@ describe('--embed UI', function()
return 666^ |
} |
{1:~ }|*2
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]]
eq('-', api.nvim_get_option_value('errorfile', {}))
@@ -222,7 +212,6 @@ describe('--embed UI', function()
-- attach immediately after startup, for early UI
screen = Screen.new(40, 8)
screen._handle_default_colors_set = handle_default_colors_set
- screen:attach()
end
startup()
@@ -249,7 +238,6 @@ describe('--embed UI', function()
clear { args_rm = { '--headless' } }
local screen = Screen.new(40, 8)
- screen:attach()
screen:expect {
condition = function()
@@ -336,8 +324,7 @@ describe('--embed --listen UI', function()
ok(var_ok)
eq({}, var)
- local child_screen = Screen.new(40, 6)
- child_screen:attach(nil, child_session)
+ local child_screen = Screen.new(40, 6, nil, child_session)
child_screen:expect {
grid = [[
^ |
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 9b77cb4014..57ef9bcff6 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -640,8 +640,7 @@ describe('float window', function()
end)
it('tp_curwin updated if external window is moved into split', function()
- local screen = Screen.new(20, 7)
- screen:attach { ext_multigrid = true }
+ local _ = Screen.new(20, 7, { ext_multigrid = true })
command('tabnew')
local external_win = api.nvim_open_win(0, true, {external = true, width = 5, height = 5})
@@ -658,8 +657,6 @@ describe('float window', function()
command('tabnext')
eq(2, fn.tabpagenr())
neq(external_win, api.nvim_get_current_win())
-
- screen:detach()
end)
it('no crash with relative="win" after %bdelete #30569', function()
@@ -1018,8 +1015,7 @@ describe('float window', function()
local function with_ext_multigrid(multigrid)
local screen, attrs
before_each(function()
- screen = Screen.new(40,7)
- screen:attach {ext_multigrid=multigrid}
+ screen = Screen.new(40,7, {ext_multigrid=multigrid})
attrs = {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background = Screen.colors.LightMagenta},
@@ -1278,7 +1274,7 @@ describe('float window', function()
it('return their configuration', function()
local buf = api.nvim_create_buf(false, false)
local win = api.nvim_open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5, zindex=60})
- local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false}
+ local expected = {anchor='NW', col=5, external=false, focusable=true, mouse=true, height=2, relative='editor', row=3, width=20, zindex=60, hide=false}
eq(expected, api.nvim_win_get_config(win))
eq(true, exec_lua([[
local expected, win = ...
@@ -1290,11 +1286,11 @@ describe('float window', function()
end
return true]], expected, win))
- eq({external=false, focusable=true, hide=false, relative='',split="left",width=40,height=6}, api.nvim_win_get_config(0))
+ eq({external=false, focusable=true, mouse=true, hide=false, relative='',split="left",width=40,height=6}, api.nvim_win_get_config(0))
if multigrid then
api.nvim_win_set_config(win, {external=true, width=10, height=1})
- eq({external=true,focusable=true,width=10,height=1,relative='',hide=false}, api.nvim_win_get_config(win))
+ eq({external=true,focusable=true,mouse=true,width=10,height=1,relative='',hide=false}, api.nvim_win_get_config(win))
end
end)
@@ -3988,7 +3984,7 @@ describe('float window', function()
]]}
end
eq({relative='win', width=12, height=1, bufpos={1,32}, anchor='NW', hide=false,
- external=false, col=0, row=1, win=firstwin, focusable=true, zindex=50}, api.nvim_win_get_config(win))
+ external=false, col=0, row=1, win=firstwin, focusable=true, mouse=true, zindex=50}, api.nvim_win_get_config(win))
feed('<c-e>')
if multigrid then
@@ -5606,7 +5602,7 @@ describe('float window', function()
end
end)
- it("focus by mouse", function()
+ local function test_float_mouse_focus()
if multigrid then
api.nvim_input_mouse('left', 'press', '', 4, 0, 0)
screen:expect{grid=[[
@@ -5660,10 +5656,18 @@ describe('float window', function()
|
]])
end
+ end
+
+ it("focus by mouse (focusable=true)", function()
+ test_float_mouse_focus()
end)
- it("focus by mouse (focusable=false)", function()
- api.nvim_win_set_config(win, {focusable=false})
+ it("focus by mouse (focusable=false, mouse=true)", function()
+ api.nvim_win_set_config(win, {focusable=false, mouse=true})
+ test_float_mouse_focus()
+ end)
+
+ local function test_float_mouse_no_focus()
api.nvim_buf_set_lines(0, -1, -1, true, {"a"})
expected_pos[4][6] = false
if multigrid then
@@ -5721,6 +5725,16 @@ describe('float window', function()
|
]])
end
+ end
+
+ it("focus by mouse (focusable=false)", function()
+ api.nvim_win_set_config(win, {focusable=false})
+ test_float_mouse_no_focus()
+ end)
+
+ it("focus by mouse (focusable=true, mouse=false)", function()
+ api.nvim_win_set_config(win, {mouse=false})
+ test_float_mouse_no_focus()
end)
it("j", function()
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 2712e5ff48..aea629df07 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -28,8 +28,7 @@ describe('folded lines', function()
local function with_ext_multigrid(multigrid)
local screen
before_each(function()
- screen = Screen.new(45, 8)
- screen:attach({ rgb = true, ext_multigrid = multigrid })
+ screen = Screen.new(45, 8, { rgb = true, ext_multigrid = multigrid })
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { reverse = true },
@@ -55,6 +54,8 @@ describe('folded lines', function()
},
[19] = { background = Screen.colors.Yellow, foreground = Screen.colors.DarkBlue },
[20] = { background = Screen.colors.Red, bold = true, foreground = Screen.colors.Blue },
+ [21] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Green },
+ [22] = { background = Screen.colors.Red, foreground = Screen.colors.Green },
})
end)
@@ -2625,6 +2626,8 @@ describe('folded lines', function()
command('hi! CursorLine guibg=NONE guifg=Red gui=NONE')
command('hi F0 guibg=Red guifg=Black')
command('hi F1 guifg=White')
+ command([[syn match Keyword /\<sentence\>/]])
+ command('hi! Keyword guibg=NONE guifg=Green')
api.nvim_set_option_value('cursorline', true, {})
api.nvim_set_option_value('foldcolumn', '4', {})
api.nvim_set_option_value('foldtext', '', {})
@@ -2662,7 +2665,7 @@ describe('folded lines', function()
## grid 2
{7: }This is a |
{7:- }valid English |
- {7:│+ }{5:sentence composed by······}|
+ {7:│+ }{21:sentence}{5: composed by······}|
{7:│+ }{13:^in his cave.··············}|
{1:~ }|*2
## grid 3
@@ -2672,7 +2675,7 @@ describe('folded lines', function()
screen:expect([[
{7: }This is a |
{7:- }valid English |
- {7:│+ }{5:sentence composed by······}|
+ {7:│+ }{21:sentence}{5: composed by······}|
{7:│+ }{13:^in his cave.··············}|
{1:~ }|*2
|
@@ -2689,7 +2692,7 @@ describe('folded lines', function()
## grid 2
{7: }This is a |
{7:- }^v{14:alid English} |
- {7:│+ }{15:sentence composed by······}|
+ {7:│+ }{22:sentence}{15: composed by······}|
{7:│+ }{15:in his cave.··············}|
{1:~ }|*2
## grid 3
@@ -2699,7 +2702,7 @@ describe('folded lines', function()
screen:expect([[
{7: }This is a |
{7:- }^v{14:alid English} |
- {7:│+ }{15:sentence composed by······}|
+ {7:│+ }{22:sentence}{15: composed by······}|
{7:│+ }{15:in his cave.··············}|
{1:~ }|*2
{11:-- VISUAL LINE --} |
@@ -2715,7 +2718,7 @@ describe('folded lines', function()
## grid 2
a si sihT{7: }|
{14:hsilgnE dila}^v{7: -}|
- {15:······yb desopmoc ecnetnes}{7: +│}|
+ {15:······yb desopmoc }{22:ecnetnes}{7: +│}|
{15:··············.evac sih ni}{7: +│}|
{1: ~}|*2
## grid 3
@@ -2725,7 +2728,7 @@ describe('folded lines', function()
screen:expect([[
a si sihT{7: }|
{14:hsilgnE dila}^v{7: -}|
- {15:······yb desopmoc ecnetnes}{7: +│}|
+ {15:······yb desopmoc }{22:ecnetnes}{7: +│}|
{15:··············.evac sih ni}{7: +│}|
{1: ~}|*2
{11:-- VISUAL LINE --} |
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 87d66fa604..0f4696f3d3 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -32,7 +32,6 @@ describe('highlight: `:syntax manual`', function()
before_each(function()
clear()
screen = Screen.new(20, 5)
- screen:attach()
-- syntax highlight for vimscript's "echo"
end)
@@ -93,7 +92,6 @@ describe('highlight defaults', function()
[100] = { foreground = Screen.colors.Red, background = Screen.colors.WebGreen },
[101] = { italic = true },
}
- screen:attach()
end)
it('window status bar', function()
@@ -303,7 +301,6 @@ describe('highlight', function()
it('Visual', function()
local screen = Screen.new(45, 5)
- screen:attach()
insert([[
line1 foo bar
abcdefghijklmnopqrs
@@ -428,7 +425,6 @@ describe('highlight', function()
it('cterm=standout gui=standout', function()
local screen = Screen.new(20, 5)
- screen:attach()
screen:add_extra_attr_ids {
[100] = {
foreground = Screen.colors.Blue1,
@@ -454,7 +450,6 @@ describe('highlight', function()
it('strikethrough', function()
local screen = Screen.new(25, 6)
- screen:attach()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword foo')
feed_command('hi! Awesome cterm=strikethrough gui=strikethrough')
@@ -490,7 +485,6 @@ describe('highlight', function()
background = Screen.colors.Yellow,
},
}
- screen:attach()
feed_command('syntax on')
feed_command('hi! Underlined cterm=underline gui=underline')
feed_command('syn keyword Underlined foobar')
@@ -532,7 +526,6 @@ describe('highlight', function()
it('guisp (special/undercurl)', function()
local screen = Screen.new(25, 10)
- screen:attach()
feed_command('syntax on')
feed_command('syn keyword TmpKeyword neovim')
feed_command('syn keyword TmpKeyword1 special')
@@ -585,7 +578,6 @@ describe('highlight', function()
it("'diff', syntax and extmark #23722", function()
local screen = Screen.new(25, 10)
- screen:attach()
exec([[
new
call setline(1, ['', '01234 6789'])
@@ -631,7 +623,6 @@ describe("'listchars' highlight", function()
before_each(function()
clear()
screen = Screen.new(20, 5)
- screen:attach()
end)
it("'cursorline' and 'cursorcolumn'", function()
@@ -873,7 +864,6 @@ describe('CursorLine and CursorLineNr highlights', function()
[100] = { background = Screen.colors.LightRed },
[101] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
}
- screen:attach()
command('filetype on')
command('syntax on')
@@ -906,7 +896,6 @@ describe('CursorLine and CursorLineNr highlights', function()
[102] = { foreground = Screen.colors.Grey0, background = Screen.colors.Grey100 },
[103] = { foreground = Screen.colors.Yellow1, background = Screen.colors.Grey100 },
}
- screen:attach()
feed_command('set wrap cursorline')
feed_command('set showbreak=>>>')
@@ -957,7 +946,6 @@ describe('CursorLine and CursorLineNr highlights', function()
[102] = { foreground = Screen.colors.Black, background = Screen.colors.Grey100 },
[103] = { foreground = Screen.colors.WebGreen, background = Screen.colors.Red },
}
- screen:attach()
command('set wrap cursorline cursorlineopt=screenline')
command('set showbreak=>>>')
@@ -1081,7 +1069,6 @@ describe('CursorLine and CursorLineNr highlights', function()
-- oldtest: Test_cursorline_screenline_resize()
it("'cursorlineopt' screenline is updated on window resize", function()
local screen = Screen.new(75, 8)
- screen:attach()
exec([[
50vnew
call setline(1, repeat('xyz ', 30))
@@ -1123,7 +1110,6 @@ describe('CursorLine and CursorLineNr highlights', function()
[100] = { background = Screen.colors.LightRed },
[101] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
}
- screen:attach()
command('set cursorline relativenumber')
command('call setline(1, ["","1","2","3",""])')
feed('Gy3k')
@@ -1151,7 +1137,6 @@ describe('CursorLine and CursorLineNr highlights', function()
[100] = { foreground = Screen.colors.SlateBlue, background = Screen.colors.Grey90 },
[101] = { background = Screen.colors.LightRed },
}
- screen:attach()
command('set cursorline')
command('call setline(1, repeat(["abc"], 50))')
feed('V<C-f>zbkkjk')
@@ -1166,7 +1151,6 @@ describe('CursorLine and CursorLineNr highlights', function()
-- oldtest: Test_cursorline_callback()
it('is updated if cursor is moved up from timer vim-patch:8.2.4591', function()
local screen = Screen.new(50, 8)
- screen:attach()
exec([[
call setline(1, ['aaaaa', 'bbbbb', 'ccccc', 'ddddd'])
set cursorline
@@ -1207,7 +1191,6 @@ describe('CursorLine and CursorLineNr highlights', function()
[100] = { background = Screen.colors.Plum1, underline = true },
[101] = { background = Screen.colors.Red1, bold = true, underline = true },
}
- screen:attach()
command('hi CursorLine ctermbg=red ctermfg=white guibg=red guifg=white')
command('set cursorline')
@@ -1267,7 +1250,6 @@ describe('CursorLine and CursorLineNr highlights', function()
screen:add_extra_attr_ids {
[100] = { foreground = Screen.colors.Black, bold = true, background = Screen.colors.Grey100 },
}
- screen:attach()
command('hi CursorLine guibg=red guifg=white')
command('hi CursorLineNr guibg=white guifg=black gui=bold')
@@ -1308,7 +1290,6 @@ describe('CursorColumn highlight', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Blue1 },
}
- screen:attach()
end)
it('is updated when pressing "i" on a TAB character', function()
@@ -1435,7 +1416,6 @@ describe('ColorColumn highlight', function()
[101] = { background = Screen.colors.LightRed },
[102] = { foreground = Screen.colors.Blue1, bold = true, background = Screen.colors.LightRed },
}
- screen:attach()
end)
-- oldtest: Test_colorcolumn()
@@ -1538,7 +1518,6 @@ describe('MsgSeparator highlight and msgsep fillchar', function()
[12] = { background = Screen.colors.Gray60, bold = true, foreground = tonumber('0x297d4e') },
[13] = { background = tonumber('0xff4cff'), bold = true, foreground = tonumber('0xb200ff') },
})
- screen:attach()
end)
it('works', function()
@@ -1653,7 +1632,6 @@ describe("'winhighlight' highlight", function()
before_each(function()
clear()
screen = Screen.new(20, 8)
- screen:attach()
screen:set_default_attr_ids {
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { background = Screen.colors.DarkBlue },
@@ -1691,6 +1669,7 @@ describe("'winhighlight' highlight", function()
[29] = { foreground = Screen.colors.Blue1, background = Screen.colors.Red, bold = true },
[30] = { background = tonumber('0xff8800') },
[31] = { background = tonumber('0xff8800'), bold = true, foreground = Screen.colors.Blue },
+ [32] = { bold = true, reverse = true, background = Screen.colors.DarkGreen },
}
command('hi Background1 guibg=DarkBlue')
command('hi Background2 guibg=DarkGreen')
@@ -2253,10 +2232,10 @@ describe("'winhighlight' highlight", function()
some text |
more tex^t |
{0:~ }|
- {3:[No Name] }{1:2,9 All}|
+ {3:[No Name] }{11:2,9 All}|
some text |
more text |
- {4:[No Name] }{1:1,1 All}|
+ {4:[No Name] }{14:1,1 All}|
|
]],
}
@@ -2267,10 +2246,10 @@ describe("'winhighlight' highlight", function()
some text |
more tex^t |
{0:~ }|
- {3:[No Name] }{5:2,9 All}|
+ {3:[No Name] }{32:2,9 All}|
some text |
more text |
- {4:[No Name] }{1:1,1 All}|
+ {4:[No Name] }{14:1,1 All}|
|
]],
}
@@ -2281,10 +2260,10 @@ describe("'winhighlight' highlight", function()
some tex^t |
more text |
{0:~ }|
- {3:[No Name] }{5:1,9 All}|
+ {3:[No Name] }{32:1,9 All}|
some text |
more text |
- {4:[No Name] }{1:1,1 All}|
+ {4:[No Name] }{14:1,1 All}|
|
]],
}
@@ -2316,7 +2295,6 @@ describe('highlight namespaces', function()
before_each(function()
clear()
screen = Screen.new(25, 10)
- screen:attach()
screen:set_default_attr_ids {
[1] = { foreground = Screen.colors.Blue, bold = true },
[2] = { background = Screen.colors.DarkGrey },
@@ -2425,16 +2403,24 @@ describe('highlight namespaces', function()
end)
it('winhl does not accept invalid value #24586', function()
- local res = exec_lua([[
- local curwin = vim.api.nvim_get_current_win()
- vim.api.nvim_command("set winhl=Normal:Visual")
- local _, msg = pcall(vim.api.nvim_command,"set winhl='Normal:Wrong'")
- return { msg, vim.wo[curwin].winhl }
- ]])
- eq({
- 'Vim(set):E5248: Invalid character in group name',
- 'Normal:Visual',
- }, res)
+ command('set winhl=Normal:Visual')
+ for _, cmd in ipairs({
+ [[set winhl='Normal:Wrong']],
+ [[set winhl=Normal:Wrong']],
+ [[set winhl='Normal:Wrong]],
+ }) do
+ local res = exec_lua(
+ [[
+ local _, msg = pcall(vim.api.nvim_command, ...)
+ return { msg, vim.wo.winhl }
+ ]],
+ cmd
+ )
+ eq({
+ 'Vim(set):E5248: Invalid character in group name',
+ 'Normal:Visual',
+ }, res)
+ end
end)
it('Normal in set_hl #25474', function()
@@ -2458,10 +2444,8 @@ describe('highlight namespaces', function()
end)
describe('synIDattr()', function()
- local screen
before_each(function()
clear()
- screen = Screen.new(50, 7)
command('highlight Normal ctermfg=252 guifg=#ff0000 guibg=Black')
-- Salmon #fa8072 Maroon #800000
command(
@@ -2486,7 +2470,7 @@ describe('synIDattr()', function()
end)
it('returns gui-color if RGB-capable UI is attached', function()
- screen:attach({ rgb = true })
+ local _ = Screen.new(50, 7, { rgb = true })
eq('#ff0000', eval('synIDattr(hlID("Normal"), "fg")'))
eq('Black', eval('synIDattr(hlID("Normal"), "bg")'))
eq('Salmon', eval('synIDattr(hlID("Keyword"), "fg")'))
@@ -2494,15 +2478,15 @@ describe('synIDattr()', function()
end)
it('returns #RRGGBB value for fg#/bg#/sp#', function()
- screen:attach({ rgb = true })
+ local _ = Screen.new(50, 7, { rgb = true })
eq('#ff0000', eval('synIDattr(hlID("Normal"), "fg#")'))
eq('#000000', eval('synIDattr(hlID("Normal"), "bg#")'))
eq('#fa8072', eval('synIDattr(hlID("Keyword"), "fg#")'))
eq('#800000', eval('synIDattr(hlID("Keyword"), "sp#")'))
end)
- it('returns color number if non-GUI', function()
- screen:attach({ rgb = false })
+ it('returns color number if non-RGB GUI', function()
+ local _ = Screen.new(50, 7, { rgb = false })
eq('252', eval('synIDattr(hlID("Normal"), "fg")'))
eq('79', eval('synIDattr(hlID("Keyword"), "fg")'))
end)
@@ -2527,10 +2511,8 @@ describe('synIDattr()', function()
end)
describe('fg/bg special colors', function()
- local screen
before_each(function()
clear()
- screen = Screen.new(50, 7)
command('highlight Normal ctermfg=145 ctermbg=16 guifg=#ff0000 guibg=Black')
command('highlight Visual ctermfg=bg ctermbg=fg guifg=bg guibg=fg guisp=bg')
end)
@@ -2549,7 +2531,7 @@ describe('fg/bg special colors', function()
end)
it('resolve to "Normal" values in RGB-capable UI', function()
- screen:attach({ rgb = true })
+ local _ = Screen.new(50, 7, { rgb = true })
eq('bg', eval('synIDattr(hlID("Visual"), "fg")'))
eq(eval('synIDattr(hlID("Normal"), "bg#")'), eval('synIDattr(hlID("Visual"), "fg#")'))
eq('fg', eval('synIDattr(hlID("Visual"), "bg")'))
@@ -2559,7 +2541,7 @@ describe('fg/bg special colors', function()
end)
it('resolve after the "Normal" group is modified', function()
- screen:attach({ rgb = true })
+ local _ = Screen.new(50, 7, { rgb = true })
local new_guibg = '#282c34'
local new_guifg = '#abb2bf'
command('highlight Normal guifg=' .. new_guifg .. ' guibg=' .. new_guibg)
diff --git a/test/functional/ui/hlstate_spec.lua b/test/functional/ui/hlstate_spec.lua
index a255047ed7..f8f5ee9488 100644
--- a/test/functional/ui/hlstate_spec.lua
+++ b/test/functional/ui/hlstate_spec.lua
@@ -17,12 +17,7 @@ describe('ext_hlstate detailed highlights', function()
clear()
command('syntax on')
command('hi VertSplit gui=reverse')
- screen = Screen.new(40, 8)
- screen:attach({ ext_hlstate = true })
- end)
-
- after_each(function()
- screen:detach()
+ screen = Screen.new(40, 8, { ext_hlstate = true })
end)
it('work with combined UI and syntax highlights', function()
@@ -33,42 +28,42 @@ describe('ext_hlstate detailed highlights', function()
api.nvim_buf_add_highlight(0, -1, 'Statement', 1, 5, -1)
command('/th co')
- screen:expect(
- [[
+ screen:expect {
+ grid = [[
these are {1:some} lines |
^wi{2:th }{4:co}{3:lorful text} |
{5:~ }|*5
- {8:search hit BOTTOM, continuing at TOP}{7: }|
+ {8:search hit BOTTOM, continuing at TOP}{6: }|
]],
- {
+ attr_ids = {
[1] = {
- { foreground = Screen.colors.Magenta },
- { { hi_name = 'Constant', kind = 'syntax' } },
+ { foreground = Screen.colors.Magenta1 },
+ { { kind = 'syntax', hi_name = 'Constant' } },
},
[2] = {
- { background = Screen.colors.Yellow },
- { { hi_name = 'Search', ui_name = 'Search', kind = 'ui' } },
+ { background = Screen.colors.Yellow1 },
+ { { kind = 'ui', ui_name = 'Search', hi_name = 'Search' } },
},
[3] = {
- { bold = true, foreground = Screen.colors.Brown },
- { { hi_name = 'Statement', kind = 'syntax' } },
+ { foreground = Screen.colors.Brown, bold = true },
+ { { kind = 'syntax', hi_name = 'Statement' } },
},
[4] = {
- { bold = true, background = Screen.colors.Yellow, foreground = Screen.colors.Brown },
+ { background = Screen.colors.Yellow1, bold = true, foreground = Screen.colors.Brown },
{ 3, 2 },
},
[5] = {
- { bold = true, foreground = Screen.colors.Blue1 },
- { { hi_name = 'NonText', ui_name = 'EndOfBuffer', kind = 'ui' } },
+ { foreground = Screen.colors.Blue, bold = true },
+ { { kind = 'ui', ui_name = 'EndOfBuffer', hi_name = 'NonText' } },
},
- [6] = {
- { foreground = Screen.colors.Red },
- { { hi_name = 'WarningMsg', ui_name = 'WarningMsg', kind = 'ui' } },
+ [6] = { {}, { { kind = 'ui', ui_name = 'MsgArea', hi_name = 'MsgArea' } } },
+ [7] = {
+ { foreground = Screen.colors.Red1 },
+ { { kind = 'syntax', hi_name = 'WarningMsg' } },
},
- [7] = { {}, { { hi_name = 'MsgArea', ui_name = 'MsgArea', kind = 'ui' } } },
- [8] = { { foreground = Screen.colors.Red }, { 7, 6 } },
- }
- )
+ [8] = { { foreground = Screen.colors.Red1 }, { 6, 7 } },
+ },
+ }
end)
it('work with cleared UI highlights', function()
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index c11e009fef..37dc0f5195 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -66,7 +66,6 @@ local function common_setup(screen, inccommand, text)
command('syntax on')
command('set nohlsearch')
command('hi Substitute guifg=red guibg=yellow')
- screen:attach()
screen:add_extra_attr_ids {
[100] = { underline = true },
@@ -556,10 +555,9 @@ describe(":substitute, 'inccommand' preserves undo", function()
end)
it('with undolevels=1', function()
- local screen = Screen.new(20, 10)
-
for _, case in pairs(cases) do
clear()
+ local screen = Screen.new(20, 10)
common_setup(screen, case, default_text)
screen:expect([[
Inc substitution on |
@@ -617,10 +615,9 @@ describe(":substitute, 'inccommand' preserves undo", function()
end)
it('with undolevels=2', function()
- local screen = Screen.new(20, 10)
-
for _, case in pairs(cases) do
clear()
+ local screen = Screen.new(20, 10)
common_setup(screen, case, default_text)
command('set undolevels=2')
@@ -697,10 +694,9 @@ describe(":substitute, 'inccommand' preserves undo", function()
end)
it('with undolevels=-1', function()
- local screen = Screen.new(20, 10)
-
for _, case in pairs(cases) do
clear()
+ local screen = Screen.new(20, 10)
common_setup(screen, case, default_text)
command('set undolevels=-1')
@@ -728,6 +724,7 @@ describe(":substitute, 'inccommand' preserves undo", function()
-- repeat with an interrupted substitution
clear()
+ screen = Screen.new(20, 10)
common_setup(screen, case, default_text)
command('set undolevels=-1')
@@ -2510,7 +2507,7 @@ describe(':substitute', function()
end)
it("doesn't prompt to swap cmd range", function()
- screen = Screen.new(50, 8) -- wide to avoid hit-enter prompt
+ screen:try_resize(50, 8) -- wide to avoid hit-enter prompt
common_setup(screen, 'split', default_text)
feed(':2,1s/tw/MO/g')
diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua
index 12f3640b54..2d26d2c5e0 100644
--- a/test/functional/ui/inccommand_user_spec.lua
+++ b/test/functional/ui/inccommand_user_spec.lua
@@ -239,7 +239,6 @@ describe("'inccommand' for user commands", function()
before_each(function()
clear()
screen = Screen.new(40, 17)
- screen:attach()
exec_lua(setup_replace_cmd)
command('set cmdwinheight=5')
insert [[
@@ -508,6 +507,39 @@ describe("'inccommand' for user commands", function()
feed(':Test')
eq('nosplit', api.nvim_get_option_value('inccommand', {}))
end)
+
+ it('does not flush intermediate cursor position at end of message grid', function()
+ exec_lua([[
+ vim.api.nvim_create_user_command('Test', function() end, {
+ nargs = '*',
+ preview = function(_, _, _)
+ vim.api.nvim_buf_set_text(0, 0, 0, 1, -1, { "Preview" })
+ vim.cmd.sleep("1m")
+ return 1
+ end
+ })
+ ]])
+ local cursor_goto = screen._handle_grid_cursor_goto
+ screen._handle_grid_cursor_goto = function(...)
+ cursor_goto(...)
+ assert(screen._cursor.col < 12)
+ end
+ feed(':Test baz<Left><Left>arb')
+ screen:expect({
+ grid = [[
+ Preview |
+ oh no, even more text |
+ will the text ever stop |
+ oh well |
+ did the text stop |
+ why won't it stop |
+ make the text stop |
+ |
+ {1:~ }|*8
+ :Test barb^az |
+ ]],
+ })
+ end)
end)
describe("'inccommand' with multiple buffers", function()
@@ -516,7 +548,6 @@ describe("'inccommand' with multiple buffers", function()
before_each(function()
clear()
screen = Screen.new(40, 17)
- screen:attach()
exec_lua(setup_replace_cmd)
command('set cmdwinheight=10')
insert [[
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index f377939458..90e0b3e380 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -282,7 +282,6 @@ end)
it('typing a simplifiable key at hit-enter prompt triggers mapping vim-patch:8.2.0839', function()
local screen = Screen.new(60, 8)
- screen:attach()
command([[nnoremap <C-6> <Cmd>echo 'hit ctrl-6'<CR>]])
feed_command('ls')
screen:expect([[
@@ -328,7 +327,6 @@ describe('input non-printable chars', function()
it("doesn't crash when echoing them back", function()
write_file('Xtest-overwrite', [[foobar]])
local screen = Screen.new(60, 8)
- screen:attach()
command('set shortmess-=F')
feed_command('e Xtest-overwrite')
@@ -428,7 +426,6 @@ describe('display is updated', function()
local screen
before_each(function()
screen = Screen.new(60, 8)
- screen:attach()
end)
it('in Insert mode after <Nop> mapping #17911', function()
diff --git a/test/functional/ui/linematch_spec.lua b/test/functional/ui/linematch_spec.lua
index 03eed5a49c..b564c01eaa 100644
--- a/test/functional/ui/linematch_spec.lua
+++ b/test/functional/ui/linematch_spec.lua
@@ -38,7 +38,6 @@ describe('Diff mode screen with 3 diffs open', function()
feed(':windo diffthis<cr>')
screen = Screen.new(100, 16)
- screen:attach()
feed('<c-w>=')
feed(':windo set nu!<cr>')
end)
@@ -217,7 +216,6 @@ describe('Diff mode screen with 2 diffs open', function()
feed(':windo diffthis<cr>')
screen = Screen.new(100, 20)
- screen:attach()
feed('<c-w>=')
feed(':windo set nu!<cr>')
end)
@@ -1093,7 +1091,6 @@ describe('regressions', function()
clear()
feed(':set diffopt+=linematch:30<cr>')
screen = Screen.new(100, 20)
- screen:attach()
-- line must be greater than MATCH_CHAR_MAX_LEN
n.api.nvim_buf_set_lines(0, 0, -1, false, { string.rep('a', 1000) .. 'hello' })
n.exec 'vnew'
@@ -1105,7 +1102,6 @@ describe('regressions', function()
clear()
feed(':set diffopt+=linematch:10<cr>')
screen = Screen.new(100, 20)
- screen:attach()
local lines = {}
for i = 0, 29 do
lines[#lines + 1] = tostring(i)
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index a3e5068e55..734877d262 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -30,8 +30,7 @@ describe('ui/ext_messages', function()
before_each(function()
clear()
- screen = Screen.new(25, 5)
- screen:attach({ rgb = true, ext_messages = true, ext_popupmenu = true })
+ screen = Screen.new(25, 5, { rgb = true, ext_messages = true, ext_popupmenu = true })
screen:add_extra_attr_ids {
[100] = { undercurl = true, special = Screen.colors.Red },
}
@@ -50,7 +49,7 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { '\ntest\n[O]k: ', 6 } },
+ content = { { '\ntest\n[O]k: ', 6, 11 } },
kind = 'confirm',
},
},
@@ -78,7 +77,7 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { '\ntest\n[O]k: ', 6 } },
+ content = { { '\ntest\n[O]k: ', 6, 11 } },
kind = 'confirm',
},
},
@@ -92,7 +91,7 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { '\ntest\n[O]k: ', 6 } },
+ content = { { '\ntest\n[O]k: ', 6, 11 } },
kind = 'confirm',
},
{
@@ -100,7 +99,7 @@ describe('ui/ext_messages', function()
kind = 'echo',
},
{
- content = { { 'Press ENTER or type command to continue', 6 } },
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
kind = 'return_prompt',
},
},
@@ -117,7 +116,7 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { 'replace with X (y/n/a/q/l/^E/^Y)?', 6 } },
+ content = { { 'replace with X (y/n/a/q/l/^E/^Y)?', 6, 19 } },
kind = 'confirm_sub',
},
},
@@ -136,7 +135,7 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { 'W10: Warning: Changing a readonly file', 19 } },
+ content = { { 'W10: Warning: Changing a readonly file', 19, 27 } },
kind = 'wmsg',
},
},
@@ -152,7 +151,7 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { 'search hit BOTTOM, continuing at TOP', 19 } },
+ content = { { 'search hit BOTTOM, continuing at TOP', 19, 27 } },
kind = 'wmsg',
},
},
@@ -168,15 +167,15 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { 'Error detected while processing :', 9 } },
+ content = { { 'Error detected while processing :', 9, 7 } },
kind = 'emsg',
},
{
- content = { { 'E605: Exception not caught: foo', 9 } },
+ content = { { 'E605: Exception not caught: foo', 9, 7 } },
kind = '',
},
{
- content = { { 'Press ENTER or type command to continue', 6 } },
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
kind = 'return_prompt',
},
},
@@ -209,7 +208,7 @@ describe('ui/ext_messages', function()
{1:~ }|*4
]],
messages = { {
- content = { { 'raa', 9 } },
+ content = { { 'raa', 9, 7 } },
kind = 'echoerr',
} },
}
@@ -236,15 +235,15 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { 'bork', 9 } },
+ content = { { 'bork', 9, 7 } },
kind = 'echoerr',
},
{
- content = { { 'fail', 9 } },
+ content = { { 'fail', 9, 7 } },
kind = 'echoerr',
},
{
- content = { { 'Press ENTER or type command to continue', 6 } },
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
kind = 'return_prompt',
},
},
@@ -258,19 +257,19 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { 'bork', 9 } },
+ content = { { 'bork', 9, 7 } },
kind = 'echoerr',
},
{
- content = { { 'fail', 9 } },
+ content = { { 'fail', 9, 7 } },
kind = 'echoerr',
},
{
- content = { { 'extrafail', 9 } },
+ content = { { 'extrafail', 9, 7 } },
kind = 'echoerr',
},
{
- content = { { 'Press ENTER or type command to continue', 6 } },
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
kind = 'return_prompt',
},
},
@@ -292,7 +291,7 @@ describe('ui/ext_messages', function()
{1:~ }|*4
]],
messages = { {
- content = { { 'problem', 9 } },
+ content = { { 'problem', 9, 7 } },
kind = 'echoerr',
} },
cmdline = {
@@ -320,15 +319,15 @@ describe('ui/ext_messages', function()
{1:~ }|*4
]],
msg_history = {
- { kind = 'echoerr', content = { { 'raa', 9 } } },
- { kind = 'echoerr', content = { { 'bork', 9 } } },
- { kind = 'echoerr', content = { { 'fail', 9 } } },
- { kind = 'echoerr', content = { { 'extrafail', 9 } } },
- { kind = 'echoerr', content = { { 'problem', 9 } } },
+ { kind = 'echoerr', content = { { 'raa', 9, 7 } } },
+ { kind = 'echoerr', content = { { 'bork', 9, 7 } } },
+ { kind = 'echoerr', content = { { 'fail', 9, 7 } } },
+ { kind = 'echoerr', content = { { 'extrafail', 9, 7 } } },
+ { kind = 'echoerr', content = { { 'problem', 9, 7 } } },
},
messages = {
{
- content = { { 'Press ENTER or type command to continue', 6 } },
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
kind = 'return_prompt',
},
},
@@ -351,10 +350,12 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- messages = { {
- content = { { 'bork\nfail', 9 } },
- kind = 'echoerr',
- } },
+ messages = {
+ {
+ content = { { 'bork\nfail', 9, 7 } },
+ kind = 'echoerr',
+ },
+ },
}
feed(':messages<cr>')
@@ -365,13 +366,13 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { 'Press ENTER or type command to continue', 6 } },
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
kind = 'return_prompt',
},
},
msg_history = {
{
- content = { { 'bork\nfail', 9 } },
+ content = { { 'bork\nfail', 9, 7 } },
kind = 'echoerr',
},
},
@@ -418,15 +419,15 @@ describe('ui/ext_messages', function()
{
content = {
{ '\nErrorMsg ' },
- { 'xxx', 9 },
+ { 'xxx', 9, 7 },
{ ' ' },
- { 'ctermfg=', 18 },
+ { 'ctermfg=', 18, 6 },
{ '15 ' },
- { 'ctermbg=', 18 },
+ { 'ctermbg=', 18, 6 },
{ '1 ' },
- { 'guifg=', 18 },
+ { 'guifg=', 18, 6 },
{ 'White ' },
- { 'guibg=', 18 },
+ { 'guibg=', 18, 6 },
{ 'Red' },
},
kind = '',
@@ -446,7 +447,10 @@ describe('ui/ext_messages', function()
messages = {
{ content = { { 'x #1' } }, kind = '' },
{ content = { { 'y #2' } }, kind = '' },
- { content = { { 'Press ENTER or type command to continue', 6 } }, kind = 'return_prompt' },
+ {
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
+ kind = 'return_prompt',
+ },
},
}
end)
@@ -459,7 +463,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- showmode = { { '-- INSERT --', 5 } },
+ showmode = { { '-- INSERT --', 5, 12 } },
}
feed('alphpabet<cr>alphanum<cr>')
@@ -470,7 +474,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*2
]],
- showmode = { { '-- INSERT --', 5 } },
+ showmode = { { '-- INSERT --', 5, 12 } },
}
feed('<c-x>')
@@ -481,7 +485,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*2
]],
- showmode = { { '-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)', 5 } },
+ showmode = { { '-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)', 5, 12 } },
}
feed('<c-p>')
@@ -497,7 +501,7 @@ describe('ui/ext_messages', function()
items = { { 'alphpabet', '', '', '' }, { 'alphanum', '', '', '' } },
pos = 1,
},
- showmode = { { '-- Keyword Local completion (^N^P) ', 5 }, { 'match 1 of 2', 6 } },
+ showmode = { { '-- Keyword Local completion (^N^P) ', 5, 12 }, { 'match 1 of 2', 6, 19 } },
}
-- echomsg and showmode don't overwrite each other, this is the same
@@ -519,7 +523,7 @@ describe('ui/ext_messages', function()
content = { { 'stuff' } },
kind = 'echomsg',
} },
- showmode = { { '-- Keyword Local completion (^N^P) ', 5 }, { 'match 1 of 2', 6 } },
+ showmode = { { '-- Keyword Local completion (^N^P) ', 5, 12 }, { 'match 1 of 2', 6, 19 } },
}
feed('<c-p>')
@@ -539,7 +543,7 @@ describe('ui/ext_messages', function()
content = { { 'stuff' } },
kind = 'echomsg',
} },
- showmode = { { '-- Keyword Local completion (^N^P) ', 5 }, { 'match 2 of 2', 6 } },
+ showmode = { { '-- Keyword Local completion (^N^P) ', 5, 12 }, { 'match 2 of 2', 6, 19 } },
}
feed('<esc>:messages<cr>')
@@ -556,7 +560,7 @@ describe('ui/ext_messages', function()
} },
messages = {
{
- content = { { 'Press ENTER or type command to continue', 6 } },
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
kind = 'return_prompt',
},
},
@@ -570,7 +574,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- showmode = { { 'recording @q', 5 } },
+ showmode = { { 'recording @q', 5, 12 } },
}
feed('i')
@@ -579,7 +583,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- showmode = { { '-- INSERT --recording @q', 5 } },
+ showmode = { { '-- INSERT --recording @q', 5, 12 } },
}
feed('<esc>')
@@ -588,7 +592,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- showmode = { { 'recording @q', 5 } },
+ showmode = { { 'recording @q', 5, 12 } },
}
feed('q')
@@ -607,7 +611,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- showmode = { { 'recording @q', 5 } },
+ showmode = { { 'recording @q', 5, 12 } },
mode = 'normal',
}
@@ -617,7 +621,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- showmode = { { 'recording @q', 5 } },
+ showmode = { { 'recording @q', 5, 12 } },
mode = 'insert',
}
@@ -627,7 +631,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- showmode = { { 'recording @q', 5 } },
+ showmode = { { 'recording @q', 5, 12 } },
mode = 'normal',
}
@@ -643,20 +647,22 @@ describe('ui/ext_messages', function()
it('supports &showcmd and &ruler', function()
command('set showcmd ruler')
- screen:expect {
+ command('hi link MsgArea ErrorMsg')
+ screen:expect({
grid = [[
- ^ |
- {1:~ }|*4
- ]],
- ruler = { { '0,0-1 All' } },
- }
+ ^ |
+ {1:~ }|*4
+ ]],
+ ruler = { { '0,0-1 All', 9, 62 } },
+ })
+ command('hi clear MsgArea')
feed('i')
screen:expect {
grid = [[
^ |
{1:~ }|*4
]],
- showmode = { { '-- INSERT --', 5 } },
+ showmode = { { '-- INSERT --', 5, 12 } },
ruler = { { '0,1 All' } },
}
feed('abcde<cr>12345<esc>')
@@ -694,7 +700,7 @@ describe('ui/ext_messages', function()
{17:123}45 |
{1:~ }|*3
]],
- showmode = { { '-- VISUAL BLOCK --', 5 } },
+ showmode = { { '-- VISUAL BLOCK --', 5, 12 } },
showcmd = { { '2x3' } },
ruler = { { '1,3 All' } },
})
@@ -775,7 +781,7 @@ describe('ui/ext_messages', function()
{1:~ }|*4
]],
messages = { {
- content = { { 'bork', 9 } },
+ content = { { 'bork', 9, 7 } },
kind = 'echoerr',
} },
}
@@ -800,7 +806,7 @@ describe('ui/ext_messages', function()
]],
messages = {
{
- content = { { 'E117: Unknown function: nosuchfunction', 9 } },
+ content = { { 'E117: Unknown function: nosuchfunction', 9, 7 } },
kind = 'emsg',
},
},
@@ -815,12 +821,12 @@ describe('ui/ext_messages', function()
msg_history = {
{ kind = 'echomsg', content = { { 'howdy' } } },
{ kind = '', content = { { 'Type :qa and press <Enter> to exit Nvim' } } },
- { kind = 'echoerr', content = { { 'bork', 9 } } },
- { kind = 'emsg', content = { { 'E117: Unknown function: nosuchfunction', 9 } } },
+ { kind = 'echoerr', content = { { 'bork', 9, 7 } } },
+ { kind = 'emsg', content = { { 'E117: Unknown function: nosuchfunction', 9, 7 } } },
},
messages = {
{
- content = { { 'Press ENTER or type command to continue', 6 } },
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
kind = 'return_prompt',
},
},
@@ -893,6 +899,7 @@ stack traceback:
[C]: in function 'error'
[string ":lua"]:1: in main chunk]],
9,
+ 7,
},
},
kind = 'lua_error',
@@ -912,7 +919,7 @@ stack traceback:
messages = {
{
content = {
- { "Error invoking 'test_method' on channel 1:\ncomplete\nerror\n\nmessage", 9 },
+ { "Error invoking 'test_method' on channel 1:\ncomplete\nerror\n\nmessage", 9, 7 },
},
kind = 'rpc_error',
},
@@ -937,7 +944,7 @@ stack traceback:
{
content = {
{ '\nn Q @@\nn Y y$\nn j ' },
- { '*', 18 },
+ { '*', 18, 1 },
{ ' k' },
},
kind = '',
@@ -1035,7 +1042,10 @@ stack traceback:
{1:~ }|*4
]],
messages = {
- { content = { { 'wow, ', 10 }, { 'such\n\nvery ', 9 }, { 'color', 8 } }, kind = 'echomsg' },
+ {
+ content = { { 'wow, ', 10, 9 }, { 'such\n\nvery ', 9, 7 }, { 'color', 8, 13 } },
+ kind = 'echomsg',
+ },
},
}
@@ -1057,10 +1067,16 @@ stack traceback:
{1:~ }|*4
]],
messages = {
- { content = { { 'Press ENTER or type command to continue', 6 } }, kind = 'return_prompt' },
+ {
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
+ kind = 'return_prompt',
+ },
},
msg_history = {
- { content = { { 'wow, ', 10 }, { 'such\n\nvery ', 9 }, { 'color', 8 } }, kind = 'echomsg' },
+ {
+ content = { { 'wow, ', 10, 9 }, { 'such\n\nvery ', 9, 7 }, { 'color', 8, 13 } },
+ kind = 'echomsg',
+ },
},
}
@@ -1097,14 +1113,40 @@ stack traceback:
})
eq(showmode, 1)
end)
+
+ it('emits single message for multiline print())', function()
+ exec_lua([[print("foo\nbar\nbaz")]])
+ screen:expect({
+ messages = {
+ {
+ content = { { 'foo\nbar\nbaz' } },
+ kind = 'lua_print',
+ },
+ },
+ })
+ exec_lua([[print(vim.inspect({ foo = "bar" }))]])
+ screen:expect({
+ grid = [[
+ ^ |
+ {1:~ }|*4
+ ]],
+ messages = {
+ {
+ content = { { '{\n foo = "bar"\n}' } },
+ kind = 'lua_print',
+ },
+ },
+ })
+ exec_lua([[vim.print({ foo = "bar" })]])
+ screen:expect_unchanged()
+ end)
end)
describe('ui/builtin messages', function()
local screen
before_each(function()
clear()
- screen = Screen.new(60, 7)
- screen:attach({ rgb = true, ext_popupmenu = true })
+ screen = Screen.new(60, 7, { rgb = true, ext_popupmenu = true })
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.LightRed },
[101] = { background = Screen.colors.Grey20 },
@@ -1652,8 +1694,7 @@ describe('ui/ext_messages', function()
before_each(function()
clear { args_rm = { '--headless' }, args = { '--cmd', 'set shortmess-=I' } }
- screen = Screen.new(80, 24)
- screen:attach({ rgb = true, ext_messages = true, ext_popupmenu = true })
+ screen = Screen.new(80, 24, { rgb = true, ext_messages = true, ext_popupmenu = true })
end)
it('supports intro screen', function()
@@ -1678,7 +1719,7 @@ describe('ui/ext_messages', function()
{1:~ }type :help iccf{18:<Enter>} for information {1: }|
{1:~ }|*5
]]
- local showmode = { { '-- INSERT --', 5 } }
+ local showmode = { { '-- INSERT --', 5, 12 } }
screen:expect(introscreen)
-- <c-l> (same as :mode) does _not_ clear intro message
@@ -1752,7 +1793,10 @@ describe('ui/ext_messages', function()
|*5
]],
messages = {
- { content = { { 'Press ENTER or type command to continue', 6 } }, kind = 'return_prompt' },
+ {
+ content = { { 'Press ENTER or type command to continue', 6, 19 } },
+ kind = 'return_prompt',
+ },
},
}
@@ -1875,8 +1919,7 @@ end)
it('ui/ext_multigrid supports intro screen', function()
clear { args_rm = { '--headless' }, args = { '--cmd', 'set shortmess-=I' } }
- local screen = Screen.new(80, 24)
- screen:attach({ rgb = true, ext_multigrid = true })
+ local screen = Screen.new(80, 24, { rgb = true, ext_multigrid = true })
screen:expect {
grid = [[
@@ -1951,7 +1994,6 @@ describe('ui/msg_puts_printf', function()
clear({ env = { LANG = 'ja_JP.UTF-8' } })
screen = Screen.new(25, 5)
- screen:attach()
if is_os('win') then
if os.execute('chcp 932 > NUL 2>&1') ~= 0 then
@@ -1992,7 +2034,6 @@ describe('pager', function()
before_each(function()
clear()
screen = Screen.new(35, 8)
- screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue1 },
[2] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
@@ -2048,8 +2089,6 @@ aliquip ex ea commodo consequat.]]
end)
it('can be quit with Lua #11224 #16537', function()
- -- NOTE: adds "4" to message history, although not displayed initially
- -- (triggered the more prompt).
screen:try_resize(40, 5)
feed(':lua for i=0,10 do print(i) end<cr>')
screen:expect {
@@ -2079,13 +2118,13 @@ aliquip ex ea commodo consequat.]]
{4:-- More --}^ |
]],
}
- feed('j')
+ feed('G')
screen:expect {
grid = [[
- 1 |
- 2 |
- 3 |
- 4 |
+ 7 |
+ 8 |
+ 9 |
+ 10 |
{4:Press ENTER or type command to continue}^ |
]],
}
@@ -2788,8 +2827,7 @@ it('pager works in headless mode with UI attached', function()
end)
local child_session = n.connect(child_server)
- local child_screen = Screen.new(40, 6)
- child_screen:attach(nil, child_session)
+ local child_screen = Screen.new(40, 6, nil, child_session)
child_screen._default_attr_ids = nil -- TODO: unskip with new color scheme
child_session:notify('nvim_command', [[echo range(100)->join("\n")]])
diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua
index f623cfda06..8c6a284cd6 100644
--- a/test/functional/ui/mode_spec.lua
+++ b/test/functional/ui/mode_spec.lua
@@ -11,8 +11,7 @@ describe('ui mode_change event', function()
before_each(function()
clear()
- screen = Screen.new(25, 4)
- screen:attach({ rgb = true })
+ screen = Screen.new(25, 4, { rgb = true })
end)
it('works in normal mode', function()
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index bc18680749..3ee4d429c7 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -21,30 +21,20 @@ describe('ui/mouse/input', function()
command('set listchars=eol:$')
command('setl listchars=nbsp:x')
screen = Screen.new(25, 5)
- screen:attach()
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- [1] = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black },
- [2] = { bold = true },
- [3] = {
- foreground = Screen.colors.Blue,
- background = Screen.colors.LightGrey,
+ screen:add_extra_attr_ids {
+ [100] = {
bold = true,
+ background = Screen.colors.LightGrey,
+ foreground = Screen.colors.Blue1,
},
- [4] = { reverse = true },
- [5] = { bold = true, reverse = true },
- [6] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [7] = { bold = true, foreground = Screen.colors.SeaGreen4 },
- [8] = { foreground = Screen.colors.Brown },
- [9] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey },
- })
+ }
command('set mousemodel=extend')
feed('itesting<cr>mouse<cr>support and selection<esc>')
screen:expect([[
testing |
mouse |
support and selectio^n |
- {0:~ }|
+ {1:~ }|
|
]])
end)
@@ -56,7 +46,7 @@ describe('ui/mouse/input', function()
testing |
mo^use |
support and selection |
- {0:~ }|
+ {1:~ }|
|
]],
mouse_enabled = true,
@@ -66,7 +56,7 @@ describe('ui/mouse/input', function()
^testing |
mouse |
support and selection |
- {0:~ }|
+ {1:~ }|
|
]])
end)
@@ -79,7 +69,7 @@ describe('ui/mouse/input', function()
testing |
mo^use |
support and selection |
- {0:~ }|
+ {1:~ }|
|
]],
mouse_enabled = false,
@@ -89,7 +79,7 @@ describe('ui/mouse/input', function()
^testing |
mouse |
support and selection |
- {0:~ }|
+ {1:~ }|
|
]])
end)
@@ -100,11 +90,11 @@ describe('ui/mouse/input', function()
feed('<LeftMouse><0,0>')
feed('<LeftRelease><0,0>')
screen:expect([[
- {1:testin}^g |
+ {17:testin}^g |
mouse |
support and selection |
- {0:~ }|
- {2:-- VISUAL --} |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
end)
@@ -116,11 +106,11 @@ describe('ui/mouse/input', function()
feed('<LeftMouse><0,0>')
feed('<LeftRelease><0,0>')
screen:expect([[
- ^t{1:esting} |
+ ^t{17:esting} |
mouse |
support and selection |
- {0:~ }|
- {2:-- VISUAL LINE --} |
+ {1:~ }|
+ {5:-- VISUAL LINE --} |
]])
end)
@@ -137,44 +127,35 @@ describe('ui/mouse/input', function()
^testing |
mouse |
support and selection |
- {0:~ }|
- {2:-- VISUAL BLOCK --} |
+ {1:~ }|
+ {5:-- VISUAL BLOCK --} |
]])
end)
describe('tab drag', function()
- before_each(function()
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- tab = { background = Screen.colors.LightGrey, underline = true },
- sel = { bold = true },
- fill = { reverse = true },
- })
- end)
-
it('in tabline on filler space moves tab to the end', function()
feed_command('%delete')
insert('this is foo')
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><4,0>')
screen:expect([[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<LeftDrag><14,0>')
screen:expect([[
- {tab: + bar }{sel: + foo }{fill: }{tab:X}|
+ {24: + bar }{5: + foo }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end)
@@ -185,9 +166,9 @@ describe('ui/mouse/input', function()
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><11,0>')
@@ -196,18 +177,18 @@ describe('ui/mouse/input', function()
poke_eventloop()
screen:expect {
grid = [[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]],
unchanged = true,
}
feed('<LeftDrag><6,0>')
screen:expect([[
- {sel: + bar }{tab: + foo }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {5: + bar }{24: + foo }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
end)
@@ -218,23 +199,23 @@ describe('ui/mouse/input', function()
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><4,0>')
screen:expect([[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<LeftDrag><7,0>')
screen:expect([[
- {tab: + bar }{sel: + foo }{fill: }{tab:X}|
+ {24: + bar }{5: + foo }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end)
@@ -245,33 +226,33 @@ describe('ui/mouse/input', function()
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><4,0>')
screen:expect([[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<LeftDrag><4,1>')
screen:expect {
grid = [[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]],
unchanged = true,
}
feed('<LeftDrag><14,1>')
screen:expect([[
- {tab: + bar }{sel: + foo }{fill: }{tab:X}|
+ {24: + bar }{5: + foo }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end)
@@ -282,9 +263,9 @@ describe('ui/mouse/input', function()
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><11,0>')
@@ -293,9 +274,9 @@ describe('ui/mouse/input', function()
poke_eventloop()
screen:expect {
grid = [[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]],
unchanged = true,
@@ -303,18 +284,18 @@ describe('ui/mouse/input', function()
feed('<LeftDrag><11,1>')
screen:expect {
grid = [[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]],
unchanged = true,
}
feed('<LeftDrag><6,1>')
screen:expect([[
- {sel: + bar }{tab: + foo }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {5: + bar }{24: + foo }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
end)
@@ -325,73 +306,64 @@ describe('ui/mouse/input', function()
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><4,0>')
screen:expect([[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<LeftDrag><4,1>')
screen:expect {
grid = [[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]],
unchanged = true,
}
feed('<LeftDrag><7,1>')
screen:expect([[
- {tab: + bar }{sel: + foo }{fill: }{tab:X}|
+ {24: + bar }{5: + foo }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end)
end)
describe('tabline', function()
- before_each(function()
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- tab = { background = Screen.colors.LightGrey, underline = true },
- sel = { bold = true },
- fill = { reverse = true },
- })
- end)
-
it('left click in default tabline (tabpage label) switches to tab', function()
feed_command('%delete')
insert('this is foo')
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><4,0>')
screen:expect([[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<LeftMouse><6,0>')
screen:expect_unchanged()
feed('<LeftMouse><10,0>')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><12,0>')
@@ -404,23 +376,23 @@ describe('ui/mouse/input', function()
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><20,0>')
screen:expect([[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<LeftMouse><22,0>')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
end)
@@ -432,15 +404,15 @@ describe('ui/mouse/input', function()
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<LeftMouse><24,0>')
screen:expect([[
this is fo^o |
- {0:~ }|*3
+ {1:~ }|*3
|
]])
end)
@@ -451,44 +423,44 @@ describe('ui/mouse/input', function()
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<2-LeftMouse><4,0>')
screen:expect([[
- {sel: Name] }{tab: + foo + bar }{fill: }{tab:X}|
- {0:^$} |
- {0:~ }|*2
+ {5: Name] }{24: + foo + bar }{2: }{24:X}|
+ {1:^$} |
+ {1:~ }|*2
|
]])
command('tabclose')
screen:expect([[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
this is fo^o |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<2-LeftMouse><20,0>')
screen:expect([[
- {tab: + foo + bar }{sel: Name] }{fill: }{tab:X}|
- {0:^$} |
- {0:~ }|*2
+ {24: + foo + bar }{5: Name] }{2: }{24:X}|
+ {1:^$} |
+ {1:~ }|*2
|
]])
command('tabclose')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- this is ba^r{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ this is ba^r{1:$} |
+ {1:~ }|*2
|
]])
feed('<2-LeftMouse><10,0>')
screen:expect([[
- {tab: + foo }{sel: Name] }{tab: + bar }{fill: }{tab:X}|
- {0:^$} |
- {0:~ }|*2
+ {24: + foo }{5: Name] }{24: + bar }{2: }{24:X}|
+ {1:^$} |
+ {1:~ }|*2
|
]])
end)
@@ -509,7 +481,7 @@ describe('ui/mouse/input', function()
api.nvim_set_option_value('tabline', '%@Test@test%X-%5@Test2@test2', {})
api.nvim_set_option_value('showtabline', 2, {})
screen:expect([[
- {fill:test-test2 }|
+ {2:test-test2 }|
testing |
mouse |
support and selectio^n |
@@ -594,48 +566,41 @@ describe('ui/mouse/input', function()
testing |
mo^use |
support and selection |
- {0:~ }|
+ {1:~ }|
|
]])
feed('<LeftDrag><4,1>')
screen:expect([[
testing |
- mo{1:us}^e |
+ mo{17:us}^e |
support and selection |
- {0:~ }|
- {2:-- VISUAL --} |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
feed('<LeftDrag><2,2>')
screen:expect([[
testing |
- mo{1:use} |
- {1:su}^pport and selection |
- {0:~ }|
- {2:-- VISUAL --} |
+ mo{17:use} |
+ {17:su}^pport and selection |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
feed('<LeftDrag><0,0>')
screen:expect([[
- ^t{1:esting} |
- {1:mou}se |
+ ^t{17:esting} |
+ {17:mou}se |
support and selection |
- {0:~ }|
- {2:-- VISUAL --} |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
end)
it('left drag changes visual selection after tab click', function()
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- tab = { background = Screen.colors.LightGrey, underline = true },
- sel = { bold = true },
- fill = { reverse = true },
- vis = { background = Screen.colors.LightGrey, foreground = Screen.colors.Black },
- })
feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
feed_command('tabprevious') -- go to first tab
screen:expect([[
- {sel: + foo }{tab: + bar }{fill: }{tab:X}|
+ {5: + foo }{24: + bar }{2: }{24:X}|
testing |
mouse |
support and selectio^n |
@@ -645,17 +610,17 @@ describe('ui/mouse/input', function()
n.poke_eventloop()
feed('<LeftMouse><0,1>')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- ^this is bar{0:$} |
- {0:~ }|*2
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ ^this is bar{1:$} |
+ {1:~ }|*2
:tabprevious |
]])
feed('<LeftDrag><4,1>')
screen:expect([[
- {tab: + foo }{sel: + bar }{fill: }{tab:X}|
- {vis:this}^ is bar{0:$} |
- {0:~ }|*2
- {sel:-- VISUAL --} |
+ {24: + foo }{5: + bar }{2: }{24:X}|
+ {17:this}^ is bar{1:$} |
+ {1:~ }|*2
+ {5:-- VISUAL --} |
]])
end)
@@ -673,12 +638,12 @@ describe('ui/mouse/input', function()
testing │testing |
mouse │mouse |
support and selection │support and selection |
- {0:~ }│{0:~ }|*2
- {0:~ }│{4:[No Name] [+] }|
- {0:~ }│foo{0:$} |
- {0:~ }│ba^r{0:$} |
- {0:~ }│{0:~ }|*4
- {4:[No Name] [+] }{5:[No Name] [+] }|
+ {1:~ }│{1:~ }|*2
+ {1:~ }│{2:[No Name] [+] }|
+ {1:~ }│foo{1:$} |
+ {1:~ }│ba^r{1:$} |
+ {1:~ }│{1:~ }|*4
+ {2:[No Name] [+] }{3:[No Name] [+] }|
|
]],
}
@@ -689,12 +654,12 @@ describe('ui/mouse/input', function()
testing │testing |
mouse │mouse |
support and selection │support and selection |
- {0:~ }│{0:~ }|*2
- {0:~ }│{4:[No Name] [+] }|
- {0:~ }│^foo{0:$} |
- {0:~ }│bar{0:$} |
- {0:~ }│{0:~ }|*4
- {4:[No Name] [+] }{5:[No Name] [+] }|
+ {1:~ }│{1:~ }|*2
+ {1:~ }│{2:[No Name] [+] }|
+ {1:~ }│^foo{1:$} |
+ {1:~ }│bar{1:$} |
+ {1:~ }│{1:~ }|*4
+ {2:[No Name] [+] }{3:[No Name] [+] }|
|
]],
}
@@ -705,13 +670,13 @@ describe('ui/mouse/input', function()
testing │testing |
mouse │mouse |
support and selection │support and selection |
- {0:~ }│{0:~ }|*2
- {0:~ }│{4:[No Name] [+] }|
- {0:~ }│{1:foo}{3:$} |
- {0:~ }│{1:bar}{0:^$} |
- {0:~ }│{0:~ }|*4
- {4:[No Name] [+] }{5:[No Name] [+] }|
- {2:-- VISUAL --} |
+ {1:~ }│{1:~ }|*2
+ {1:~ }│{2:[No Name] [+] }|
+ {1:~ }│{17:foo}{100:$} |
+ {1:~ }│{17:bar}{1:^$} |
+ {1:~ }│{1:~ }|*4
+ {2:[No Name] [+] }{3:[No Name] [+] }|
+ {5:-- VISUAL --} |
]],
}
end)
@@ -723,33 +688,33 @@ describe('ui/mouse/input', function()
screen:expect([[
testing |
mouse |
- {1:suppor}^t and selection |
- {0:~ }|
- {2:-- VISUAL --} |
+ {17:suppor}^t and selection |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
feed('<LeftDrag><0,1>')
screen:expect([[
testing |
- ^m{1:ouse} |
- {1:support} and selection |
- {0:~ }|
- {2:-- VISUAL --} |
+ ^m{17:ouse} |
+ {17:support} and selection |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
feed('<LeftDrag><4,0>')
screen:expect([[
- ^t{1:esting} |
- {1:mouse} |
- {1:support} and selection |
- {0:~ }|
- {2:-- VISUAL --} |
+ ^t{17:esting} |
+ {17:mouse} |
+ {17:support} and selection |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
feed('<LeftDrag><14,2>')
screen:expect([[
testing |
mouse |
- {1:support and selectio}^n |
- {0:~ }|
- {2:-- VISUAL --} |
+ {17:support and selectio}^n |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
end)
@@ -762,33 +727,33 @@ describe('ui/mouse/input', function()
screen:expect([[
testing |
mouse |
- {1:su}^p{1:port and selection} |
- {0:~ }|
- {2:-- VISUAL LINE --} |
+ {17:su}^p{17:port and selection} |
+ {1:~ }|
+ {5:-- VISUAL LINE --} |
]])
feed('<LeftDrag><0,1>')
screen:expect([[
testing |
- ^m{1:ouse} |
- {1:support and selection} |
- {0:~ }|
- {2:-- VISUAL LINE --} |
+ ^m{17:ouse} |
+ {17:support and selection} |
+ {1:~ }|
+ {5:-- VISUAL LINE --} |
]])
feed('<LeftDrag><4,0>')
screen:expect([[
- {1:test}^i{1:ng} |
- {1:mouse} |
- {1:support and selection} |
- {0:~ }|
- {2:-- VISUAL LINE --} |
+ {17:test}^i{17:ng} |
+ {17:mouse} |
+ {17:support and selection} |
+ {1:~ }|
+ {5:-- VISUAL LINE --} |
]])
feed('<LeftDrag><14,2>')
screen:expect([[
testing |
mouse |
- {1:support and se}^l{1:ection} |
- {0:~ }|
- {2:-- VISUAL LINE --} |
+ {17:support and se}^l{17:ection} |
+ {1:~ }|
+ {5:-- VISUAL LINE --} |
]])
end)
@@ -804,32 +769,32 @@ describe('ui/mouse/input', function()
testing |
mouse |
su^pport and selection |
- {0:~ }|
- {2:-- VISUAL BLOCK --} |
+ {1:~ }|
+ {5:-- VISUAL BLOCK --} |
]])
feed('<LeftDrag><0,1>')
screen:expect([[
testing |
- ^m{1:ou}se |
- {1:sup}port and selection |
- {0:~ }|
- {2:-- VISUAL BLOCK --} |
+ ^m{17:ou}se |
+ {17:sup}port and selection |
+ {1:~ }|
+ {5:-- VISUAL BLOCK --} |
]])
feed('<LeftDrag><4,0>')
screen:expect([[
- te{1:st}^ing |
- mo{1:use} |
- su{1:ppo}rt and selection |
- {0:~ }|
- {2:-- VISUAL BLOCK --} |
+ te{17:st}^ing |
+ mo{17:use} |
+ su{17:ppo}rt and selection |
+ {1:~ }|
+ {5:-- VISUAL BLOCK --} |
]])
feed('<LeftDrag><14,2>')
screen:expect([[
testing |
mouse |
- su{1:pport and se}^lection |
- {0:~ }|
- {2:-- VISUAL BLOCK --} |
+ su{17:pport and se}^lection |
+ {1:~ }|
+ {5:-- VISUAL BLOCK --} |
]])
end)
@@ -839,16 +804,16 @@ describe('ui/mouse/input', function()
^testing |
mouse |
support and selection |
- {0:~ }|
+ {1:~ }|
|
]])
feed('<RightMouse><2,2>')
screen:expect([[
- {1:testing} |
- {1:mouse} |
- {1:su}^pport and selection |
- {0:~ }|
- {2:-- VISUAL --} |
+ {17:testing} |
+ {17:mouse} |
+ {17:su}^pport and selection |
+ {1:~ }|
+ {5:-- VISUAL --} |
]])
end)
@@ -856,11 +821,11 @@ describe('ui/mouse/input', function()
api.nvim_set_option_value('tags', './non-existent-tags-file', {})
feed('<C-LeftMouse><0,0>')
screen:expect([[
- {6:E433: No tags file} |
- {6:E426: Tag not found: test}|
- {6:ing} |
- {7:Press ENTER or type comma}|
- {7:nd to continue}^ |
+ {9:E433: No tags file} |
+ {9:E426: Tag not found: test}|
+ {9:ing} |
+ {6:Press ENTER or type comma}|
+ {6:nd to continue}^ |
]])
feed('<cr>')
end)
@@ -890,54 +855,54 @@ describe('ui/mouse/input', function()
local oldwin = api.nvim_get_current_win()
command('rightbelow vnew')
screen:expect([[
- testing │{0:^$} |
- mouse │{0:~ }|
- support and selection │{0:~ }|
- {4:[No Name] [+] }{5:[No Name] }|
+ testing │{1:^$} |
+ mouse │{1:~ }|
+ support and selection │{1:~ }|
+ {2:[No Name] [+] }{3:[No Name] }|
|
]])
api.nvim_input_mouse('left', 'press', '', 0, 0, 22)
poke_eventloop()
api.nvim_input_mouse('left', 'drag', '', 0, 1, 12)
screen:expect([[
- testing │{0:^$} |
- mouse │{0:~ }|
- support and │{0:~ }|
- {4:< Name] [+] }{5:[No Name] }|
+ testing │{1:^$} |
+ mouse │{1:~ }|
+ support and │{1:~ }|
+ {2:< Name] [+] }{3:[No Name] }|
|
]])
api.nvim_input_mouse('left', 'drag', '', 0, 2, 2)
screen:expect([[
- te│{0:^$} |
- mo│{0:~ }|
- su│{0:~ }|
- {4:< }{5:[No Name] }|
+ te│{1:^$} |
+ mo│{1:~ }|
+ su│{1:~ }|
+ {2:< }{3:[No Name] }|
|
]])
api.nvim_input_mouse('left', 'release', '', 0, 2, 2)
api.nvim_set_option_value('statuscolumn', 'foobar', { win = oldwin })
screen:expect([[
- {8:fo}│{0:^$} |
- {8:fo}│{0:~ }|*2
- {4:< }{5:[No Name] }|
+ {8:fo}│{1:^$} |
+ {8:fo}│{1:~ }|*2
+ {2:< }{3:[No Name] }|
|
]])
api.nvim_input_mouse('left', 'press', '', 0, 0, 2)
poke_eventloop()
api.nvim_input_mouse('left', 'drag', '', 0, 1, 12)
screen:expect([[
- {8:foobar}testin│{0:^$} |
- {8:foobar}mouse │{0:~ }|
- {8:foobar}suppor│{0:~ }|
- {4:< Name] [+] }{5:[No Name] }|
+ {8:foobar}testin│{1:^$} |
+ {8:foobar}mouse │{1:~ }|
+ {8:foobar}suppor│{1:~ }|
+ {2:< Name] [+] }{3:[No Name] }|
|
]])
api.nvim_input_mouse('left', 'drag', '', 0, 2, 22)
screen:expect([[
- {8:foobar}testing │{0:^$} |
- {8:foobar}mouse │{0:~ }|
- {8:foobar}support and sele│{0:~ }|
- {4:[No Name] [+] }{5:[No Name] }|
+ {8:foobar}testing │{1:^$} |
+ {8:foobar}mouse │{1:~ }|
+ {8:foobar}support and sele│{1:~ }|
+ {2:[No Name] [+] }{3:[No Name] }|
|
]])
api.nvim_input_mouse('left', 'release', '', 0, 2, 22)
@@ -964,14 +929,14 @@ describe('ui/mouse/input', function()
test │test |
^mouse scrolling │mouse scrolling |
│ |
- {0:~ }│{0:~ }|
- {5:[No Name] [+] }{4:[No Name] [+] }|
+ {1:~ }│{1:~ }|
+ {3:[No Name] [+] }{2:[No Name] [+] }|
to |
test |
mouse scrolling |
|
- {0:~ }|
- {4:[No Name] [+] }|
+ {1:~ }|
+ {2:[No Name] [+] }|
:vsp |
]])
if use_api then
@@ -982,17 +947,17 @@ describe('ui/mouse/input', function()
screen:expect([[
^mouse scrolling │lines |
│to |
- {0:~ }│test |
- {0:~ }│mouse scrolling |
- {0:~ }│ |
- {0:~ }│{0:~ }|
- {5:[No Name] [+] }{4:[No Name] [+] }|
+ {1:~ }│test |
+ {1:~ }│mouse scrolling |
+ {1:~ }│ |
+ {1:~ }│{1:~ }|
+ {3:[No Name] [+] }{2:[No Name] [+] }|
to |
test |
mouse scrolling |
|
- {0:~ }|
- {4:[No Name] [+] }|
+ {1:~ }|
+ {2:[No Name] [+] }|
:vsp |
]])
if use_api then
@@ -1003,17 +968,17 @@ describe('ui/mouse/input', function()
screen:expect([[
^mouse scrolling │text |
│with |
- {0:~ }│many |
- {0:~ }│lines |
- {0:~ }│to |
- {0:~ }│test |
- {5:[No Name] [+] }{4:[No Name] [+] }|
+ {1:~ }│many |
+ {1:~ }│lines |
+ {1:~ }│to |
+ {1:~ }│test |
+ {3:[No Name] [+] }{2:[No Name] [+] }|
to |
test |
mouse scrolling |
|
- {0:~ }|
- {4:[No Name] [+] }|
+ {1:~ }|
+ {2:[No Name] [+] }|
:vsp |
]])
if use_api then
@@ -1025,17 +990,17 @@ describe('ui/mouse/input', function()
screen:expect([[
^mouse scrolling │text |
│with |
- {0:~ }│many |
- {0:~ }│lines |
- {0:~ }│to |
- {0:~ }│test |
- {5:[No Name] [+] }{4:[No Name] [+] }|
+ {1:~ }│many |
+ {1:~ }│lines |
+ {1:~ }│to |
+ {1:~ }│test |
+ {3:[No Name] [+] }{2:[No Name] [+] }|
Inserting |
text |
with |
many |
lines |
- {4:[No Name] [+] }|
+ {2:[No Name] [+] }|
:vsp |
]])
end
@@ -1056,7 +1021,7 @@ describe('ui/mouse/input', function()
screen:expect([[
|*2
bbbbbbbbbbbbbbb^b |
- {0:~ }|
+ {1:~ }|
|
]])
@@ -1064,7 +1029,7 @@ describe('ui/mouse/input', function()
screen:expect([[
|*2
n bbbbbbbbbbbbbbbbbbb^b |
- {0:~ }|
+ {1:~ }|
|
]])
@@ -1073,7 +1038,7 @@ describe('ui/mouse/input', function()
g |
|
^t and selection bbbbbbbbb|
- {0:~ }|
+ {1:~ }|
|
]])
end)
@@ -1086,7 +1051,7 @@ describe('ui/mouse/input', function()
screen:expect([[
|*2
bbbbbbbbbbbbbbb^b |
- {0:~ }|
+ {1:~ }|
|
]])
@@ -1094,7 +1059,7 @@ describe('ui/mouse/input', function()
screen:expect([[
|*2
n bbbbbbbbbbbbbbbbbbb^b |
- {0:~ }|
+ {1:~ }|
|
]])
@@ -1104,7 +1069,7 @@ describe('ui/mouse/input', function()
g |
|
^t and selection bbbbbbbbb|
- {0:~ }|
+ {1:~ }|
|
]])
end)
@@ -1118,7 +1083,7 @@ describe('ui/mouse/input', function()
testing |
mouse |
^bbbbbbbbbbbbbbbbbbbb supp|
- {0:~ }|
+ {1:~ }|
|
]])
@@ -1127,7 +1092,7 @@ describe('ui/mouse/input', function()
g |
|
bbbb^bbbbbbbbbb support an|
- {0:~ }|
+ {1:~ }|
|
]])
@@ -1138,7 +1103,7 @@ describe('ui/mouse/input', function()
testing |
mouse |
^bbbbbbbbbbbbbbbbbbbb supp|
- {0:~ }|
+ {1:~ }|
|
]])
@@ -1147,7 +1112,7 @@ describe('ui/mouse/input', function()
g |
|
bb^bbbbbbbbbbbb support an|
- {0:~ }|
+ {1:~ }|
|
]])
end)
@@ -1158,71 +1123,71 @@ describe('ui/mouse/input', function()
feed('<esc><LeftMouse><0,0>')
screen:expect([[
- ^Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- {c:>} 私は猫が大好き{0:>---}{c: X } {0:>}|
+ ^Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ {14:>} 私は猫が大好き{1:>---}{14: X } {1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><1,0>')
screen:expect([[
- S^ection{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- {c:>} 私は猫が大好き{0:>---}{c: X } {0:>}|
+ S^ection{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ {14:>} 私は猫が大好き{1:>---}{14: X } {1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><21,0>')
screen:expect([[
- Section{0:>>--->--->---}{c: }^t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- {c:>} 私は猫が大好き{0:>---}{c: X } {0:>}|
+ Section{1:>>--->--->---}{14: }^t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ {14:>} 私は猫が大好き{1:>---}{14: X } {1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><21,1>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t^3{c: } {c: }|
- {c:>} 私は猫が大好き{0:>---}{c: X } {0:>}|
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t^3{14: } {14: }|
+ {14:>} 私は猫が大好き{1:>---}{14: X } {1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><0,2>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- {c:^>} 私は猫が大好き{0:>---}{c: X } {0:>}|
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ {14:^>} 私は猫が大好き{1:>---}{14: X } {1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><7,2>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- {c:>} 私は^猫が大好き{0:>---}{c: X } {0:>}|
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ {14:>} 私は^猫が大好き{1:>---}{14: X } {1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><21,2>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- {c:>} 私は猫が大好き{0:>---}{c: ^X } {0:>}|
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ {14:>} 私は猫が大好き{1:>---}{14: ^X } {1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end) -- level 1 - non wrapped
@@ -1232,51 +1197,51 @@ describe('ui/mouse/input', function()
feed('<esc><LeftMouse><24,1>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c:^ }|
- t4{c: } |
- {c:>} 私は猫が大好き{0:>---}{c: X} |
- {c: } ✨🐈✨ |
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14:^ }|
+ t4{14: } |
+ {14:>} 私は猫が大好き{1:>---}{14: X} |
+ {14: } ✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><0,2>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- ^t4{c: } |
- {c:>} 私は猫が大好き{0:>---}{c: X} |
- {c: } ✨🐈✨ |
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ ^t4{14: } |
+ {14:>} 私は猫が大好き{1:>---}{14: X} |
+ {14: } ✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><8,3>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- t4{c: } |
- {c:>} 私は猫^が大好き{0:>---}{c: X} |
- {c: } ✨🐈✨ |
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ t4{14: } |
+ {14:>} 私は猫^が大好き{1:>---}{14: X} |
+ {14: } ✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><21,3>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- t4{c: } |
- {c:>} 私は猫が大好き{0:>---}{c: ^X} |
- {c: } ✨🐈✨ |
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ t4{14: } |
+ {14:>} 私は猫が大好き{1:>---}{14: ^X} |
+ {14: } ✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><4,4>')
screen:expect([[
- Section{0:>>--->--->---}{c: }t1{c: } |
- {0:>--->--->---} {c: }t2{c: } {c: }t3{c: } {c: }|
- t4{c: } |
- {c:>} 私は猫が大好き{0:>---}{c: X} |
- {c: } ✨^🐈✨ |
+ Section{1:>>--->--->---}{14: }t1{14: } |
+ {1:>--->--->---} {14: }t2{14: } {14: }t3{14: } {14: }|
+ t4{14: } |
+ {14:>} 私は猫が大好き{1:>---}{14: X} |
+ {14: } ✨^🐈✨ |
|*2
]])
end) -- level 1 - wrapped
@@ -1286,61 +1251,61 @@ describe('ui/mouse/input', function()
feed('<esc><LeftMouse><20,0>')
screen:expect([[
- Section{0:>>--->--->---}^t1 |
- {0:>--->--->---} t2 t3 t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}^t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ {14:>} 私は猫が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><14,1>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} ^t2 t3 t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} ^t2 t3 t4 |
+ {14:>} 私は猫が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><18,1>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t^3 t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t^3 t4 |
+ {14:>} 私は猫が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><0,2>') -- Weirdness
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- {c:^>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ {14:^>} 私は猫が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><8,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- {c:>} 私は猫^が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ {14:>} 私は猫^が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><20,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- {c:>} 私は猫が大好き{0:>---}{c:^X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ {14:>} 私は猫が大好き{1:>---}{14:^X} ✨{1:>}|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end) -- level 2 - non wrapped
@@ -1350,62 +1315,62 @@ describe('ui/mouse/input', function()
feed('<esc>i<LeftMouse><20,0>')
screen:expect([[
- Section{0:>>--->--->---}^t1 |
- {0:>--->--->---} t2 t3 t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}^t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ {14:>} 私は猫が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
- {sm:-- INSERT --} |
+ {1:~ }|*2
+ {5:-- INSERT --} |
]])
feed('<LeftMouse><14,1>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} ^t2 t3 t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} ^t2 t3 t4 |
+ {14:>} 私は猫が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
- {sm:-- INSERT --} |
+ {1:~ }|*2
+ {5:-- INSERT --} |
]])
feed('<LeftMouse><18,1>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t^3 t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t^3 t4 |
+ {14:>} 私は猫が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
- {sm:-- INSERT --} |
+ {1:~ }|*2
+ {5:-- INSERT --} |
]])
feed('<LeftMouse><0,2>') -- Weirdness
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- {c:^>} 私は猫が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ {14:^>} 私は猫が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
- {sm:-- INSERT --} |
+ {1:~ }|*2
+ {5:-- INSERT --} |
]])
feed('<LeftMouse><8,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- {c:>} 私は猫^が大好き{0:>---}{c:X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ {14:>} 私は猫^が大好き{1:>---}{14:X} ✨{1:>}|
|
- {0:~ }|*2
- {sm:-- INSERT --} |
+ {1:~ }|*2
+ {5:-- INSERT --} |
]])
feed('<LeftMouse><20,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- {c:>} 私は猫が大好き{0:>---}{c:^X} ✨{0:>}|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ {14:>} 私は猫が大好き{1:>---}{14:^X} ✨{1:>}|
|
- {0:~ }|*2
- {sm:-- INSERT --} |
+ {1:~ }|*2
+ {5:-- INSERT --} |
]])
end) -- level 2 - non wrapped (insert mode)
@@ -1414,30 +1379,30 @@ describe('ui/mouse/input', function()
feed('<esc><LeftMouse><20,0>')
screen:expect([[
- Section{0:>>--->--->---}^t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}^t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} |
+ {14:>} 私は猫が大好き{1:>---}{14:X} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><14,1>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} ^t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} ^t2 t3 |
t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} |
+ {14:>} 私は猫が大好き{1:>---}{14:X} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><18,1>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t^3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t^3 |
t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} |
+ {14:>} 私は猫が大好き{1:>---}{14:X} |
✨🐈✨ |
|*2
]])
@@ -1450,60 +1415,60 @@ describe('ui/mouse/input', function()
-- reevaluated.
feed('<esc><LeftMouse><0,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 ^ |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 ^ |
t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} |
+ {14:>} 私は猫が大好き{1:>---}{14:X} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><1,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t^4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} |
+ {14:>} 私は猫が大好き{1:>---}{14:X} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><0,3>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- {c:^>} 私は猫が大好き{0:>---}{c:X} |
+ {14:^>} 私は猫が大好き{1:>---}{14:X} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><20,3>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- {c:>} 私は猫が大好き{0:>---}{c:^X} |
+ {14:>} 私は猫が大好き{1:>---}{14:^X} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><1,4>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} |
+ {14:>} 私は猫が大好き{1:>---}{14:X} |
^✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><5,4>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- {c:>} 私は猫が大好き{0:>---}{c:X} |
+ {14:>} 私は猫が大好き{1:>---}{14:X} |
✨🐈^✨ |
|*2
]])
@@ -1514,42 +1479,42 @@ describe('ui/mouse/input', function()
feed('<esc><LeftMouse><0,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- ^ 私は猫が大好き{0:>----} ✨🐈|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ ^ 私は猫が大好き{1:>----} ✨🐈|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><1,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- ^私は猫が大好き{0:>----} ✨🐈|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ ^私は猫が大好き{1:>----} ✨🐈|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><13,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- 私は猫が大好^き{0:>----} ✨🐈|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ 私は猫が大好^き{1:>----} ✨🐈|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('<esc><LeftMouse><20,2>')
feed('zH') -- FIXME: unnecessary horizontal scrolling
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 t4 |
- 私は猫が大好き{0:>----}^ ✨🐈|
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 t4 |
+ 私は猫が大好き{1:>----}^ ✨🐈|
|
- {0:~ }|*2
+ {1:~ }|*2
|
]])
end) -- level 3 - non wrapped
@@ -1559,80 +1524,80 @@ describe('ui/mouse/input', function()
feed('<esc><LeftMouse><14,1>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} ^t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} ^t2 t3 |
t4 |
- 私は猫が大好き{0:>----} |
+ 私は猫が大好き{1:>----} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><18,1>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t^3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t^3 |
t4 |
- 私は猫が大好き{0:>----} |
+ 私は猫が大好き{1:>----} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><1,2>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t^4 |
- 私は猫が大好き{0:>----} |
+ 私は猫が大好き{1:>----} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><0,3>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- ^ 私は猫が大好き{0:>----} |
+ ^ 私は猫が大好き{1:>----} |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><20,3>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- 私は猫が大好き{0:>----}^ |
+ 私は猫が大好き{1:>----}^ |
✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><1,4>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- 私は猫が大好き{0:>----} |
+ 私は猫が大好き{1:>----} |
^✨🐈✨ |
|*2
]])
feed('<esc><LeftMouse><3,4>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- 私は猫が大好き{0:>----} |
+ 私は猫が大好き{1:>----} |
✨^🐈✨ |
|*2
]])
feed('<esc><LeftMouse><5,4>')
screen:expect([[
- Section{0:>>--->--->---}t1 |
- {0:>--->--->---} t2 t3 |
+ Section{1:>>--->--->---}t1 |
+ {1:>--->--->---} t2 t3 |
t4 |
- 私は猫が大好き{0:>----} |
+ 私は猫が大好き{1:>----} |
✨🐈^✨ |
|*2
]])
@@ -1645,11 +1610,6 @@ describe('ui/mouse/input', function()
before_each(function()
screen:try_resize(25, 7)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- c = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
- sm = { bold = true },
- })
feed('ggdG')
command([[setlocal concealcursor=ni nowrap shiftwidth=2 tabstop=4 list listchars=tab:>-]])
@@ -1712,23 +1672,23 @@ describe('ui/mouse/input', function()
command('syntax match test /|hidden|/ conceal cchar=X')
command('set conceallevel=2 concealcursor=n virtualedit=all')
screen:expect([[
- aaaaaaaaaa{9:X}bbbbbbb |
- bbb{9:X}ccccccccc^c |
- {0:~ }|*2
+ aaaaaaaaaa{14:X}bbbbbbb |
+ bbb{14:X}ccccccccc^c |
+ {1:~ }|*2
|
]])
api.nvim_input_mouse('left', 'press', '', 0, 0, 22)
screen:expect([[
- aaaaaaaaaa{9:X}bbbbbb^b |
- bbb{9:X}cccccccccc |
- {0:~ }|*2
+ aaaaaaaaaa{14:X}bbbbbb^b |
+ bbb{14:X}cccccccccc |
+ {1:~ }|*2
|
]])
api.nvim_input_mouse('left', 'press', '', 0, 1, 16)
screen:expect([[
- aaaaaaaaaa{9:X}bbbbbbb |
- bbb{9:X}cccccccccc ^ |
- {0:~ }|*2
+ aaaaaaaaaa{14:X}bbbbbbb |
+ bbb{14:X}cccccccccc ^ |
+ {1:~ }|*2
|
]])
@@ -1738,23 +1698,23 @@ describe('ui/mouse/input', function()
virt_text_repeat_linebreak = true,
})
screen:expect([[
- aaaaaaaaaa{9:X}bbbbbbb {6:?}|
- bbb{9:X}cccccccccc ^ {6:?}|
- {0:~ }|*2
+ aaaaaaaaaa{14:X}bbbbbbb {9:?}|
+ bbb{14:X}cccccccccc ^ {9:?}|
+ {1:~ }|*2
|
]])
api.nvim_input_mouse('left', 'press', '', 0, 0, 22)
screen:expect([[
- aaaaaaaaaa{9:X}bbbbbb^b {6:?}|
- bbb{9:X}cccccccccc {6:?}|
- {0:~ }|*2
+ aaaaaaaaaa{14:X}bbbbbb^b {9:?}|
+ bbb{14:X}cccccccccc {9:?}|
+ {1:~ }|*2
|
]])
api.nvim_input_mouse('left', 'press', '', 0, 1, 16)
screen:expect([[
- aaaaaaaaaa{9:X}bbbbbbb {6:?}|
- bbb{9:X}cccccccccc ^ {6:?}|
- {0:~ }|*2
+ aaaaaaaaaa{14:X}bbbbbbb {9:?}|
+ bbb{14:X}cccccccccc ^ {9:?}|
+ {1:~ }|*2
|
]])
end)
@@ -1908,19 +1868,40 @@ describe('ui/mouse/input', function()
eq(0, api.nvim_get_var('mouse_up2'))
end)
- it('<MouseMove> is not translated into multiclicks and can be mapped', function()
+ it('<MouseMove> to different locations can be mapped', function()
api.nvim_set_var('mouse_move', 0)
api.nvim_set_var('mouse_move2', 0)
command('nnoremap <MouseMove> <Cmd>let g:mouse_move += 1<CR>')
command('nnoremap <2-MouseMove> <Cmd>let g:mouse_move2 += 1<CR>')
- feed('<MouseMove><0,0>')
- feed('<MouseMove><0,0>')
- api.nvim_input_mouse('move', '', '', 0, 0, 0)
- api.nvim_input_mouse('move', '', '', 0, 0, 0)
+ feed('<MouseMove><1,0>')
+ feed('<MouseMove><2,0>')
+ api.nvim_input_mouse('move', '', '', 0, 0, 3)
+ api.nvim_input_mouse('move', '', '', 0, 0, 4)
eq(4, api.nvim_get_var('mouse_move'))
eq(0, api.nvim_get_var('mouse_move2'))
end)
+ it('<MouseMove> to same location does not generate events #31103', function()
+ api.nvim_set_var('mouse_move', 0)
+ api.nvim_set_var('mouse_move2', 0)
+ command('nnoremap <MouseMove> <Cmd>let g:mouse_move += 1<CR>')
+ command('nnoremap <2-MouseMove> <Cmd>let g:mouse_move2 += 1<CR>')
+ api.nvim_input_mouse('move', '', '', 0, 0, 3)
+ eq(1, api.nvim_get_var('mouse_move'))
+ eq(0, api.nvim_get_var('mouse_move2'))
+ feed('<MouseMove><3,0>')
+ feed('<MouseMove><3,0>')
+ api.nvim_input_mouse('move', '', '', 0, 0, 3)
+ api.nvim_input_mouse('move', '', '', 0, 0, 3)
+ eq(1, api.nvim_get_var('mouse_move'))
+ eq(0, api.nvim_get_var('mouse_move2'))
+ eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
+ feed('<MouseMove><3,0><Insert>')
+ eq(1, api.nvim_get_var('mouse_move'))
+ eq(0, api.nvim_get_var('mouse_move2'))
+ eq({ mode = 'i', blocking = false }, api.nvim_get_mode())
+ end)
+
it('feeding <MouseMove> in Normal mode does not use uninitialized memory #19480', function()
feed('<MouseMove>')
n.poke_eventloop()
diff --git a/test/functional/ui/multibyte_spec.lua b/test/functional/ui/multibyte_spec.lua
index f16f750ea1..001d3cb430 100644
--- a/test/functional/ui/multibyte_spec.lua
+++ b/test/functional/ui/multibyte_spec.lua
@@ -16,8 +16,7 @@ describe('multibyte rendering', function()
local screen
before_each(function()
clear()
- screen = Screen.new(60, 6)
- screen:attach({ rgb = true })
+ screen = Screen.new(60, 6, { rgb = true })
end)
it('works with composed char at start of line', function()
@@ -384,7 +383,6 @@ describe('multibyte rendering: statusline', function()
before_each(function()
clear()
screen = Screen.new(40, 4)
- screen:attach()
command('set laststatus=2')
end)
@@ -474,26 +472,42 @@ describe('multibyte rendering: statusline', function()
end)
it('emoji with ZWJ in filename with custom stl', function()
+ screen:add_extra_attr_ids {
+ [100] = {
+ bold = true,
+ reverse = true,
+ foreground = Screen.colors.Gray100,
+ background = Screen.colors.Red,
+ },
+ }
command('set statusline=xx%#ErrorMsg#%f%##yy')
command('file 🧑‍💻')
screen:expect {
grid = [[
^ |
{1:~ }|
- {3:xx}{9:🧑‍💻}{3:yy }|
+ {3:xx}{100:🧑‍💻}{3:yy }|
|
]],
}
end)
it('unprintable chars in filename with custom stl', function()
+ screen:add_extra_attr_ids {
+ [100] = {
+ bold = true,
+ reverse = true,
+ foreground = Screen.colors.Gray100,
+ background = Screen.colors.Red,
+ },
+ }
command('set statusline=xx%#ErrorMsg#%f%##yy')
command('file 🧑​💻')
screen:expect {
grid = [[
^ |
{1:~ }|
- {3:xx}{9:🧑<200b>💻}{3:yy }|
+ {3:xx}{100:🧑<200b>💻}{3:yy }|
|
]],
}
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index e009ed0a29..3afda0c4af 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -16,8 +16,7 @@ describe('ext_multigrid', function()
before_each(function()
clear{args_rm={'--headless'}, args={'--cmd', 'set laststatus=2'}}
- screen = Screen.new(53,14)
- screen:attach({ext_multigrid=true})
+ screen = Screen.new(53,14, {ext_multigrid=true})
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {foreground = Screen.colors.Magenta},
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
index b40ff29dec..211fc1dc77 100644
--- a/test/functional/ui/options_spec.lua
+++ b/test/functional/ui/options_spec.lua
@@ -44,8 +44,7 @@ describe('UI receives option updates', function()
clear_opts.args_rm = clear_opts.args_rm or {}
table.insert(clear_opts.args_rm or {}, '--cmd')
clear(clear_opts)
- screen = Screen.new(20, 5)
- screen:attach(screen_opts)
+ screen = Screen.new(20, 5, screen_opts)
-- NB: UI test suite can be run in both "linegrid" and legacy grid mode.
-- In both cases check that the received value is the one requested.
defaults.ext_linegrid = screen._options.ext_linegrid or false
@@ -70,7 +69,6 @@ describe('UI receives option updates', function()
function screen:_handle_mouse_off()
table.insert(evs, 'mouse_off')
end
- screen:attach()
screen:expect(function()
eq({ 'mouse_on' }, evs)
end)
@@ -215,24 +213,22 @@ describe('UI receives option updates', function()
end)
describe('UI can set terminal option', function()
- local screen
before_each(function()
-- by default we implicitly "--cmd 'set bg=light'" which ruins everything
clear { args_rm = { '--cmd' } }
- screen = Screen.new(20, 5)
end)
it('term_name', function()
eq('nvim', eval '&term')
- screen:attach { term_name = 'xterm' }
+ local _ = Screen.new(20, 5, { term_name = 'xterm' })
eq('xterm', eval '&term')
end)
it('term_colors', function()
eq('256', eval '&t_Co')
- screen:attach { term_colors = 8 }
+ local _ = Screen.new(20, 5, { term_colors = 8 })
eq('8', eval '&t_Co')
end)
end)
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index 220af06f53..b5a09d814c 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -109,7 +109,6 @@ describe('shell command :!', function()
it('handles control codes', function()
skip(is_os('win'), 'missing printf')
local screen = Screen.new(50, 4)
- screen:attach()
-- Print TAB chars. #2958
feed([[:!printf '1\t2\t3'<CR>]])
screen:expect {
@@ -167,7 +166,6 @@ describe('shell command :!', function()
write_file('bang_filter_spec/f2', 'f2')
write_file('bang_filter_spec/f3', 'f3')
screen = Screen.new(53, 10)
- screen:attach()
end)
after_each(function()
@@ -241,7 +239,6 @@ describe('shell command :!', function()
it('powershell supports literal strings', function()
set_shell_powershell()
local screen = Screen.new(45, 4)
- screen:attach()
feed_command([[!'Write-Output $a']])
screen:expect([[
:!'Write-Output $a' |
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index f84362ede8..8fe8975b4a 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -19,18 +19,7 @@ describe('ui/ext_popupmenu', function()
local screen
before_each(function()
clear()
- screen = Screen.new(60, 8)
- screen:attach({ rgb = true, ext_popupmenu = true })
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Blue },
- [2] = { bold = true },
- [3] = { reverse = true },
- [4] = { bold = true, reverse = true },
- [5] = { bold = true, foreground = Screen.colors.SeaGreen },
- [6] = { background = Screen.colors.WebGray },
- [7] = { background = Screen.colors.LightMagenta },
- [8] = { foreground = Screen.colors.Red },
- })
+ screen = Screen.new(60, 8, { rgb = true, ext_popupmenu = true })
source([[
function! TestComplete() abort
call complete(1, [{'word':'foo', 'abbr':'fo', 'menu':'the foo', 'info':'foo-y', 'kind':'x'}, 'bar', 'spam'])
@@ -52,7 +41,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -67,7 +56,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -83,7 +72,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -98,7 +87,7 @@ describe('ui/ext_popupmenu', function()
|
bar^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
}
end)
@@ -110,7 +99,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -125,7 +114,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -140,7 +129,7 @@ describe('ui/ext_popupmenu', function()
|
spam^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -154,7 +143,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
feed('<c-w><C-r>=TestComplete()<CR>')
@@ -163,7 +152,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -178,7 +167,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -193,7 +182,7 @@ describe('ui/ext_popupmenu', function()
|
bar^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -208,7 +197,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -223,7 +212,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -237,7 +226,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
command('set wildmenu')
@@ -332,7 +321,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -347,7 +336,7 @@ describe('ui/ext_popupmenu', function()
|
spam^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -362,7 +351,7 @@ describe('ui/ext_popupmenu', function()
|
spam^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -376,7 +365,7 @@ describe('ui/ext_popupmenu', function()
|
bar^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
feed('<Esc>:sign <Tab>')
@@ -440,33 +429,33 @@ describe('ui/ext_popupmenu', function()
screen:expect([[
|
foo^ |
- {6:fo x the foo }{1: }|
- {7:bar }{1: }|
- {7:spam }{1: }|
+ {12:fo x the foo }{1: }|
+ {4:bar }{1: }|
+ {4:spam }{1: }|
{1:~ }|*2
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
feed('<f1>')
screen:expect([[
|
spam^ |
- {7:fo x the foo }{1: }|
- {7:bar }{1: }|
- {6:spam }{1: }|
+ {4:fo x the foo }{1: }|
+ {4:bar }{1: }|
+ {12:spam }{1: }|
{1:~ }|*2
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
feed('<f2>')
screen:expect([[
|
spam^ |
- {7:fo x the foo }{1: }|
- {7:bar }{1: }|
- {7:spam }{1: }|
+ {4:fo x the foo }{1: }|
+ {4:bar }{1: }|
+ {4:spam }{1: }|
{1:~ }|*2
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
feed('<f3>')
@@ -474,42 +463,42 @@ describe('ui/ext_popupmenu', function()
|
bar^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
feed('<Esc>:sign <Tab>')
screen:expect([[
|
- bar {6: define } |
- {1:~ }{7: jump }{1: }|
- {1:~ }{7: list }{1: }|
- {1:~ }{7: place }{1: }|
- {1:~ }{7: undefine }{1: }|
- {1:~ }{7: unplace }{1: }|
+ bar {12: define } |
+ {1:~ }{4: jump }{1: }|
+ {1:~ }{4: list }{1: }|
+ {1:~ }{4: place }{1: }|
+ {1:~ }{4: undefine }{1: }|
+ {1:~ }{4: unplace }{1: }|
:sign define^ |
]])
feed('<f1>')
screen:expect([[
|
- bar {7: define } |
- {1:~ }{7: jump }{1: }|
- {1:~ }{6: list }{1: }|
- {1:~ }{7: place }{1: }|
- {1:~ }{7: undefine }{1: }|
- {1:~ }{7: unplace }{1: }|
+ bar {4: define } |
+ {1:~ }{4: jump }{1: }|
+ {1:~ }{12: list }{1: }|
+ {1:~ }{4: place }{1: }|
+ {1:~ }{4: undefine }{1: }|
+ {1:~ }{4: unplace }{1: }|
:sign list^ |
]])
feed('<f2>')
screen:expect([[
|
- bar {7: define } |
- {1:~ }{7: jump }{1: }|
- {1:~ }{7: list }{1: }|
- {1:~ }{7: place }{1: }|
- {1:~ }{7: undefine }{1: }|
- {1:~ }{7: unplace }{1: }|
+ bar {4: define } |
+ {1:~ }{4: jump }{1: }|
+ {1:~ }{4: list }{1: }|
+ {1:~ }{4: place }{1: }|
+ {1:~ }{4: undefine }{1: }|
+ {1:~ }{4: unplace }{1: }|
:sign ^ |
]])
@@ -542,33 +531,33 @@ describe('ui/ext_popupmenu', function()
screen:expect([[
aa bb cc |
aa^ |
- {6:aa }{1: }|
- {7:bb }{1: }|
- {7:cc }{1: }|
+ {12:aa }{1: }|
+ {4:bb }{1: }|
+ {4:cc }{1: }|
{1:~ }|*2
- {2:-- Keyword Local completion (^N^P) }{5:match 1 of 3} |
+ {5:-- Keyword Local completion (^N^P) }{6:match 1 of 3} |
]])
feed('<f1>')
screen:expect([[
aa bb cc |
cc^ |
- {7:aa }{1: }|
- {7:bb }{1: }|
- {6:cc }{1: }|
+ {4:aa }{1: }|
+ {4:bb }{1: }|
+ {12:cc }{1: }|
{1:~ }|*2
- {2:-- Keyword Local completion (^N^P) }{5:match 3 of 3} |
+ {5:-- Keyword Local completion (^N^P) }{6:match 3 of 3} |
]])
feed('<f2>')
screen:expect([[
aa bb cc |
cc^ |
- {7:aa }{1: }|
- {7:bb }{1: }|
- {7:cc }{1: }|
+ {4:aa }{1: }|
+ {4:bb }{1: }|
+ {4:cc }{1: }|
{1:~ }|*2
- {2:-- Keyword Local completion (^N^P) }{8:Back at original} |
+ {5:-- Keyword Local completion (^N^P) }{19:Back at original} |
]])
feed('<f3>')
@@ -576,7 +565,7 @@ describe('ui/ext_popupmenu', function()
aa bb cc |
bb^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]])
end)
@@ -619,7 +608,7 @@ describe('ui/ext_popupmenu', function()
|
January^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = month_expected,
@@ -671,7 +660,7 @@ describe('ui/ext_popupmenu', function()
|
January^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = month_expected,
@@ -726,7 +715,7 @@ describe('ui/ext_popupmenu', function()
|
January^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = month_expected,
@@ -740,7 +729,7 @@ describe('ui/ext_popupmenu', function()
|
January^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = month_expected,
@@ -832,10 +821,10 @@ describe('ui/ext_popupmenu', function()
grid = [[
|
{1:~ }|*3
- {4:långfile2 }|
+ {3:långfile2 }|
|
{1:~ }|*2
- {3:långfile1 }|
+ {2:långfile1 }|
:b långfile1^ |
]],
popupmenu = {
@@ -863,7 +852,7 @@ describe('ui/ext_popupmenu', function()
|
foo^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -878,7 +867,7 @@ describe('ui/ext_popupmenu', function()
|
^ |
{1:~ }|*5
- {2:-- INSERT --} |
+ {5:-- INSERT --} |
]],
popupmenu = {
items = expected,
@@ -899,9 +888,9 @@ describe('ui/ext_popupmenu', function()
feed('<RightMouse><0,0>')
screen:expect([[
|
- {7:^foo } |
- {7:bar }{1: }|
- {7:baz }{1: }|
+ {4:^foo } |
+ {4:bar }{1: }|
+ {4:baz }{1: }|
{1:~ }|*3
|
]])
@@ -967,7 +956,6 @@ describe("builtin popupmenu 'pumblend'", function()
[44] = { foreground = tonumber('0x3f3f3f'), background = tonumber('0x7f5d7f') },
[45] = { background = Screen.colors.WebGray, blend = 0 },
})
- screen:attach()
command('syntax on')
command('set mouse=a')
command('set pumblend=10')
@@ -1117,7 +1105,7 @@ describe("builtin popupmenu 'pumblend'", function()
end)
it('256-color (non-RGB)', function()
- local screen = Screen.new(60, 8)
+ local screen = Screen.new(60, 8, { rgb = false })
screen:set_default_attr_ids({
[1] = { foreground = Screen.colors.Grey0, background = tonumber('0x000007') },
[2] = { foreground = tonumber('0x000055'), background = tonumber('0x000007') },
@@ -1130,7 +1118,6 @@ describe("builtin popupmenu 'pumblend'", function()
[9] = { bold = true },
[10] = { foreground = tonumber('0x000002') },
})
- screen:attach({ rgb = false })
command('set pumblend=10')
insert([[
Lorem ipsum dolor sit amet, consectetur
@@ -1159,7 +1146,7 @@ describe('builtin popupmenu', function()
local function with_ext_multigrid(multigrid)
local screen
before_each(function()
- screen = Screen.new(32, 20)
+ screen = Screen.new(32, 20, { ext_multigrid = multigrid })
screen:set_default_attr_ids({
-- popup selected item / scrollbar track
s = { background = Screen.colors.Grey },
@@ -1204,7 +1191,6 @@ describe('builtin popupmenu', function()
underline = true,
},
})
- screen:attach({ ext_multigrid = multigrid })
end)
it('with preview-window above', function()
@@ -3636,6 +3622,58 @@ describe('builtin popupmenu', function()
:sign un^ |
]])
end)
+
+ it(
+ 'cascading highlights for matched text (PmenuMatch, PmenuMatchSel) in cmdline pum',
+ function()
+ screen:add_extra_attr_ids {
+ [100] = {
+ background = Screen.colors.Grey,
+ italic = true,
+ underline = true,
+ foreground = Screen.colors.White,
+ },
+ [101] = {
+ strikethrough = true,
+ foreground = Screen.colors.Grey0,
+ italic = true,
+ bold = true,
+ underline = true,
+ background = Screen.colors.White,
+ },
+ [102] = {
+ strikethrough = true,
+ foreground = Screen.colors.Red,
+ italic = true,
+ underline = true,
+ background = Screen.colors.Grey,
+ },
+ [103] = {
+ foreground = Screen.colors.Yellow,
+ italic = true,
+ bold = true,
+ underline = true,
+ background = Screen.colors.Pink,
+ },
+ }
+ exec([[
+ set wildoptions=pum,fuzzy
+ hi Pmenu guifg=White guibg=Grey gui=underline,italic
+ hi PmenuSel guifg=Red gui=strikethrough
+ hi PmenuMatch guifg=Yellow guibg=Pink gui=bold
+ hi PmenuMatchSel guifg=Black guibg=White
+ ]])
+
+ feed(':sign plc<Tab>')
+ screen:expect([[
+ |
+ {1:~ }|*16
+ {1:~ }{102: }{101:pl}{102:a}{101:c}{102:e }{1: }|
+ {1:~ }{100: un}{103:pl}{100:a}{103:c}{100:e }{1: }|
+ :sign place^ |
+ ]])
+ end
+ )
end
it("'pumheight'", function()
@@ -4453,9 +4491,10 @@ describe('builtin popupmenu', function()
:let g:menustr = 'foo' |
]])
end
+ local no_menu_screen ---@type string|test.function.ui.screen.Expect
if multigrid then
api.nvim_input_mouse('left', 'press', '', 4, 1, 2)
- screen:expect({
+ no_menu_screen = {
grid = [[
## grid 1
[2:--------------------------------]|*2
@@ -4474,19 +4513,189 @@ describe('builtin popupmenu', function()
{2:WINBAR }|
^popup menu test |
]],
- })
+ }
else
feed('<LeftMouse><31,2>')
- screen:expect([[
+ no_menu_screen = {
+ grid = [[
popup menu test |
{1:~ }|
{3:[No Name] [+] }|
popup menu test│{2:WINBAR }|
{1:~ }│^popup menu test |
:let g:menustr = 'bar' |
- ]])
+ ]],
+ }
end
+ screen:expect(no_menu_screen)
eq('bar', api.nvim_get_var('menustr'))
+
+ local no_sel_screen ---@type string|test.function.ui.screen.Expect
+ if multigrid then
+ no_sel_screen = {
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*2
+ {3:[No Name] [+] }|
+ [5:---------------]│[6:----------------]|*2
+ [3:--------------------------------]|
+ ## grid 2
+ popup menu test |
+ {1:~ }|
+ ## grid 3
+ :let g:menustr = 'bar' |
+ ## grid 4
+ {n: foo }|
+ {n: bar }|
+ {n: baz }|
+ ## grid 5
+ popup menu test|
+ {1:~ }|
+ ## grid 6
+ {2:WINBAR }|
+ ^popup menu test |
+ ]],
+ float_pos = { [4] = { -1, 'NW', 1, 1, 19, false, 250 } },
+ }
+ else
+ no_sel_screen = {
+ grid = [[
+ popup menu test |
+ {1:~ }{n: foo }{1: }|
+ {3:[No Name] [+] }{n: bar }{3: }|
+ popup menu test│{2:WIN}{n: baz }{2: }|
+ {1:~ }│^popup menu test |
+ :let g:menustr = 'bar' |
+ ]],
+ }
+ end
+ local sel_screens = {} ---@type (string|test.function.ui.screen.Expect)[]
+ for i, s in ipairs({ 'foo', 'bar', 'baz' }) do
+ local sel_screen = vim.deepcopy(no_sel_screen)
+ local grid = assert(sel_screen.grid)
+ grid = grid:gsub(vim.pesc(('{n: %s }'):format(s)), ('{s: %s }'):format(s))
+ sel_screen.grid = grid
+ sel_screens[i] = sel_screen
+ end
+
+ command([[let g:menustr = '']])
+ local g = multigrid and 1 or 0
+
+ api.nvim_input_mouse('right', 'press', '', g, 0, 20)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 1, 19)
+ screen:expect(sel_screens[1])
+ api.nvim_input_mouse('move', '', '', g, 1, 18)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 2, 23)
+ screen:expect(sel_screens[2])
+ api.nvim_input_mouse('move', '', '', g, 2, 24)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 3, 19)
+ screen:expect(sel_screens[3])
+ api.nvim_input_mouse('left', 'press', '', g, 3, 18)
+ screen:expect(no_menu_screen)
+ eq('', api.nvim_get_var('menustr'))
+
+ command('wincmd t | set rightleft')
+ if multigrid then
+ no_menu_screen = {
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*2
+ {4:[No Name] [+] }|
+ [5:---------------]│[6:----------------]|*2
+ [3:--------------------------------]|
+ ## grid 2
+ tset unem pupo^p|
+ {1: ~}|
+ ## grid 3
+ :let g:menustr = 'bar' |
+ ## grid 5
+ popup menu test|
+ {1:~ }|
+ ## grid 6
+ {2:WINBAR }|
+ popup menu test |
+ ]],
+ }
+ else
+ no_menu_screen = {
+ grid = [[
+ tset unem pupo^p|
+ {1: ~}|
+ {4:[No Name] [+] }|
+ popup menu test│{2:WINBAR }|
+ {1:~ }│popup menu test |
+ :let g:menustr = 'bar' |
+ ]],
+ }
+ end
+ screen:expect(no_menu_screen)
+
+ if multigrid then
+ no_sel_screen = {
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*2
+ {4:[No Name] [+] }|
+ [5:---------------]│[6:----------------]|*2
+ [3:--------------------------------]|
+ ## grid 2
+ tset unem pupo^p|
+ {1: ~}|
+ ## grid 3
+ :let g:menustr = 'bar' |
+ ## grid 4
+ {n: oof }|
+ {n: rab }|
+ {n: zab }|
+ ## grid 5
+ popup menu test|
+ {1:~ }|
+ ## grid 6
+ {2:WINBAR }|
+ popup menu test |
+ ]],
+ float_pos = { [4] = { -1, 'NW', 1, 1, 17, false, 250 } },
+ }
+ else
+ no_sel_screen = {
+ grid = [[
+ tset unem pupo^p|
+ {1: }{n: oof }{1: ~}|
+ {4:[No Name] [+] }{n: rab }{4: }|
+ popup menu test│{2:W}{n: zab }{2: }|
+ {1:~ }│popup menu test |
+ :let g:menustr = 'bar' |
+ ]],
+ }
+ end
+ for i, s in ipairs({ 'oof', 'rab', 'zab' }) do
+ local sel_screen = vim.deepcopy(no_sel_screen)
+ local grid = assert(sel_screen.grid)
+ grid = grid:gsub(vim.pesc(('{n: %s }'):format(s)), ('{s: %s }'):format(s))
+ sel_screen.grid = grid
+ sel_screens[i] = sel_screen
+ end
+
+ api.nvim_input_mouse('right', 'press', '', g, 0, 20)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 1, 21)
+ screen:expect(sel_screens[1])
+ api.nvim_input_mouse('move', '', '', g, 1, 22)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 2, 17)
+ screen:expect(sel_screens[2])
+ api.nvim_input_mouse('move', '', '', g, 2, 16)
+ screen:expect(no_sel_screen)
+ api.nvim_input_mouse('move', '', '', g, 3, 21)
+ screen:expect(sel_screens[3])
+ api.nvim_input_mouse('left', 'press', '', g, 3, 22)
+ screen:expect(no_menu_screen)
+ eq('', api.nvim_get_var('menustr'))
+
+ command('set norightleft')
end)
if not multigrid then
@@ -4963,20 +5172,31 @@ describe('builtin popupmenu', function()
feed('<C-E><Esc>')
end)
- -- oldtest: Test_pum_user_hl_group()
- it('custom hl_group override', function()
+ -- oldtest: Test_pum_user_abbr_hlgroup()
+ it('custom abbr_hlgroup override', function()
exec([[
- func CompleteFunc( findstart, base )
+ let s:var = 0
+ func CompleteFunc(findstart, base)
if a:findstart
return 0
endif
+ if s:var == 1
+ return {
+ \ 'words': [
+ \ { 'word': 'aword1', 'abbr_hlgroup': 'StrikeFake' },
+ \ { 'word': '你好', 'abbr_hlgroup': 'StrikeFake' },
+ \]}
+ endif
return {
\ 'words': [
- \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', 'hl_group': 'StrikeFake' },
+ \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', 'abbr_hlgroup': 'StrikeFake' },
\ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', },
- \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'hl_group': 'StrikeFake' },
+ \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'abbr_hlgroup': 'StrikeFake' },
\]}
endfunc
+ func ChangeVar()
+ let s:var = 1
+ endfunc
set completeopt=menu
set completefunc=CompleteFunc
@@ -4990,9 +5210,9 @@ describe('builtin popupmenu', function()
feed('Saw<C-X><C-U>')
screen:expect([[
aword1^ |
- {ds:aword1 W extra text 1 }{1: }|
+ {ds:aword1}{s: W extra text 1 }{1: }|
{n:aword2 W extra text 2 }{1: }|
- {dn:你好 W extra text 3 }{1: }|
+ {dn:你好}{n: W extra text 3 }{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
@@ -5003,22 +5223,33 @@ describe('builtin popupmenu', function()
feed('Saw<C-X><C-U>')
screen:expect([[
aword1^ |
- {uds:aw}{ds:ord1 W extra text 1 }{1: }|
+ {uds:aw}{ds:ord1}{s: W extra text 1 }{1: }|
{umn:aw}{n:ord2 W extra text 2 }{1: }|
- {dn:你好 W extra text 3 }{1: }|
+ {dn:你好}{n: W extra text 3 }{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
feed('<C-N>')
screen:expect([[
aword2^ |
- {udn:aw}{dn:ord1 W extra text 1 }{1: }|
+ {udn:aw}{dn:ord1}{n: W extra text 1 }{1: }|
{ums:aw}{s:ord2 W extra text 2 }{1: }|
- {dn:你好 W extra text 3 }{1: }|
+ {dn:你好}{n: W extra text 3 }{1: }|
{1:~ }|*15
{2:-- }{5:match 2 of 3} |
]])
feed('<C-E><Esc>')
+
+ command('call ChangeVar()')
+ feed('S<C-X><C-U>')
+ screen:expect([[
+ aword1^ |
+ {ds:aword1}{s: }{1: }|
+ {dn:你好}{n: }{1: }|
+ {1:~ }|*16
+ {2:-- }{5:match 1 of 2} |
+ ]])
+ feed('<C-E><Esc>')
end)
-- oldtest: Test_pum_user_kind_hlgroup()
@@ -5030,7 +5261,7 @@ describe('builtin popupmenu', function()
endif
return {
\ 'words': [
- \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'variable', 'kind_hlgroup': 'KindVar', 'hl_group': 'StrikeFake' },
+ \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'variable', 'kind_hlgroup': 'KindVar', 'abbr_hlgroup': 'StrikeFake' },
\ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'function', 'kind_hlgroup': 'KindFunc' },
\ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'class', 'kind_hlgroup': 'KindClass' },
\]}
@@ -5053,9 +5284,9 @@ describe('builtin popupmenu', function()
feed('S<C-X><C-U>')
screen:expect([[
aword1^ |
- {ds:aword1 }{kvs:variable }{ds:extra text 1 }{1: }|
- {n:aword2 }{kfn:function }{n:extra text 2 }{1: }|
- {n:你好 }{kcn:class }{n:extra text 3 }{1: }|
+ {ds:aword1}{s: }{kvs:variable}{s: extra text 1 }{1: }|
+ {n:aword2 }{kfn:function}{n: extra text 2 }{1: }|
+ {n:你好 }{kcn:class}{n: extra text 3 }{1: }|
{1:~ }|*15
{2:-- }{5:match 1 of 3} |
]])
diff --git a/test/functional/ui/quickfix_spec.lua b/test/functional/ui/quickfix_spec.lua
index 73923a153a..3750ce3d3f 100644
--- a/test/functional/ui/quickfix_spec.lua
+++ b/test/functional/ui/quickfix_spec.lua
@@ -11,7 +11,6 @@ describe('quickfix selection highlight', function()
clear()
screen = Screen.new(25, 10)
- screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { reverse = true },
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index f1891b608e..8e15e6c35f 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -6,23 +6,15 @@
--
-- Example usage:
--
+-- -- Attach a screen to the current Nvim instance.
-- local screen = Screen.new(25, 10)
--- -- Attach the screen to the current Nvim instance.
--- screen:attach()
-- -- Enter insert-mode and type some text.
-- feed('ihello screen')
-- -- Assert the expected screen state.
-- screen:expect([[
--- hello screen |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- -- INSERT -- |
+-- hello screen^ |
+-- {1:~ }|*8
+-- {5:-- INSERT --} |
-- ]]) -- <- Last line is stripped
--
-- Since screen updates are received asynchronously, expect() actually specifies
@@ -36,36 +28,19 @@
-- * If the timeout expires, the last match error will be reported and the
-- test will fail.
--
--- Continuing the above example, say we want to assert that "-- INSERT --" is
--- highlighted with the bold attribute. The expect() call should look like this:
---
--- NonText = Screen.colors.Blue
--- screen:expect([[
--- hello screen |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- ~ |
--- {b:-- INSERT --} |
--- ]], {b = {bold = true}}, {{bold = true, foreground = NonText}})
---
--- In this case "b" is a string associated with the set composed of one
--- attribute: bold. Note that since the {b:} markup is not a real part of the
+-- The 30 most common highlight groups are predefined, see init_colors() below.
+-- In this case "5" is a predefined highlight associated with the set composed of one
+-- attribute: bold. Note that since the {5:} markup is not a real part of the
-- screen, the delimiter "|" moved to the right. Also, the highlighting of the
--- NonText markers "~" is ignored in this test.
+-- NonText markers "~" is visible.
--
--- Tests will often share a group of attribute sets to expect(). Those can be
+-- Tests will often share a group of extra attribute sets to expect(). Those can be
-- defined at the beginning of a test:
--
--- NonText = Screen.colors.Blue
--- screen:set_default_attr_ids( {
--- [1] = {reverse = true, bold = true},
--- [2] = {reverse = true}
--- })
+-- screen:add_extra_attr_ids {
+-- [100] = { background = Screen.colors.Plum1, underline = true },
+-- [101] = { background = Screen.colors.Red1, bold = true, underline = true },
+-- }
--
-- To help write screen tests, see Screen:snapshot_util().
-- To debug screen tests, see Screen:redraw_debug().
@@ -180,14 +155,30 @@ local function _init_colors()
}
end
+--- @class test.functional.ui.screen.Opts
+--- @field ext_linegrid? boolean
+--- @field ext_multigrid? boolean
+--- @field ext_newgrid? boolean
+--- @field ext_popupmenu? boolean
+--- @field ext_wildmenu? boolean
+--- @field rgb? boolean
+--- @field _debug_float? boolean
+
--- @param width? integer
--- @param height? integer
+--- @param options? test.functional.ui.screen.Opts
+--- @param session? test.Session|false
--- @return test.functional.ui.screen
-function Screen.new(width, height)
+function Screen.new(width, height, options, session)
if not Screen.colors then
_init_colors()
end
+ options = options or {}
+ if options.ext_linegrid == nil then
+ options.ext_linegrid = true
+ end
+
local self = setmetatable({
timeout = default_screen_timeout,
title = '',
@@ -227,6 +218,7 @@ function Screen.new(width, height)
_new_attrs = false,
_width = width or 53,
_height = height or 14,
+ _options = options,
_grids = {},
_grid_win_extmarks = {},
_cursor = {
@@ -250,6 +242,11 @@ function Screen.new(width, height)
self.uimeths = create_callindex(ui)
+ -- session is often nil, which implies the default session
+ if session ~= false then
+ self:attach(session)
+ end
+
return self
end
@@ -277,20 +274,10 @@ function Screen:set_rgb_cterm(val)
self._rgb_cterm = val
end
---- @class test.functional.ui.screen.Opts
---- @field ext_linegrid? boolean
---- @field ext_multigrid? boolean
---- @field ext_newgrid? boolean
---- @field ext_popupmenu? boolean
---- @field ext_wildmenu? boolean
---- @field rgb? boolean
---- @field _debug_float? boolean
-
---- @param options? test.functional.ui.screen.Opts
--- @param session? test.Session
-function Screen:attach(options, session)
+function Screen:attach(session)
session = session or get_session()
- options = options or {}
+ local options = self._options
if options.ext_linegrid == nil then
options.ext_linegrid = true
@@ -1524,7 +1511,7 @@ end
function Screen:_chunks_repr(chunks, attr_state)
local repr_chunks = {}
for i, chunk in ipairs(chunks) do
- local hl, text = unpack(chunk)
+ local hl, text, id = unpack(chunk)
local attrs
if self._options.ext_linegrid then
attrs = self._attr_table[hl][1]
@@ -1532,7 +1519,7 @@ function Screen:_chunks_repr(chunks, attr_state)
attrs = hl
end
local attr_id = self:_get_attr_id(attr_state, attrs, hl)
- repr_chunks[i] = { text, attr_id }
+ repr_chunks[i] = { text, attr_id, attr_id and id or nil }
end
return repr_chunks
end
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 85a653df36..f39e9ecc33 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -29,7 +29,6 @@ describe('screen', function()
local screen_nvim = spawn(nvim_argv)
set_session(screen_nvim)
screen = Screen.new()
- screen:attach()
end)
it('default initial screen', function()
@@ -47,8 +46,7 @@ local function screen_tests(linegrid)
before_each(function()
clear()
- screen = Screen.new()
- screen:attach({ rgb = true, ext_linegrid = linegrid })
+ screen = Screen.new(53, 14, { rgb = true, ext_linegrid = linegrid })
screen:set_default_attr_ids({
[0] = { bold = true, foreground = 255 },
[1] = { bold = true, reverse = true },
@@ -717,8 +715,7 @@ describe('Screen default colors', function()
}
local screen_nvim = spawn(nvim_argv)
set_session(screen_nvim)
- screen = Screen.new()
- screen:attach(termcolors and { rgb = true, ext_termcolors = true } or { rgb = true })
+ screen = Screen.new(53, 14, { rgb = true, ext_termcolors = termcolors or nil })
end
it('are dark per default', function()
@@ -777,7 +774,6 @@ end)
it('CTRL-F or CTRL-B scrolls a page after UI attach/resize #20605', function()
clear()
local screen = Screen.new(100, 100)
- screen:attach()
eq(100, api.nvim_get_option_value('lines', {}))
eq(99, api.nvim_get_option_value('window', {}))
eq(99, api.nvim_win_get_height(0))
@@ -810,7 +806,6 @@ end)
it("showcmd doesn't cause empty grid_line with redrawdebug=compositor #22593", function()
clear()
local screen = Screen.new(30, 2)
- screen:attach()
command('set showcmd redrawdebug=compositor')
feed('d')
screen:expect {
@@ -824,7 +819,6 @@ end)
it("scrolling in narrow window doesn't draw over separator #29033", function()
clear()
local screen = Screen.new(60, 8)
- screen:attach()
feed('100Oa<Esc>gg')
exec([[
set number nowrap
diff --git a/test/functional/ui/scrollbind_spec.lua b/test/functional/ui/scrollbind_spec.lua
index 9e70b25efa..84316762e4 100644
--- a/test/functional/ui/scrollbind_spec.lua
+++ b/test/functional/ui/scrollbind_spec.lua
@@ -10,7 +10,6 @@ describe('Scrollbind', function()
before_each(function()
screen = Screen.new(40, 12)
- screen:attach()
end)
it('works with one buffer with virtual lines', function()
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index eab265cbb1..86490b4527 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -16,7 +16,6 @@ describe('search highlighting', function()
before_each(function()
clear()
screen = Screen.new(40, 7)
- screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true, foreground = Screen.colors.Blue },
[2] = { background = Screen.colors.Yellow }, -- Search
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index 30da79af47..7874c04c39 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -12,21 +12,9 @@ describe('Signs', function()
before_each(function()
clear()
screen = Screen.new()
- screen:attach()
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = 255 },
- [1] = { background = Screen.colors.Yellow },
- [2] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey },
- [3] = { background = Screen.colors.Gray90 },
- [4] = { bold = true, reverse = true },
- [5] = { reverse = true },
- [6] = { foreground = Screen.colors.Brown },
- [7] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey },
- [8] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
- [9] = { bold = true, foreground = Screen.colors.Magenta },
- [10] = { foreground = Screen.colors.Blue1 },
- [11] = { bold = true, foreground = Screen.colors.SeaGreen4 },
- })
+ screen:add_extra_attr_ids {
+ [100] = { bold = true, foreground = Screen.colors.Magenta1 },
+ }
end)
describe(':sign place', function()
@@ -39,10 +27,10 @@ describe('Signs', function()
sign place 2 line=2 name=piet2 buffer=1
]])
screen:expect([[
- {1:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a |
- {1:𠜎̀́̂̃̄̅}b |
- {2: }^ |
- {0:~ }|*10
+ {10:𐌢̀́̂̃̅̄𐌢̀́̂̃̅̄}a |
+ {10:𠜎̀́̂̃̄̅}b |
+ {7: }^ |
+ {1:~ }|*10
|
]])
end)
@@ -57,11 +45,11 @@ describe('Signs', function()
sign place 3 line=1 name=pietx buffer=1
]])
screen:expect([[
- {1:>!}a |
- {2: }b |
- {1:>>}c |
- {2: }^ |
- {0:~ }|*9
+ {10:>!}a |
+ {7: }b |
+ {10:>>}c |
+ {7: }^ |
+ {1:~ }|*9
|
]])
end)
@@ -74,7 +62,7 @@ describe('Signs', function()
a |
b |
^ |
- {0:~ }|*10
+ {1:~ }|*10
|
]])
end)
@@ -91,18 +79,18 @@ describe('Signs', function()
sign place 3 line=2 name=piet buffer=1
]])
screen:expect([[
- {2: }{3:^a }|
- {1:>>}b |
- {2: }c |
- {2: } |
- {0:~ }|*2
- {4:[No Name] [+] }|
- {2: }{3:a }|
- {1:>>}b |
- {2: }c |
- {2: } |
- {0:~ }|
- {5:[No Name] [+] }|
+ {7: }{21:^a }|
+ {10:>>}b |
+ {7: }c |
+ {7: } |
+ {1:~ }|*2
+ {3:[No Name] [+] }|
+ {7: }{21:a }|
+ {10:>>}b |
+ {7: }c |
+ {7: } |
+ {1:~ }|
+ {2:[No Name] [+] }|
|
]])
end)
@@ -122,11 +110,11 @@ describe('Signs', function()
sign place 6 line=4 name=pietxx buffer=1
]])
screen:expect([[
- {1:>>}{6: 1 }a |
- {2: }{6: 2 }{8:b }|
- {2: }{7: 3 }c |
- {1:>>}{7: 4 }{8:^ }|
- {0:~ }|*9
+ {10:>>}{8: 1 }a |
+ {7: }{8: 2 }{9:b }|
+ {7: }{13: 3 }c |
+ {10:>>}{13: 4 }{9:^ }|
+ {1:~ }|*9
|
]])
-- Check that 'statuscolumn' correctly applies numhl
@@ -144,45 +132,45 @@ describe('Signs', function()
set cursorline
]])
screen:expect([[
- {1:>>}a |
- {1:>>}b |
- {8:>>}{3:^c }|
- {0:~ }|*10
+ {10:>>}a |
+ {10:>>}b |
+ {9:>>}{21:^c }|
+ {1:~ }|*10
|
]])
feed('k')
screen:expect([[
- {1:>>}a |
- {8:>>}{3:^b }|
- {1:>>}c |
- {0:~ }|*10
+ {10:>>}a |
+ {9:>>}{21:^b }|
+ {10:>>}c |
+ {1:~ }|*10
|
]])
exec('set nocursorline')
screen:expect([[
- {1:>>}a |
- {1:>>}^b |
- {1:>>}c |
- {0:~ }|*10
+ {10:>>}a |
+ {10:>>}^b |
+ {10:>>}c |
+ {1:~ }|*10
|
]])
exec('set cursorline cursorlineopt=line')
screen:expect([[
- {1:>>}a |
- {1:>>}{3:^b }|
- {1:>>}c |
- {0:~ }|*10
+ {10:>>}a |
+ {10:>>}{21:^b }|
+ {10:>>}c |
+ {1:~ }|*10
|
]])
exec('set cursorlineopt=number')
exec('hi! link SignColumn IncSearch')
feed('Go<esc>2G')
screen:expect([[
- {1:>>}a |
- {8:>>}^b |
- {1:>>}c |
- {5: } |
- {0:~ }|*9
+ {10:>>}a |
+ {9:>>}^b |
+ {10:>>}c |
+ {2: } |
+ {1:~ }|*9
|
]])
-- Check that 'statuscolumn' cursorline/signcolumn highlights are the same (#21726)
@@ -206,11 +194,11 @@ describe('Signs', function()
-- of signs, the ones with the highest Ids are being picked,
-- and presented by their sorted Id order.
screen:expect([[
- {2: }{6: 1 }a |
- {2: }{6: 2 }b |
- WW{1:>>}{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {7: }{8: 1 }a |
+ {7: }{8: 2 }b |
+ WW{10:>>}{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
exec([[
@@ -221,42 +209,42 @@ describe('Signs', function()
sign place 3 line=2 name=pietError buffer=1
]])
screen:expect([[
- {8:XX}{1:>>}{6: 1 }a |
- {1:>>}{8:XX}{6: 2 }b |
- WW{1:>>}{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {9:XX}{10:>>}{8: 1 }a |
+ {10:>>}{9:XX}{8: 2 }b |
+ WW{10:>>}{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
-- With the default setting, we get the sign with the top id.
exec('set signcolumn=yes:1')
screen:expect([[
- {8:XX}{6: 1 }a |
- {1:>>}{6: 2 }b |
- WW{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {9:XX}{8: 1 }a |
+ {10:>>}{8: 2 }b |
+ WW{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
-- "auto:3" accommodates all the signs we defined so far.
exec('set signcolumn=auto:3')
local s3 = [[
- {8:XX}{1:>>}{2: }{6: 1 }a |
- {1:>>}{8:XX}{2: }{6: 2 }b |
- WW{1:>>}{8:XX}{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {9:XX}{10:>>}{7: }{8: 1 }a |
+ {10:>>}{9:XX}{7: }{8: 2 }b |
+ WW{10:>>}{9:XX}{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]]
screen:expect(s3)
-- Check "yes:9".
exec('set signcolumn=yes:9')
screen:expect([[
- {8:XX}{1:>>}{2: }{6: 1 }a |
- {1:>>}{8:XX}{2: }{6: 2 }b |
- WW{1:>>}{8:XX}{2: }{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {9:XX}{10:>>}{7: }{8: 1 }a |
+ {10:>>}{9:XX}{7: }{8: 2 }b |
+ WW{10:>>}{9:XX}{7: }{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
-- Check "auto:N" larger than the maximum number of signs defined in
@@ -267,19 +255,19 @@ describe('Signs', function()
exec('3move1')
exec('2d')
screen:expect([[
- {8:XX}{1:>>}{6: 1 }a |
- {1:>>}{8:XX}{6: 2 }^b |
- {2: }{6: 3 } |
- {0:~ }|*10
+ {9:XX}{10:>>}{8: 1 }a |
+ {10:>>}{9:XX}{8: 2 }^b |
+ {7: }{8: 3 } |
+ {1:~ }|*10
|
]])
-- character deletion does not delete signs.
feed('x')
screen:expect([[
- {8:XX}{1:>>}{6: 1 }a |
- {1:>>}{8:XX}{6: 2 }^ |
- {2: }{6: 3 } |
- {0:~ }|*10
+ {9:XX}{10:>>}{8: 1 }a |
+ {10:>>}{9:XX}{8: 2 }^ |
+ {7: }{8: 3 } |
+ {1:~ }|*10
|
]])
end)
@@ -290,21 +278,21 @@ describe('Signs', function()
-- sign column should always accommodate at the minimum size
exec('set signcolumn=auto:1-3')
screen:expect([[
- {2: }{6: 1 }a |
- {2: }{6: 2 }b |
- {2: }{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {7: }{8: 1 }a |
+ {7: }{8: 2 }b |
+ {7: }{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
-- should support up to 8 signs at minimum
exec('set signcolumn=auto:8-9')
screen:expect([[
- {2: }{6: 1 }a |
- {2: }{6: 2 }b |
- {2: }{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {7: }{8: 1 }a |
+ {7: }{8: 2 }b |
+ {7: }{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
-- should keep the same sign size when signs are not exceeding
@@ -313,11 +301,11 @@ describe('Signs', function()
exec('sign define pietSearch text=>> texthl=Search')
exec('sign place 1 line=1 name=pietSearch buffer=1')
screen:expect([[
- {1:>>}{2: }{6: 1 }a |
- {2: }{6: 2 }b |
- {2: }{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {10:>>}{7: }{8: 1 }a |
+ {7: }{8: 2 }b |
+ {7: }{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
-- should resize itself when signs are exceeding minimum but
@@ -328,11 +316,11 @@ describe('Signs', function()
sign place 4 line=1 name=pietSearch buffer=1
]])
screen:expect([[
- {1:>>>>>>>>}{6: 1 }a |
- {2: }{6: 2 }b |
- {2: }{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {10:>>>>>>>>}{8: 1 }a |
+ {7: }{8: 2 }b |
+ {7: }{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
-- should not increase size because sign with existing id is moved
@@ -340,11 +328,11 @@ describe('Signs', function()
screen:expect_unchanged()
exec('sign unplace 4')
screen:expect([[
- {1:>>>>>>}{6: 1 }a |
- {2: }{6: 2 }b |
- {2: }{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {10:>>>>>>}{8: 1 }a |
+ {7: }{8: 2 }b |
+ {7: }{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
exec('sign place 4 line=1 name=pietSearch buffer=1')
@@ -357,11 +345,11 @@ describe('Signs', function()
sign place 8 line=1 name=pietSearch buffer=1
]])
screen:expect([[
- {1:>>>>>>>>>>}{6: 1 }a |
- {2: }{6: 2 }b |
- {2: }{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {10:>>>>>>>>>>}{8: 1 }a |
+ {7: }{8: 2 }b |
+ {7: }{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
end)
@@ -377,21 +365,21 @@ describe('Signs', function()
]])
-- no signcolumn with only empty sign
screen:expect([[
- {6: 1 }a |
- {6: 2 }b |
- {6: 3 }c |
- {6: 4 }^ |
- {0:~ }|*9
+ {8: 1 }a |
+ {8: 2 }b |
+ {8: 3 }c |
+ {8: 4 }^ |
+ {1:~ }|*9
|
]])
-- single column with 1 sign with text and one sign without
exec('sign place 1 line=1 name=pietSearch buffer=1')
screen:expect([[
- {1:>>}{6: 1 }a |
- {2: }{6: 2 }b |
- {2: }{6: 3 }c |
- {2: }{6: 4 }^ |
- {0:~ }|*9
+ {10:>>}{8: 1 }a |
+ {7: }{8: 2 }b |
+ {7: }{8: 3 }c |
+ {7: }{8: 4 }^ |
+ {1:~ }|*9
|
]])
end)
@@ -408,23 +396,23 @@ describe('Signs', function()
-- line number should be drawn if sign has no text
-- no signcolumn, line number for "a" is Search, for "b" is Error, for "c" is LineNr
screen:expect([[
- {1: >> }a |
- {8: 2 }b |
- {6: 3 }c |
- {6: 4 }^ |
- {0:~ }|*9
+ {10: >> }a |
+ {9: 2 }b |
+ {8: 3 }c |
+ {8: 4 }^ |
+ {1:~ }|*9
|
]])
-- number column on wrapped part of a line should be empty
feed('gg100aa<Esc>')
screen:expect([[
- {1: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {8: }aa^a |
- {8: 2 }b |
- {6: 3 }c |
- {6: 4 } |
- {0:~ }|*7
+ {10: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {9: }aa^a |
+ {9: 2 }b |
+ {8: 3 }c |
+ {8: 4 } |
+ {1:~ }|*7
|
]])
api.nvim_buf_set_extmark(0, api.nvim_create_namespace('test'), 0, 0, {
@@ -434,14 +422,14 @@ describe('Signs', function()
feed('<C-Y>')
-- number column on virtual lines should be empty
screen:expect([[
- {6: }VIRT LINES |
- {1: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {8: }aa^a |
- {8: 2 }b |
- {6: 3 }c |
- {6: 4 } |
- {0:~ }|*6
+ {8: }VIRT LINES |
+ {10: >> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {9: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {9: }aa^a |
+ {9: 2 }b |
+ {8: 3 }c |
+ {8: 4 } |
+ {1:~ }|*6
|
]])
end)
@@ -451,21 +439,21 @@ describe('Signs', function()
exec('sign place 100000 line=1 name=piet buffer=1')
feed(':sign place<cr>')
screen:expect([[
- {1:>>} |
- {0:~ }|*6
- {4: }|
+ {10:>>} |
+ {1:~ }|*6
+ {3: }|
:sign place |
- {9:--- Signs ---} |
- {10:Signs for [NULL]:} |
+ {100:--- Signs ---} |
+ {18:Signs for [NULL]:} |
line=1 id=100000 name=piet priority=10 |
|
- {11:Press ENTER or type command to continue}^ |
+ {6:Press ENTER or type command to continue}^ |
]])
feed('<cr>')
screen:expect([[
- {1:>>}^ |
- {0:~ }|*12
+ {10:>>}^ |
+ {1:~ }|*12
|
]])
end)
@@ -479,11 +467,11 @@ describe('Signs', function()
exec('2delete')
exec('sign unplace 10001')
screen:expect([[
- {2: }a |
- {2: }^c |
- {2: }d |
+ {7: }a |
+ {7: }^c |
+ {7: }d |
>>e |
- {0:~ }|*9
+ {1:~ }|*9
|
]])
exec('sign unplace 10002')
@@ -492,7 +480,7 @@ describe('Signs', function()
^c |
d |
e |
- {0:~ }|*9
+ {1:~ }|*9
|
]])
end)
@@ -505,13 +493,13 @@ describe('Signs', function()
exec('copy .')
exec('sign unplace 10001')
screen:expect([[
- {2: }a |
- {2: }^a |
- {2: }b |
- {2: }c |
- {2: }d |
+ {7: }a |
+ {7: }^a |
+ {7: }b |
+ {7: }c |
+ {7: }d |
>>e |
- {0:~ }|*7
+ {1:~ }|*7
|
]])
exec('sign unplace 10002')
@@ -522,7 +510,7 @@ describe('Signs', function()
c |
d |
e |
- {0:~ }|*7
+ {1:~ }|*7
|
]])
end)
@@ -537,9 +525,9 @@ describe('Signs', function()
call sign_place(0, '', 'foo', bufnr(''), { 'lnum':2 })
]])
screen:expect([[
- {8: 1 }^line1 |
- {8: 2 }line2 |
- {6: 3 }line3 |
+ {9: 1 }^line1 |
+ {9: 2 }line2 |
+ {8: 3 }line3 |
|
]])
end)
@@ -561,11 +549,11 @@ describe('Signs', function()
exec('norm 2Gdd')
exec('silent undo')
screen:expect([[
- {2: }1 |
+ {7: }1 |
S1^2 |
- {2: }3 |
- {2: }4 |
- {0:~ }|*9
+ {7: }3 |
+ {7: }4 |
+ {1:~ }|*9
|
]])
end)
@@ -590,7 +578,7 @@ describe('Signs', function()
local s1 = {
grid = [[
S2^ |
- {0:~ }|*12
+ {1:~ }|*12
|
]],
}
@@ -600,7 +588,7 @@ describe('Signs', function()
screen:expect({
grid = [[
S2S1^ |
- {0:~ }|*12
+ {1:~ }|*12
|
]],
})
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua
index da112148cd..86d5a362e5 100644
--- a/test/functional/ui/spell_spec.lua
+++ b/test/functional/ui/spell_spec.lua
@@ -17,7 +17,6 @@ describe("'spell'", function()
before_each(function()
clear()
screen = Screen.new(80, 8)
- screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { special = Screen.colors.Red, undercurl = true },
@@ -377,4 +376,83 @@ describe("'spell'", function()
|
]])
end)
+
+ it('overrides syntax when Visual selection is active', function()
+ screen:try_resize(43, 3)
+ screen:set_default_attr_ids({
+ [0] = { bold = true, foreground = Screen.colors.Blue },
+ [1] = { foreground = Screen.colors.Blue },
+ [2] = { foreground = Screen.colors.Red },
+ [3] = { foreground = Screen.colors.Blue, underline = true },
+ [4] = { foreground = Screen.colors.Red, underline = true },
+ [5] = { bold = true },
+ })
+ exec([[
+ hi! Comment guibg=NONE guifg=Blue gui=NONE guisp=NONE
+ hi! SpellBad guibg=NONE guifg=Red gui=NONE guisp=NONE
+ hi! Visual guibg=NONE guifg=NONE gui=underline guisp=NONE
+ syn match Comment "//.*"
+ call setline(1, '// Here is a misspeld word.')
+ set spell
+ ]])
+ screen:expect([[
+ {1:^// Here is a }{2:misspeld}{1: word.} |
+ {0:~ }|
+ |
+ ]])
+ feed('V')
+ screen:expect([[
+ {1:^/}{3:/ Here is a }{4:misspeld}{3: word.} |
+ {0:~ }|
+ {5:-- VISUAL LINE --} |
+ ]])
+ end)
+
+ it("global value works properly for 'spelloptions'", function()
+ screen:try_resize(43, 3)
+ exec('set spell')
+ -- :setglobal applies to future buffers but not current buffer
+ exec('setglobal spelloptions=camel')
+ insert('Here is TheCamelWord being spellchecked')
+ screen:expect([[
+ Here is {1:TheCamelWord} being spellchecke^d |
+ {0:~ }|
+ |
+ ]])
+ exec('enew')
+ insert('There is TheCamelWord being spellchecked')
+ screen:expect([[
+ There is TheCamelWord being spellchecke^d |
+ {0:~ }|
+ |
+ ]])
+ -- :setlocal applies to current buffer but not future buffers
+ exec('setlocal spelloptions=')
+ screen:expect([[
+ There is {1:TheCamelWord} being spellchecke^d |
+ {0:~ }|
+ |
+ ]])
+ exec('enew')
+ insert('What is TheCamelWord being spellchecked')
+ screen:expect([[
+ What is TheCamelWord being spellchecke^d |
+ {0:~ }|
+ |
+ ]])
+ -- :set applies to both current buffer and future buffers
+ exec('set spelloptions=')
+ screen:expect([[
+ What is {1:TheCamelWord} being spellchecke^d |
+ {0:~ }|
+ |
+ ]])
+ exec('enew')
+ insert('Where is TheCamelWord being spellchecked')
+ screen:expect([[
+ Where is {1:TheCamelWord} being spellchecke^d |
+ {0:~ }|
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua
index b4d4c94a5e..268e7173e6 100644
--- a/test/functional/ui/statuscolumn_spec.lua
+++ b/test/functional/ui/statuscolumn_spec.lua
@@ -20,7 +20,6 @@ describe('statuscolumn', function()
before_each(function()
clear('--cmd', 'set number nuw=1 | call setline(1, repeat(["aaaaa"], 16)) | norm GM')
screen = Screen.new()
- screen:attach()
exec_lua('ns = vim.api.nvim_create_namespace("")')
end)
@@ -235,30 +234,24 @@ describe('statuscolumn', function()
it('works with wrapped lines, signs and folds', function()
command([[set stc=%C%s%=%{v:virtnum?'':v:lnum}│\ ]])
command("call setline(1,repeat([repeat('aaaaa',10)],16))")
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue },
- [1] = { foreground = Screen.colors.Brown },
- [2] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGrey },
- [3] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey },
- [4] = { bold = true, foreground = Screen.colors.Brown },
- [5] = { foreground = Screen.colors.Red },
- [6] = { foreground = Screen.colors.Red, background = Screen.colors.LightGrey },
- })
+ screen:add_extra_attr_ids {
+ [100] = { foreground = Screen.colors.Red, background = Screen.colors.LightGray },
+ }
command('hi! CursorLine guifg=Red guibg=NONE')
screen:expect([[
- {1: 4│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1: │ }a |
- {1: 5│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1: │ }a |
- {1: 6│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1: │ }a |
- {1: 7│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1: │ }a |
- {1: 8│ }^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1: │ }a |
- {1: 9│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1: │ }a |
- {1:10│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{0:@@@}|
+ {8: 4│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8: │ }a |
+ {8: 5│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8: │ }a |
+ {8: 6│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8: │ }a |
+ {8: 7│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8: │ }a |
+ {8: 8│ }^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8: │ }a |
+ {8: 9│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8: │ }a |
+ {8:10│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:@@@}|
|
]])
command([[set stc=%C%s%=%l│\ ]])
@@ -271,108 +264,108 @@ describe('statuscolumn', function()
command('sign place 3 line=6 name=piet1 buffer=1')
command('sign place 4 line=6 name=piet2 buffer=1')
screen:expect([[
- {1:>>}{2: }{1: 4│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │ }aaaaa |
- {0:>!}{2: }{1: 5│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │ }aaaaa |
- {0:>!}{1:>> 6│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │ }aaaaa |
- {2: }{1: 7│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │ }aaaaa |
- {2: }{1: 8│ }^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │ }aaaaa |
- {2: }{1: 9│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │ }aaaaa |
- {2: }{1:10│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{0:@@@}|
+ {8:>>}{7: }{8: 4│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │ }aaaaa |
+ {1:>!}{7: }{8: 5│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │ }aaaaa |
+ {1:>!}{8:>> 6│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │ }aaaaa |
+ {7: }{8: 7│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │ }aaaaa |
+ {7: }{8: 8│ }^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │ }aaaaa |
+ {7: }{8: 9│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │ }aaaaa |
+ {7: }{8:10│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{1:@@@}|
|
]])
command('norm zf$')
-- Check that alignment works properly with signs after %=
command([[set stc=%C%=%{v:virtnum?'':v:lnum}│%s\ ]])
screen:expect([[
- {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2: }{1: 5│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2: }{1: 6│}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2: }{1: 7│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2:+}{1: 8│}{2: }{1: }{3:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: }{1: 9│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2: }{1:10│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
+ {7: }{8: 4│>>}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7: }{8: 5│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7: }{8: 6│}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7: }{8: 7│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7:+}{8: 8│}{7: }{8: }{13:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: }{8: 9│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7: }{8:10│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
|
]])
command('set cursorline')
screen:expect([[
- {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2: }{1: 5│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2: }{1: 6│}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2: }{1: 7│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2:+}{4: 8│}{2: }{4: }{6:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: }{1: 9│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
- {2: }{1:10│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaa |
+ {7: }{8: 4│>>}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7: }{8: 5│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7: }{8: 6│}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7: }{8: 7│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7:+}{15: 8│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: }{8: 9│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
+ {7: }{8:10│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaa |
|
]])
-- v:lnum is the same value on wrapped lines
command([[set stc=%C%=%{v:lnum}│%s\ ]])
screen:expect([[
- {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 4│}{2: }{1: }aaaaaa |
- {2: }{1: 5│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 5│}{2: }{1: }aaaaaa |
- {2: }{1: 6│}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 6│}{2: }{1: }aaaaaa |
- {2: }{1: 7│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 7│}{2: }{1: }aaaaaa |
- {2:+}{4: 8│}{2: }{4: }{6:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: }{1: 9│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 9│}{2: }{1: }aaaaaa |
- {2: }{1:10│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1:10│}{2: }{1: }aaaaaa |
+ {7: }{8: 4│>>}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 4│}{7: }{8: }aaaaaa |
+ {7: }{8: 5│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 5│}{7: }{8: }aaaaaa |
+ {7: }{8: 6│}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 6│}{7: }{8: }aaaaaa |
+ {7: }{8: 7│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 7│}{7: }{8: }aaaaaa |
+ {7:+}{15: 8│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: }{8: 9│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 9│}{7: }{8: }aaaaaa |
+ {7: }{8:10│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8:10│}{7: }{8: }aaaaaa |
|
]])
-- v:relnum is the same value on wrapped lines
command([[set stc=%C%=\ %{v:relnum}│%s\ ]])
screen:expect([[
- {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 4│}{2: }{1: }aaaaaaa |
- {2: }{1: 3│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 3│}{2: }{1: }aaaaaaa |
- {2: }{1: 2│}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 2│}{2: }{1: }aaaaaaa |
- {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 1│}{2: }{1: }aaaaaaa |
- {2:+}{4: 0│}{2: }{4: }{6:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 1│}{2: }{1: }aaaaaaa |
- {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: 2│}{2: }{1: }aaaaaaa |
+ {7: }{8: 4│>>}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 4│}{7: }{8: }aaaaaaa |
+ {7: }{8: 3│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 3│}{7: }{8: }aaaaaaa |
+ {7: }{8: 2│}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 2│}{7: }{8: }aaaaaaa |
+ {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 1│}{7: }{8: }aaaaaaa |
+ {7:+}{15: 0│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 1│}{7: }{8: }aaaaaaa |
+ {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: 2│}{7: }{8: }aaaaaaa |
|
]])
command([[set stc=%C%=\ %{v:virtnum?'':v:relnum}│%s\ ]])
screen:expect([[
- {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaa |
- {2: }{1: 3│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaa |
- {2: }{1: 2│}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaa |
- {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaa |
- {2:+}{4: 0│}{2: }{4: }{6:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaa |
- {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaa |
+ {7: }{8: 4│>>}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaa |
+ {7: }{8: 3│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaa |
+ {7: }{8: 2│}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaa |
+ {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaa |
+ {7:+}{15: 0│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaa |
+ {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaa |
|
]])
-- Up to 9 signs in a line
@@ -385,75 +378,75 @@ describe('statuscolumn', function()
command('sign place 10 line=6 name=piet2 buffer=1')
command('sign place 11 line=6 name=piet1 buffer=1')
screen:expect([[
- {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 3│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 2│>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaaa |
- {2:+}{4: 0│}{2: }{4: }{6:^+-- 1 line: aaaaaaaaaaaaaaaa}|
- {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 4│>>}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 3│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 2│>>}{1:>!}{8:>>}{1:>!}{8:>>}{1:>!}{8:>>}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
+ {7:+}{15: 0│}{7: }{15: }{100:^+-- 1 line: aaaaaaaaaaaaaaaa}|
+ {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }{8: │}{7: }{8: }aaaaaaaaaaaaaaaaaaaaa |
|
]])
-- Also test fold and sign column when 'cpoptions' includes "n"
command('set cpoptions+=n')
feed('Hgjg0')
screen:expect([[
- {2: }{4: 0│}{1:>>}{2: }{4: }{5:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: }{5:^aaaaaaaaaaaaaaaaaaaaa }|
- {2: }{1: 3│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 2│>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
- {2:+}{1: 4│}{2: }{1: }{3:+-- 1 line: aaaaaaaaaaaaaaaa}|
- {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{15: 0│}{8:>>}{7: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: }{19:^aaaaaaaaaaaaaaaaaaaaa }|
+ {7: }{8: 3│}{1:>!}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 2│>>}{1:>!}{8:>>}{1:>!}{8:>>}{1:>!}{8:>>}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
+ {7:+}{8: 4│}{7: }{8: }{13:+-- 1 line: aaaaaaaaaaaaaaaa}|
+ {7: }{8: 1│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
|
]])
command('set breakindent')
command('sign unplace 2')
feed('J2gjg0')
screen:expect([[
- {2: }{4: 0│}{1:>>}{2: }{4: }{5:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: } {5:aaaaaaaaaaaaaaaaaaaaa aaaaaaa}|
- {2: } {5:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: } {5:^aaaaaaaaaaaaaa }|
- {2: }{1: 1│>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: } aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: } aaaaaaaaaaaaaaaaaaaaa |
- {2:+}{1: 3│}{2: }{1: }{3:+-- 1 line: aaaaaaaaaaaaaaaa}|
- {2: }{1: 4│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: } aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 5│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: } aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{15: 0│}{8:>>}{7: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: } {19:aaaaaaaaaaaaaaaaaaaaa aaaaaaa}|
+ {7: } {19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: } {19:^aaaaaaaaaaaaaa }|
+ {7: }{8: 1│>>}{1:>!}{8:>>}{1:>!}{8:>>}{1:>!}{8:>>}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: } aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: } aaaaaaaaaaaaaaaaaaaaa |
+ {7:+}{8: 3│}{7: }{8: }{13:+-- 1 line: aaaaaaaaaaaaaaaa}|
+ {7: }{8: 4│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: } aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 5│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: } aaaaaaaaaaaaaaaaaaaaa |
|
]])
command('set nobreakindent')
feed('$g0')
screen:expect([[
- {2: }{4: 0│}{1:>>}{2: }{4: }{5:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: }{5:aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaa}|
- {2: }{5:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {2: }{5:^aaaa }|
- {2: }{1: 1│>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
- {2:+}{1: 3│}{2: }{1: }{3:+-- 1 line: aaaaaaaaaaaaaaaa}|
- {2: }{1: 4│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
- {2: }{1: 5│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {2: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{15: 0│}{8:>>}{7: }{15: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: }{19:aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaa}|
+ {7: }{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {7: }{19:^aaaa }|
+ {7: }{8: 1│>>}{1:>!}{8:>>}{1:>!}{8:>>}{1:>!}{8:>>}{1:>!}{8:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 2│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
+ {7:+}{8: 3│}{7: }{8: }{13:+-- 1 line: aaaaaaaaaaaaaaaa}|
+ {7: }{8: 4│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
+ {7: }{8: 5│}{7: }{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {7: }aaaaaaaaaaaaaaaaaaaaa |
|
]])
command('silent undo')
@@ -467,38 +460,38 @@ describe('statuscolumn', function()
]])
command('set foldcolumn=0 signcolumn=number stc=%l')
screen:expect([[
- {1:>>}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1: 5}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1: }virt_line |
- {1: }virt_line above |
- {1:>>}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1: 7}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {4: 8}{6:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {1: 9}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1:10}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1:11}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1:12}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1:13}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1:14}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8:>>}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8: 5}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8: }virt_line |
+ {8: }virt_line above |
+ {8:>>}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8: 7}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {15: 8}{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {8: 9}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8:10}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8:11}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8:12}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8:13}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8:14}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
|
]])
command(
[[set stc=%{v:virtnum<0?'virtual':(!v:virtnum?'buffer':'wrapped')}%=%{'\ '.v:virtnum.'\ '.v:lnum}]]
)
screen:expect([[
- {1:buffer 0 4}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 4}aaaaaaaa |
- {1:buffer 0 5}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 5}aaaaaaaa |
- {1:virtual-2 5}virt_line |
- {1:virtual-1 5}virt_line above |
- {1:buffer 0 6}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 6}aaaaaaaa |
- {1:buffer 0 7}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 7}aaaaaaaa |
- {4:buffer 0 8}{6:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {1:buffer 0 9}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 9}aaaaaaaa |
+ {8:buffer 0 4}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 4}aaaaaaaa |
+ {8:buffer 0 5}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 5}aaaaaaaa |
+ {8:virtual-2 5}virt_line |
+ {8:virtual-1 5}virt_line above |
+ {8:buffer 0 6}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 6}aaaaaaaa |
+ {8:buffer 0 7}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 7}aaaaaaaa |
+ {15:buffer 0 8}{100:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {8:buffer 0 9}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 9}aaaaaaaa |
|
]])
-- Also test virt_lines at the end of buffer
@@ -507,17 +500,17 @@ describe('statuscolumn', function()
]])
feed('GkJzz')
screen:expect([[
- {1:buffer 0 12}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 12}aaaaaaaaa |
- {1:buffer 0 13}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 13}aaaaaaaaa |
- {1:buffer 0 14}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 14}aaaaaaaaa |
- {4:buffer 0 15}{5:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {4:wrapped 1 15}{5:aaaaaaaaa^ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {4:wrapped 2 15}{5:aaaaaaaaaaaaaaaaaaa }|
- {1:virtual-1 15}END |
- {0:~ }|*3
+ {8:buffer 0 12}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 12}aaaaaaaaa |
+ {8:buffer 0 13}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 13}aaaaaaaaa |
+ {8:buffer 0 14}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 14}aaaaaaaaa |
+ {15:buffer 0 15}{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {15:wrapped 1 15}{19:aaaaaaaaa^ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {15:wrapped 2 15}{19:aaaaaaaaaaaaaaaaaaa }|
+ {8:virtual-1 15}END |
+ {1:~ }|*3
|
]])
-- Also test virt_lines when 'cpoptions' includes "n"
@@ -527,19 +520,19 @@ describe('statuscolumn', function()
vim.api.nvim_buf_set_extmark(0, ns, 14, 0, { virt_lines = {{{"virt_line2", ""}}} })
]])
screen:expect([[
- {1:buffer 0 12}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:buffer 0 12}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaa |
- {1:buffer 0 13}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:buffer 0 13}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaa |
- {1:buffer 0 14}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:buffer 0 14}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaa |
- {4:buffer 0 15}{5:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {5:aaaaaaaaa^ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
- {5:aaaaaaa }|
- {1:virtual-3 15}virt_line1 |
- {1:virtual-2 15}virt_line2 |
- {1:virtual-1 15}END |
- {0:~ }|
+ {15:buffer 0 15}{19:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {19:aaaaaaaaa^ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}|
+ {19:aaaaaaa }|
+ {8:virtual-3 15}virt_line1 |
+ {8:virtual-2 15}virt_line2 |
+ {8:virtual-1 15}END |
+ {1:~ }|
|
]])
-- Also test "col_rows" code path for 'relativenumber' cursor movement
@@ -548,36 +541,36 @@ describe('statuscolumn', function()
set stc=%{v:virtnum<0?'virtual':(!v:virtnum?'buffer':'wrapped')}%=%{'\ '.v:virtnum.'\ '.v:lnum.'\ '.v:relnum}
]])
screen:expect([[
- {1:buffer 0 12 3}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 12 3}aaaaaaaaaaa |
- {1:buffer 0 13 2}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 13 2}aaaaaaaaaaa |
- {1:buffer 0 14 1}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 14 1}aaaaaaaaaaa |
- {1:buffer 0 15 0}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 15 0}aaaaaaaaaaa^ aaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 2 15 0}aaaaaaaaaaaaaaaaaaaaaaa |
- {1:virtual-3 15 0}virt_line1 |
- {1:virtual-2 15 0}virt_line2 |
- {1:virtual-1 15 0}END |
- {0:~ }|
+ {8:buffer 0 12 3}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 12 3}aaaaaaaaaaa |
+ {8:buffer 0 13 2}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 13 2}aaaaaaaaaaa |
+ {8:buffer 0 14 1}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 14 1}aaaaaaaaaaa |
+ {8:buffer 0 15 0}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 15 0}aaaaaaaaaaa^ aaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 2 15 0}aaaaaaaaaaaaaaaaaaaaaaa |
+ {8:virtual-3 15 0}virt_line1 |
+ {8:virtual-2 15 0}virt_line2 |
+ {8:virtual-1 15 0}END |
+ {1:~ }|
|
]])
feed('kk')
screen:expect([[
- {1:buffer 0 12 1}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 12 1}aaaaaaaaaaa |
- {1:buffer 0 13 0}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 13 0}aaaaaaaaaa^a |
- {1:buffer 0 14 1}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 14 1}aaaaaaaaaaa |
- {1:buffer 0 15 2}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 1 15 2}aaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaa|
- {1:wrapped 2 15 2}aaaaaaaaaaaaaaaaaaaaaaa |
- {1:virtual-3 15 2}virt_line1 |
- {1:virtual-2 15 2}virt_line2 |
- {1:virtual-1 15 2}END |
- {0:~ }|
+ {8:buffer 0 12 1}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 12 1}aaaaaaaaaaa |
+ {8:buffer 0 13 0}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 13 0}aaaaaaaaaa^a |
+ {8:buffer 0 14 1}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 14 1}aaaaaaaaaaa |
+ {8:buffer 0 15 2}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 1 15 2}aaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaa|
+ {8:wrapped 2 15 2}aaaaaaaaaaaaaaaaaaaaaaa |
+ {8:virtual-3 15 2}virt_line1 |
+ {8:virtual-2 15 2}virt_line2 |
+ {8:virtual-1 15 2}END |
+ {1:~ }|
|
]])
end)
@@ -680,10 +673,6 @@ describe('statuscolumn', function()
it('popupmenu callback does not drag mouse on close', function()
screen:try_resize(screen._width, 2)
- screen:set_default_attr_ids({
- [0] = { foreground = Screen.colors.Brown },
- [1] = { background = Screen.colors.Plum1 },
- })
api.nvim_set_option_value('statuscolumn', '%0@MyClickFunc@%l%T', {})
exec([[
function! MyClickFunc(minwid, clicks, button, mods)
@@ -695,26 +684,26 @@ describe('statuscolumn', function()
-- clicking an item does not drag mouse
api.nvim_input_mouse('left', 'press', '', 0, 0, 0)
screen:expect([[
- {0: 8}^aaaaa |
- {1: Echo } |
+ {8: 8}^aaaaa |
+ {4: Echo } |
]])
api.nvim_input_mouse('left', 'press', '', 0, 1, 5)
api.nvim_input_mouse('left', 'release', '', 0, 1, 5)
screen:expect([[
- {0: 8}^aaaaa |
+ {8: 8}^aaaaa |
0 1 l 8 |
]])
command('echo')
-- clicking outside to close the menu does not drag mouse
api.nvim_input_mouse('left', 'press', '', 0, 0, 0)
screen:expect([[
- {0: 8}^aaaaa |
- {1: Echo } |
+ {8: 8}^aaaaa |
+ {4: Echo } |
]])
api.nvim_input_mouse('left', 'press', '', 0, 0, 10)
api.nvim_input_mouse('left', 'release', '', 0, 0, 10)
screen:expect([[
- {0: 8}^aaaaa |
+ {8: 8}^aaaaa |
|
]])
end)
@@ -943,16 +932,15 @@ describe('statuscolumn', function()
it('does not wrap multibyte characters at the end of a line', function()
screen:try_resize(33, 4)
- screen:set_default_attr_ids {
- [8] = { foreground = Screen.colors.Brown },
- [31] = { undercurl = true, special = Screen.colors.Red },
+ screen:add_extra_attr_ids {
+ [100] = { undercurl = true, special = Screen.colors.Red },
}
command([[set spell stc=%l\ ]])
command('call setline(8, "This is a line that contains ᶏ multibyte character.")')
screen:expect([[
- {8: 8 }^This is a line that contains {31:ᶏ}|
- {8: } {31:multibyte} character. |
- {8: 9 }{31:aaaaa} |
+ {8: 8 }^This is a line that contains {100:ᶏ}|
+ {8: } {100:multibyte} character. |
+ {8: 9 }{100:aaaaa} |
|
]])
end)
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua
index 937e709d66..1d0f181244 100644
--- a/test/functional/ui/statusline_spec.lua
+++ b/test/functional/ui/statusline_spec.lua
@@ -24,11 +24,9 @@ for _, model in ipairs(mousemodels) do
before_each(function()
clear()
screen = Screen.new(40, 8)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [1] = { bold = true, reverse = true }, -- StatusLine
- })
- screen:attach()
+ screen:add_extra_attr_ids {
+ [100] = { bold = true, reverse = true, foreground = Screen.colors.Blue },
+ }
command('set laststatus=2 mousemodel=' .. model)
exec([=[
function! MyClickFunc(minwid, clicks, button, mods)
@@ -86,8 +84,8 @@ for _, model in ipairs(mousemodels) do
screen:expect {
grid = [[
^ |
- {0:~ }|*5
- {1:^I}{0:^A^I^A^I}{1:^A }|
+ {1:~ }|*5
+ {3:^I}{100:^A^I^A^I}{3:^A }|
|
]],
}
@@ -210,8 +208,8 @@ for _, model in ipairs(mousemodels) do
screen:expect {
grid = [[
^ │ |
- {0:~ }│{0:~ }|*5
- {1:Clicky stuff Clicky stuff}|
+ {1:~ }│{1:~ }|*5
+ {3:Clicky stuff Clicky stuff}|
|
]],
}
@@ -255,14 +253,9 @@ describe('global statusline', function()
before_each(function()
clear()
screen = Screen.new(60, 16)
- screen:attach()
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Blue },
- [2] = { bold = true, reverse = true },
- [3] = { bold = true },
- [4] = { reverse = true },
- [5] = { bold = true, foreground = Screen.colors.Fuchsia },
- })
+ screen:add_extra_attr_ids {
+ [100] = { foreground = Screen.colors.Magenta1, bold = true },
+ }
command('set laststatus=3')
command('set ruler')
end)
@@ -271,7 +264,7 @@ describe('global statusline', function()
screen:expect([[
^ |
{1:~ }|*13
- {2:[No Name] 0,0-1 All}|
+ {3:[No Name] 0,0-1 All}|
|
]])
@@ -280,8 +273,8 @@ describe('global statusline', function()
|*2
^ |
{1:~ }|*11
- {2:[No Name] [+] 3,1 All}|
- {3:-- INSERT --} |
+ {3:[No Name] [+] 3,1 All}|
+ {5:-- INSERT --} |
]])
end)
@@ -298,7 +291,7 @@ describe('global statusline', function()
────────────────────┴────────────────┴─┤{1:~ }|
│{1:~ }|
{1:~ }│{1:~ }|*3
- {2:[No Name] 0,0-1 All}|
+ {3:[No Name] 0,0-1 All}|
|
]])
end)
@@ -315,7 +308,7 @@ describe('global statusline', function()
screen:expect([[
^ |
{1:~ }|*13
- {2:[No Name] 0,0-1 All}|
+ {3:[No Name] 0,0-1 All}|
|
]])
@@ -324,15 +317,15 @@ describe('global statusline', function()
screen:expect([[
│ │ │^ |
{1:~ }│{1:~ }│{1:~}│{1:~ }|*3
- {1:~ }│{4:< Name] 0,0-1 }│{1:~}│{1:~ }|
+ {1:~ }│{2:< Name] 0,0-1 }│{1:~}│{1:~ }|
{1:~ }│ │{1:~}│{1:~ }|
{1:~ }│{1:~ }│{1:~}│{1:~ }|
- {1:~ }│{1:~ }│{1:~}│{2:<No Name] 0,0-1 All}|
+ {1:~ }│{1:~ }│{1:~}│{3:<No Name] 0,0-1 All}|
{1:~ }│{1:~ }│{1:~}│ |
- {4:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }|
+ {2:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }|
│{1:~ }|
{1:~ }│{1:~ }|*3
- {4:[No Name] 0,0-1 All <No Name] 0,0-1 All}|
+ {2:[No Name] 0,0-1 All <No Name] 0,0-1 All}|
|
]])
@@ -348,7 +341,7 @@ describe('global statusline', function()
────────────────────┴────────────────┴─┤{1:~ }|
│{1:~ }|
{1:~ }│{1:~ }|*3
- {2:[No Name] 0,0-1 All}|
+ {3:[No Name] 0,0-1 All}|
|
]])
@@ -356,12 +349,12 @@ describe('global statusline', function()
screen:expect([[
│ │ │^ |
{1:~ }│{1:~ }│{1:~}│{1:~ }|*3
- {1:~ }│{4:< Name] 0,0-1 }│{1:~}│{1:~ }|
+ {1:~ }│{2:< Name] 0,0-1 }│{1:~}│{1:~ }|
{1:~ }│ │{1:~}│{1:~ }|
{1:~ }│{1:~ }│{1:~}│{1:~ }|
- {1:~ }│{1:~ }│{1:~}│{2:<No Name] 0,0-1 All}|
+ {1:~ }│{1:~ }│{1:~}│{3:<No Name] 0,0-1 All}|
{1:~ }│{1:~ }│{1:~}│ |
- {4:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }|
+ {2:<No Name] 0,0-1 All < Name] 0,0-1 <}│{1:~ }|
│{1:~ }|
{1:~ }│{1:~ }|*4
0,0-1 All |
@@ -379,7 +372,7 @@ describe('global statusline', function()
────────────────────┴────────────────┴─┤{1:~ }|
│{1:~ }|
{1:~ }│{1:~ }|*3
- {2:[No Name] 0,0-1 All}|
+ {3:[No Name] 0,0-1 All}|
|
]])
end)
@@ -429,7 +422,7 @@ describe('global statusline', function()
0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSION;;;; |
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
^0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
- {2:test/functional/fixtures/bigfile.txt 7,1 Top}|
+ {3:test/functional/fixtures/bigfile.txt 7,1 Top}|
|
]])
feed('j')
@@ -444,12 +437,12 @@ describe('global statusline', function()
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
- {2:test/functional/fixtures/bigfile.txt 8,1 0%}|
+ {3:test/functional/fixtures/bigfile.txt 8,1 0%}|
|
]])
api.nvim_set_option_value('showtabline', 2, {})
screen:expect([[
- {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }|
+ {5: }{100:2}{5: t/f/f/bigfile.txt }{2: }|
|
{1:~ }|*5
────────────────────────────────────────────────────────────|
@@ -459,12 +452,12 @@ describe('global statusline', function()
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
- {2:test/functional/fixtures/bigfile.txt 8,1 0%}|
+ {3:test/functional/fixtures/bigfile.txt 8,1 0%}|
|
]])
api.nvim_set_option_value('cmdheight', 0, {})
screen:expect([[
- {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }|
+ {5: }{100:2}{5: t/f/f/bigfile.txt }{2: }|
|
{1:~ }|*5
────────────────────────────────────────────────────────────|
@@ -475,11 +468,11 @@ describe('global statusline', function()
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
- {2:test/functional/fixtures/bigfile.txt 8,1 0%}|
+ {3:test/functional/fixtures/bigfile.txt 8,1 0%}|
]])
api.nvim_set_option_value('cmdheight', 1, {})
screen:expect([[
- {3: }{5:2}{3: t/f/f/bigfile.txt }{4: }|
+ {5: }{100:2}{5: t/f/f/bigfile.txt }{2: }|
|
{1:~ }|*5
────────────────────────────────────────────────────────────|
@@ -489,7 +482,7 @@ describe('global statusline', function()
0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
^0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
- {2:test/functional/fixtures/bigfile.txt 8,1 0%}|
+ {3:test/functional/fixtures/bigfile.txt 8,1 0%}|
|
]])
end)
@@ -508,7 +501,7 @@ describe('global statusline', function()
────────────────────────────────────────────────────────────|
^ |
{1:~ }|*6
- {2:[No Name] 0,0-1 All}|
+ {3:[No Name] 0,0-1 All}|
|
]])
end)
@@ -525,11 +518,6 @@ end)
it('statusline is redrawn with :resize from <Cmd> mapping #19629', function()
clear()
local screen = Screen.new(40, 8)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [1] = { bold = true, reverse = true }, -- StatusLine
- })
- screen:attach()
exec([[
set laststatus=2
nnoremap <Up> <cmd>resize -1<CR>
@@ -538,15 +526,15 @@ it('statusline is redrawn with :resize from <Cmd> mapping #19629', function()
feed('<Up>')
screen:expect([[
^ |
- {0:~ }|*4
- {1:[No Name] }|
+ {1:~ }|*4
+ {3:[No Name] }|
|*2
]])
feed('<Down>')
screen:expect([[
^ |
- {0:~ }|*5
- {1:[No Name] }|
+ {1:~ }|*5
+ {3:[No Name] }|
|
]])
end)
@@ -554,19 +542,13 @@ end)
it('showcmdloc=statusline does not show if statusline is too narrow', function()
clear()
local screen = Screen.new(40, 8)
- screen:set_default_attr_ids({
- [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [1] = { bold = true, reverse = true }, -- StatusLine
- [2] = { reverse = true }, -- StatusLineNC
- })
- screen:attach()
command('set showcmd')
command('set showcmdloc=statusline')
command('1vsplit')
screen:expect([[
^ │ |
- {0:~}│{0:~ }|*5
- {1:< }{2:[No Name] }|
+ {1:~}│{1:~ }|*5
+ {3:< }{2:[No Name] }|
|
]])
feed('1234')
@@ -575,8 +557,7 @@ end)
it('K_EVENT does not trigger a statusline redraw unnecessarily', function()
clear()
- local screen = Screen.new(40, 8)
- screen:attach()
+ local _ = Screen.new(40, 8)
-- does not redraw on vim.schedule (#17937)
command([[
set laststatus=2
@@ -608,7 +589,6 @@ end)
it('statusline is redrawn on various state changes', function()
clear()
local screen = Screen.new(40, 4)
- screen:attach()
-- recording state change #22683
command('set ls=2 stl=%{repeat(reg_recording(),5)}')
@@ -674,7 +654,6 @@ end)
it('ruler is redrawn in cmdline with redrawstatus #22804', function()
clear()
local screen = Screen.new(40, 2)
- screen:attach()
command([[
let g:n = 'initial value'
set ls=1 ru ruf=%{g:n}
@@ -691,12 +670,6 @@ end)
it('shows correct ruler in cmdline with no statusline', function()
clear()
local screen = Screen.new(30, 8)
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [2] = { bold = true, reverse = true }, -- StatusLine
- [3] = { reverse = true }, -- StatusLineNC
- }
- screen:attach()
-- Use long ruler to check 'ruler' with 'rulerformat' set has correct width.
command [[
set ruler rulerformat=%{winnr()}longlonglong ls=0 winwidth=10
@@ -713,7 +686,7 @@ it('shows correct ruler in cmdline with no statusline', function()
screen:expect [[
^ |
{1:~ }|*2
- {2:[No Name] 1longlonglong }|
+ {3:[No Name] 1longlonglong }|
│ |
{1:~ }│{1:~ }|*2
3longlonglong |
@@ -724,7 +697,7 @@ it('shows correct ruler in cmdline with no statusline', function()
screen:expect [[
|
{1:~ }|*2
- {3:[No Name] 1longlonglong }|
+ {2:[No Name] 1longlonglong }|
^ │ |
{1:~ }│{1:~ }|*2
2longlonglong |
@@ -734,7 +707,7 @@ it('shows correct ruler in cmdline with no statusline', function()
screen:expect [[
|
{1:~ }|*2
- {3:[No Name] 1longlonglong }|
+ {2:[No Name] 1longlonglong }|
│^ |
{1:~ }│{1:~ }|*2
3longlonglong |
@@ -744,10 +717,6 @@ end)
it('uses "stl" and "stlnc" fillchars even if they are the same #19803', function()
clear()
local screen = Screen.new(53, 4)
- screen:attach()
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- })
command('hi clear StatusLine')
command('hi clear StatusLineNC')
command('vsplit')
@@ -764,19 +733,13 @@ end)
it('showcmdloc=statusline works with vertical splits', function()
clear()
local screen = Screen.new(53, 4)
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [2] = { bold = true, reverse = true }, -- StatusLine
- [3] = { reverse = true }, -- StatusLineNC
- }
- screen:attach()
command('rightbelow vsplit')
command('set showcmd showcmdloc=statusline')
feed('1234')
screen:expect([[
│^ |
{1:~ }│{1:~ }|
- {3:[No Name] }{2:[No Name] 1234 }|
+ {2:[No Name] }{3:[No Name] 1234 }|
|
]])
feed('<Esc>')
@@ -785,7 +748,7 @@ it('showcmdloc=statusline works with vertical splits', function()
screen:expect([[
│^ |
{1:~ }│{1:~ }|
- {2:[No Name] 1234 }|
+ {3:[No Name] 1234 }|
|
]])
end)
@@ -793,25 +756,19 @@ end)
it('keymap is shown with vertical splits #27269', function()
clear()
local screen = Screen.new(53, 4)
- screen:set_default_attr_ids {
- [1] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
- [2] = { bold = true, reverse = true }, -- StatusLine
- [3] = { reverse = true }, -- StatusLineNC
- }
- screen:attach()
command('setlocal keymap=dvorak')
command('rightbelow vsplit')
screen:expect([[
│^ |
{1:~ }│{1:~ }|
- {3:[No Name] <en-dv> }{2:[No Name] <en-dv> }|
+ {2:[No Name] <en-dv> }{3:[No Name] <en-dv> }|
|
]])
command('set laststatus=3')
screen:expect([[
│^ |
{1:~ }│{1:~ }|
- {2:[No Name] <en-dv> }|
+ {3:[No Name] <en-dv> }|
|
]])
end)
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index be35e9bf4f..57d76e54df 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -14,7 +14,6 @@ describe('Screen', function()
before_each(function()
clear()
screen = Screen.new(nil, 10)
- screen:attach()
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue },
[1] = { foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray },
diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua
index 5cda70df21..6d212823eb 100644
--- a/test/functional/ui/tabline_spec.lua
+++ b/test/functional/ui/tabline_spec.lua
@@ -13,8 +13,7 @@ describe('ui/ext_tabline', function()
before_each(function()
clear()
- screen = Screen.new(25, 5)
- screen:attach({ rgb = true, ext_tabline = true })
+ screen = Screen.new(25, 5, { rgb = true, ext_tabline = true })
function screen:_handle_tabline_update(curtab, tabs, curbuf, buffers)
event_curtab = curtab
event_tabs = tabs
@@ -100,7 +99,6 @@ describe('tabline', function()
before_each(function()
clear()
screen = Screen.new(42, 5)
- screen:attach()
end)
it('redraws when tabline option is set', function()
@@ -125,6 +123,26 @@ describe('tabline', function()
}
end)
+ it('combines highlight attributes', function()
+ screen:set_default_attr_ids({
+ [1] = { foreground = Screen.colors.Blue1, bold = true }, -- StatusLine
+ [2] = { bold = true, italic = true }, -- StatusLine
+ [3] = { bold = true, italic = true, foreground = Screen.colors.Red }, -- NonText combined with StatusLine
+ })
+ command('hi TabLineFill gui=bold,italic')
+ command('hi Identifier guifg=red')
+ command('set tabline=Test%#Identifier#here')
+ command('set showtabline=2')
+ screen:expect {
+ grid = [[
+ {2:Test}{3:here }|
+ ^ |
+ {1:~ }|*2
+ |
+ ]],
+ }
+ end)
+
it('click definitions do not leak memory #21765', function()
command('set tabline=%@MyClickFunc@MyClickText%T')
command('set showtabline=2')
@@ -196,4 +214,43 @@ describe('tabline', function()
api.nvim_input_mouse('middle', 'press', '', 0, 0, 1)
eq({ 1, 1 }, api.nvim_eval('[tabpagenr(), tabpagenr("$")]'))
end)
+
+ it('does not show floats with focusable=false', function()
+ screen:set_default_attr_ids({
+ [1] = { background = Screen.colors.Plum1 },
+ [2] = { underline = true, background = Screen.colors.LightGrey },
+ [3] = { bold = true },
+ [4] = { reverse = true },
+ [5] = { bold = true, foreground = Screen.colors.Blue1 },
+ [6] = { foreground = Screen.colors.Fuchsia, bold = true },
+ [7] = { foreground = Screen.colors.SeaGreen, bold = true },
+ })
+ command('tabnew')
+ api.nvim_open_win(0, false, {
+ focusable = false,
+ relative = 'editor',
+ height = 1,
+ width = 1,
+ row = 0,
+ col = 0,
+ })
+ screen:expect {
+ grid = [[
+ {1: }{2:[No Name] }{3: [No Name] }{4: }{2:X}|
+ ^ |
+ {5:~ }|*2
+ |
+ ]],
+ }
+ command('tabs')
+ screen:expect {
+ grid = [[
+ {6:Tab page 1} |
+ # [No Name] |
+ {6:Tab page 2} |
+ > [No Name] |
+ {7:Press ENTER or type command to continue}^ |
+ ]],
+ }
+ end)
end)
diff --git a/test/functional/ui/title_spec.lua b/test/functional/ui/title_spec.lua
index 3189232957..66eb15478b 100644
--- a/test/functional/ui/title_spec.lua
+++ b/test/functional/ui/title_spec.lua
@@ -18,7 +18,6 @@ describe('title', function()
before_each(function()
clear()
screen = Screen.new()
- screen:attach()
end)
it('has correct default title with unnamed file', function()
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 4d01b7a779..94710bfb74 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -19,7 +19,6 @@ describe("'wildmenu'", function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Yellow1, foreground = Screen.colors.Black },
}
- screen:attach()
end)
-- oldtest: Test_wildmenu_screendump()
@@ -492,7 +491,6 @@ describe('command line completion', function()
screen:add_extra_attr_ids {
[100] = { background = Screen.colors.Yellow1, foreground = Screen.colors.Black },
}
- screen:attach()
end)
after_each(function()
os.remove('Xtest-functional-viml-compl-dir')
@@ -592,8 +590,7 @@ describe('ui/ext_wildmenu', function()
before_each(function()
clear()
- screen = Screen.new(25, 5)
- screen:attach({ rgb = true, ext_wildmenu = true })
+ screen = Screen.new(25, 5, { rgb = true, ext_wildmenu = true })
end)
it('works with :sign <tab>', function()
diff --git a/test/functional/ui/winbar_spec.lua b/test/functional/ui/winbar_spec.lua
index fb907026a5..d1fd273dc1 100644
--- a/test/functional/ui/winbar_spec.lua
+++ b/test/functional/ui/winbar_spec.lua
@@ -18,7 +18,6 @@ describe('winbar', function()
before_each(function()
clear()
screen = Screen.new(60, 13)
- screen:attach()
screen:set_default_attr_ids({
[1] = { bold = true },
[2] = { reverse = true },
@@ -40,6 +39,16 @@ describe('winbar', function()
bold = true,
foreground = Screen.colors.Magenta,
},
+ [12] = {
+ underline = true,
+ background = Screen.colors.Red,
+ },
+ [13] = {
+ underline = true,
+ bold = true,
+ foreground = Screen.colors.Blue,
+ background = Screen.colors.Red,
+ },
})
api.nvim_set_option_value('winbar', 'Set Up The Bars', {})
end)
@@ -182,6 +191,18 @@ describe('winbar', function()
]])
end)
+ it('works with combined highlight attributes', function()
+ command('hi Winbar guibg=red gui=underline')
+ command('hi Identifier guifg=blue gui=bold')
+ command('set winbar=Lookatmy%#Identifier#highlights')
+ screen:expect([[
+ {12:Lookatmy}{13:highlights }|
+ ^ |
+ {3:~ }|*10
+ |
+ ]])
+ end)
+
it('can be ruler', function()
insert [[
just some
@@ -526,7 +547,6 @@ describe('local winbar with tabs', function()
before_each(function()
clear()
screen = Screen.new(60, 10)
- screen:attach()
api.nvim_set_option_value('winbar', 'foo', { scope = 'local', win = 0 })
end)
@@ -604,7 +624,6 @@ it('winbar works properly when redrawing is postponed #23534', function()
},
})
local screen = Screen.new(60, 6)
- screen:attach()
screen:expect([[
{5:(winbar) }|
^ |