aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/cmdline_spec.lua19
-rw-r--r--test/functional/ui/decorations_spec.lua34
-rw-r--r--test/functional/ui/float_spec.lua201
-rw-r--r--test/functional/ui/fold_spec.lua45
-rw-r--r--test/functional/ui/mouse_spec.lua4
-rw-r--r--test/functional/ui/multigrid_spec.lua1
6 files changed, 253 insertions, 51 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 4b92ab730d..6baad28dad 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -1275,6 +1275,7 @@ describe('cmdheight=0', function()
it('with multigrid', function()
clear{args={'--cmd', 'set cmdheight=0'}}
screen:attach{ext_multigrid=true}
+ meths.buf_set_lines(0, 0, -1, true, {'p'})
screen:expect{grid=[[
## grid 1
[2:-------------------------]|
@@ -1283,7 +1284,7 @@ describe('cmdheight=0', function()
[2:-------------------------]|
[2:-------------------------]|
## grid 2
- ^ |
+ ^p |
{1:~ }|
{1:~ }|
{1:~ }|
@@ -1302,7 +1303,7 @@ describe('cmdheight=0', function()
[2:-------------------------]|
[3:-------------------------]|
## grid 2
- |
+ {6:p} |
{1:~ }|
{1:~ }|
{1:~ }|
@@ -1427,7 +1428,21 @@ describe('cmdheight=0', function()
|
]])
command('set cmdheight=0')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {2:[No Name] }|
+ ]]}
command('resize -1')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {2:[No Name] }|
+ |
+ ]]}
command('resize +1')
screen:expect([[
^ |
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index d6a6243be2..f378c50792 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -1464,6 +1464,8 @@ describe('extmark decorations', function()
end)
it('can have virtual text which combines foreground and background groups', function()
+ screen:try_resize(20, 5)
+
screen:set_default_attr_ids {
[1] = {bold=true, foreground=Screen.colors.Blue};
[2] = {background = tonumber('0x123456'), foreground = tonumber('0xbbbbbb')};
@@ -1481,30 +1483,24 @@ describe('extmark decorations', function()
hi VeryBold gui=bold
]]
- meths.buf_set_extmark(0, ns, 0, 0, { virt_text={
+ insert('##')
+ local vt = {
{'a', {'BgOne', 'FgEin'}};
{'b', {'BgOne', 'FgZwei'}};
{'c', {'BgTwo', 'FgEin'}};
{'d', {'BgTwo', 'FgZwei'}};
{'X', {'BgTwo', 'FgZwei', 'VeryBold'}};
- }})
-
- screen:expect{grid=[[
- ^ {2:a}{3:b}{4:c}{5:d}{6:X} |
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- |
+ }
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'eol' })
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'right_align' })
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_text = vt, virt_text_pos = 'inline' })
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_lines = { vt, vt } })
+ screen:expect{grid=[[
+ {2:a}{3:b}{4:c}{5:d}{6:X}#^# {2:a}{3:b}{4:c}{5:d}{6:X} {2:a}{3:b}{4:c}{5:d}{6:X}|
+ {2:a}{3:b}{4:c}{5:d}{6:X} |
+ {2:a}{3:b}{4:c}{5:d}{6:X} |
+ {1:~ }|
+ |
]]}
end)
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index f75fb52108..93ca1aef3f 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -821,7 +821,7 @@ describe('float window', function()
[4] = {bold = true, reverse = true},
[5] = {reverse = true},
[6] = {background = Screen.colors.LightMagenta, bold = true, reverse = true},
- [7] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [7] = {foreground = Screen.colors.White, background = Screen.colors.Red},
[8] = {bold = true, foreground = Screen.colors.SeaGreen4},
[9] = {background = Screen.colors.LightGrey, underline = true},
[10] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Magenta},
@@ -2512,7 +2512,12 @@ describe('float window', function()
]]}
end
- meths.win_set_config(win, {title= { {"🦄"},{"BB"}},title_pos="right",footer= { {"🦄"},{"BB"}},footer_pos="right"})
+ command('hi B0 guibg=Red guifg=Black')
+ command('hi B1 guifg=White')
+ meths.win_set_config(win, {
+ title = {{"🦄"}, {"BB", {"B0", "B1"}}}, title_pos = "right",
+ footer= {{"🦄"}, {"BB", {"B0", "B1"}}}, footer_pos = "right",
+ })
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -2533,10 +2538,10 @@ describe('float window', function()
## grid 3
|
## grid 4
- {5:╔═════}🦄BB{5:╗}|
+ {5:╔═════}🦄{7:BB}{5:╗}|
{5:║}{1: halloj! }{5:║}|
{5:║}{1: BORDAA }{5:║}|
- {5:╚═════}🦄BB{5:╝}|
+ {5:╚═════}🦄{7:BB}{5:╝}|
]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 2, 5, true }
}, win_viewport={
@@ -2547,10 +2552,10 @@ describe('float window', function()
screen:expect{grid=[[
^ |
{0:~ }|
- {0:~ }{5:╔═════}🦄BB{5:╗}{0: }|
+ {0:~ }{5:╔═════}🦄{7:BB}{5:╗}{0: }|
{0:~ }{5:║}{1: halloj! }{5:║}{0: }|
{0:~ }{5:║}{1: BORDAA }{5:║}{0: }|
- {0:~ }{5:╚═════}🦄BB{5:╝}{0: }|
+ {0:~ }{5:╚═════}🦄{7:BB}{5:╝}{0: }|
|
]]}
end
@@ -6287,7 +6292,7 @@ describe('float window', function()
end
if multigrid then
- meths.input_mouse('left', 'press', '', 1, 0, 0)
+ meths.input_mouse('left', 'press', '', 2, 0, 0)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -6366,7 +6371,7 @@ describe('float window', function()
end
if multigrid then
- meths.input_mouse('left', 'press', '', 1, 0, 0)
+ meths.input_mouse('left', 'press', '', 2, 0, 0)
screen:expect{grid=[[
## grid 1
[2:----------------------------------------]|
@@ -8764,6 +8769,186 @@ describe('float window', function()
end
end)
+ it('left click sets correct curswant in float window with border', function()
+ local buf = meths.create_buf(false,false)
+ meths.buf_set_lines(buf, 0, -1, true, {'', '', ''})
+ meths.open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:┌────────────────────┐}|
+ {5:│}{1: }{5:│}|
+ {5:│}{1: }{5:│}|
+ {5:│}{1: }{5:│}|
+ {5:└────────────────────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ {5:┌────────────────────┐} |
+ {0:~ }{5:│}{1: }{5:│}{0: }|
+ {0:~ }{5:│}{1: }{5:│}{0: }|
+ {0:~ }{5:│}{1: }{5:│}{0: }|
+ {0:~ }{5:└────────────────────┘}{0: }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 3, 1)
+ else
+ meths.input_mouse('left', 'press', '', 0, 3, 6)
+ end
+ eq({0, 3, 1, 0, 1}, funcs.getcurpos())
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 3, 2)
+ else
+ meths.input_mouse('left', 'press', '', 0, 3, 7)
+ end
+ eq({0, 3, 1, 0, 2}, funcs.getcurpos())
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 3, 10)
+ else
+ meths.input_mouse('left', 'press', '', 0, 3, 15)
+ end
+ eq({0, 3, 1, 0, 10}, funcs.getcurpos())
+
+ command('setlocal foldcolumn=1')
+ feed('zfkgg')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:┌────────────────────┐}|
+ {5:│}{19: }{1:^ }{5:│}|
+ {5:│}{19:+}{28:+-- 2 lines: ·····}{5:│}|
+ {5:│}{2:~ }{5:│}|
+ {5:└────────────────────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 4, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ {5:┌────────────────────┐} |
+ {0:~ }{5:│}{19: }{1:^ }{5:│}{0: }|
+ {0:~ }{5:│}{19:+}{28:+-- 2 lines: ·····}{5:│}{0: }|
+ {0:~ }{5:│}{2:~ }{5:│}{0: }|
+ {0:~ }{5:└────────────────────┘}{0: }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 2, 1)
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 4
+ {5:┌────────────────────┐}|
+ {5:│}{19: }{1:^ }{5:│}|
+ {5:│}{19:-}{1: }{5:│}|
+ {5:│}{19:│}{1: }{5:│}|
+ {5:└────────────────────┘}|
+ ]], float_pos={
+ [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
+ }}
+ else
+ meths.input_mouse('left', 'press', '', 0, 2, 6)
+ screen:expect{grid=[[
+ {5:┌────────────────────┐} |
+ {0:~ }{5:│}{19: }{1:^ }{5:│}{0: }|
+ {0:~ }{5:│}{19:-}{1: }{5:│}{0: }|
+ {0:~ }{5:│}{19:│}{1: }{5:│}{0: }|
+ {0:~ }{5:└────────────────────┘}{0: }|
+ {0:~ }|
+ |
+ ]]}
+ end
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 2, 2)
+ else
+ meths.input_mouse('left', 'press', '', 0, 2, 7)
+ end
+ eq({0, 2, 1, 0, 1}, funcs.getcurpos())
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 2, 3)
+ else
+ meths.input_mouse('left', 'press', '', 0, 2, 8)
+ end
+ eq({0, 2, 1, 0, 2}, funcs.getcurpos())
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 4, 2, 11)
+ else
+ meths.input_mouse('left', 'press', '', 0, 2, 16)
+ end
+ eq({0, 2, 1, 0, 10}, funcs.getcurpos())
+ end)
+
it("'winblend' option", function()
screen:try_resize(50,9)
screen:set_default_attr_ids({
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 5e907f82ba..f42682ba69 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -33,7 +33,7 @@ describe("folded lines", function()
[1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {reverse = true},
[3] = {bold = true, reverse = true},
- [4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [4] = {foreground = Screen.colors.White, background = Screen.colors.Red},
[5] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey},
[6] = {background = Screen.colors.Yellow},
[7] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
@@ -2938,10 +2938,15 @@ describe("folded lines", function()
screen:try_resize(30, 7)
insert(content1)
command("hi! CursorLine guibg=NONE guifg=Red gui=NONE")
+ command('hi F0 guibg=Red guifg=Black')
+ command('hi F1 guifg=White')
meths.set_option_value('cursorline', true, {})
meths.set_option_value('foldcolumn', '4', {})
- meths.set_option_value('foldtext',
- '[[v:folddashes], ["\t", "Search"], [getline(v:foldstart), "NonText"]]', {})
+ meths.set_option_value('foldtext', '['
+ .. '["▶", ["F0", "F1"]], '
+ .. '[v:folddashes], '
+ .. '["\t", "Search"], '
+ .. '[getline(v:foldstart), "NonText"]]', {})
command('3,4fold')
command('5,6fold')
@@ -2958,7 +2963,7 @@ describe("folded lines", function()
[3:------------------------------]|
## grid 2
{7: }This is a |
- {7:+ }{13:^-}{17: }{18:valid English}{13:·····}|
+ {7:+ }{4:^▶}{13:-}{17: }{18:valid English}{13:·····}|
{1:~ }|
{1:~ }|
{1:~ }|
@@ -2969,7 +2974,7 @@ describe("folded lines", function()
else
screen:expect([[
{7: }This is a |
- {7:+ }{13:^-}{17: }{18:valid English}{13:·····}|
+ {7:+ }{4:^▶}{13:-}{17: }{18:valid English}{13:·····}|
{1:~ }|
{1:~ }|
{1:~ }|
@@ -2977,7 +2982,7 @@ describe("folded lines", function()
|
]])
end
- eq('-\tvalid English', funcs.foldtextresult(2))
+ eq('▶-\tvalid English', funcs.foldtextresult(2))
feed('zo')
if multigrid then
@@ -2993,8 +2998,8 @@ describe("folded lines", function()
## grid 2
{7: }This is a |
{7:- }valid English |
- {7:│+ }{5:--}{19: }{18:sentence composed }|
- {7:│+ }{13:^--}{17: }{18:in his cave.}{13:······}|
+ {7:│+ }{4:▶}{5:--}{19: }{18:sentence composed }|
+ {7:│+ }{4:^▶}{13:--}{17: }{18:in his cave.}{13:······}|
{1:~ }|
{1:~ }|
## grid 3
@@ -3004,15 +3009,15 @@ describe("folded lines", function()
screen:expect([[
{7: }This is a |
{7:- }valid English |
- {7:│+ }{5:--}{19: }{18:sentence composed }|
- {7:│+ }{13:^--}{17: }{18:in his cave.}{13:······}|
+ {7:│+ }{4:▶}{5:--}{19: }{18:sentence composed }|
+ {7:│+ }{4:^▶}{13:--}{17: }{18:in his cave.}{13:······}|
{1:~ }|
{1:~ }|
|
]])
end
- eq('--\tsentence composed by', funcs.foldtextresult(3))
- eq('--\tin his cave.', funcs.foldtextresult(5))
+ eq('▶--\tsentence composed by', funcs.foldtextresult(3))
+ eq('▶--\tin his cave.', funcs.foldtextresult(5))
command('hi! Visual guibg=Red')
feed('V2k')
@@ -3029,8 +3034,8 @@ describe("folded lines", function()
## grid 2
{7: }This is a |
{7:- }^v{14:alid English} |
- {7:│+ }{15:--}{19: }{20:sentence composed }|
- {7:│+ }{15:--}{19: }{20:in his cave.}{15:······}|
+ {7:│+ }{4:▶}{15:--}{19: }{20:sentence composed }|
+ {7:│+ }{4:▶}{15:--}{19: }{20:in his cave.}{15:······}|
{1:~ }|
{1:~ }|
## grid 3
@@ -3040,8 +3045,8 @@ describe("folded lines", function()
screen:expect([[
{7: }This is a |
{7:- }^v{14:alid English} |
- {7:│+ }{15:--}{19: }{20:sentence composed }|
- {7:│+ }{15:--}{19: }{20:in his cave.}{15:······}|
+ {7:│+ }{4:▶}{15:--}{19: }{20:sentence composed }|
+ {7:│+ }{4:▶}{15:--}{19: }{20:in his cave.}{15:······}|
{1:~ }|
{1:~ }|
{11:-- VISUAL LINE --} |
@@ -3062,8 +3067,8 @@ describe("folded lines", function()
## grid 2
a si sihT{7: }|
{14:hsilgnE dila}^v{7: -}|
- {20: desopmoc ecnetnes}{19: }{15:--}{7: +│}|
- {15:······}{20:.evac sih ni}{19: }{15:--}{7: +│}|
+ {20: desopmoc ecnetnes}{19: }{15:--}{4:▶}{7: +│}|
+ {15:······}{20:.evac sih ni}{19: }{15:--}{4:▶}{7: +│}|
{1: ~}|
{1: ~}|
## grid 3
@@ -3073,8 +3078,8 @@ describe("folded lines", function()
screen:expect([[
a si sihT{7: }|
{14:hsilgnE dila}^v{7: -}|
- {20: desopmoc ecnetnes}{19: }{15:--}{7: +│}|
- {15:······}{20:.evac sih ni}{19: }{15:--}{7: +│}|
+ {20: desopmoc ecnetnes}{19: }{15:--}{4:▶}{7: +│}|
+ {15:······}{20:.evac sih ni}{19: }{15:--}{4:▶}{7: +│}|
{1: ~}|
{1: ~}|
{11:-- VISUAL LINE --} |
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index a8d01cfbf1..fd24174f74 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -1676,7 +1676,7 @@ describe('ui/mouse/input', function()
end)
- it('getmousepos works correctly', function()
+ it('getmousepos() works correctly', function()
local winwidth = meths.get_option_value('winwidth', {})
-- Set winwidth=1 so that window sizes don't change.
meths.set_option_value('winwidth', 1, {})
@@ -1771,7 +1771,7 @@ describe('ui/mouse/input', function()
-- Test that mouse position values are properly set for ordinary windows.
-- Set the float to be unfocusable instead of closing, to additionally test
- -- that getmousepos does not consider unfocusable floats. (see discussion
+ -- that getmousepos() does not consider unfocusable floats. (see discussion
-- in PR #14937 for details).
opts.focusable = false
meths.win_set_config(float, opts)
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 1778c8218b..6f4082beda 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -2307,6 +2307,7 @@ describe('ext_multigrid', function()
{1:~ }|
]]}
+ -- XXX: mouse_check_grid() doesn't work properly when clicking on grid 1
meths.input_mouse('left', 'press', '', 1, 6, 20)
-- TODO(bfredl): "batching" input_mouse is formally not supported yet.
-- Normally it should work fine in async context when nvim is not blocked,