aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/ui/decorations_spec.lua59
-rw-r--r--test/functional/ui/fold_spec.lua37
-rw-r--r--test/functional/ui/screen_basic_spec.lua12
-rw-r--r--test/functional/ui/spell_spec.lua42
-rw-r--r--test/functional/ui/statuscolumn_spec.lua6
5 files changed, 139 insertions, 17 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 1e21d90be9..3ed31033fa 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -10,6 +10,7 @@ local expect_events = helpers.expect_events
local meths = helpers.meths
local curbufmeths = helpers.curbufmeths
local command = helpers.command
+local assert_alive = helpers.assert_alive
describe('decorations providers', function()
local screen
@@ -80,7 +81,7 @@ describe('decorations providers', function()
local ns2 = api.nvim_create_namespace "ns2"
api.nvim_set_decoration_provider(ns2, {})
]])
- helpers.assert_alive()
+ assert_alive()
end)
it('leave a trace', function()
@@ -826,6 +827,26 @@ describe('extmark decorations', function()
end -- ?古古古古?古古 |
|
]]}
+
+ screen:try_resize(50, 2)
+ command('set nowrap')
+ meths.buf_set_lines(0, 12, 12, true, {'-- ' .. ('…'):rep(57)})
+ feed('G')
+ meths.buf_set_extmark(0, ns, 12, 123, { virt_text={{'!!!!!', 'ErrorMsg'}}, virt_text_pos='overlay', virt_text_hide=true})
+ screen:expect{grid=[[
+ ^-- …………………………………………………………………………………………………………{4:!!!!!}……|
+ |
+ ]]}
+ feed('40zl')
+ screen:expect{grid=[[
+ ^………{4:!!!!!}……………………………… |
+ |
+ ]]}
+ feed('10zl')
+ screen:expect{grid=[[
+ ^………………………… |
+ |
+ ]]}
end)
it('can have virtual text of overlay position and styling', function()
@@ -1094,7 +1115,7 @@ describe('extmark decorations', function()
{1:~ }|
|
]]}
- helpers.assert_alive()
+ assert_alive()
end)
it('conceal #19007', function()
@@ -1305,6 +1326,9 @@ describe('decorations: inline virtual text', function()
[13] = {reverse = true};
[14] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.LightMagenta};
[15] = {bold = true, reverse = true};
+ [16] = {foreground = Screen.colors.Red};
+ [17] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue};
+ [18] = {background = Screen.colors.LightGrey, foreground = Screen.colors.Red};
}
ns = meths.create_namespace 'test'
@@ -2018,6 +2042,37 @@ bbbbbbb]])
]],
})
end)
+
+ it('does not crash at column 0 when folded in a wide window', function()
+ screen:try_resize(82, 4)
+ command('hi! CursorLine guibg=NONE guifg=Red gui=NONE')
+ command('set cursorline')
+ insert([[
+ aaaaa
+ bbbbb
+ ccccc]])
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'foo'}}, virt_text_pos = 'inline' })
+ screen:expect{grid=[[
+ fooaaaaa |
+ bbbbb |
+ {16:cccc^c }|
+ |
+ ]]}
+ command('1,2fold')
+ screen:expect{grid=[[
+ {17:+-- 2 lines: aaaaa·······························································}|
+ {16:cccc^c }|
+ {1:~ }|
+ |
+ ]]}
+ feed('k')
+ screen:expect{grid=[[
+ {18:^+-- 2 lines: aaaaa·······························································}|
+ ccccc |
+ {1:~ }|
+ |
+ ]]}
+ end)
end)
describe('decorations: virtual lines', function()
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 2afe27ecc7..520979a2c2 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -42,9 +42,10 @@ describe("folded lines", function()
[9] = {bold = true, foreground = Screen.colors.Brown},
[10] = {background = Screen.colors.LightGrey, underline = true},
[11] = {bold=true},
- [12] = {background = Screen.colors.Grey90, underline = true},
- [13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey, underline = true},
- [14] = {background = Screen.colors.LightGray},
+ [12] = {foreground = Screen.colors.Red},
+ [13] = {foreground = Screen.colors.Red, background = Screen.colors.LightGrey},
+ [14] = {background = Screen.colors.Red},
+ [15] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Red},
})
end)
@@ -88,10 +89,9 @@ describe("folded lines", function()
end
end)
- it("foldcolumn highlighted with CursorLineFold when 'cursorline' is set", function()
+ local function test_folded_cursorline()
command("set number cursorline foldcolumn=2")
command("hi link CursorLineFold Search")
- command("hi! CursorLine gui=underline guibg=Grey90")
insert(content1)
feed("ggzf3jj")
if multigrid then
@@ -239,6 +239,22 @@ describe("folded lines", function()
|
]])
end
+ end
+
+ describe("when 'cursorline' is set", function()
+ it('with high-priority CursorLine', function()
+ command("hi! CursorLine guibg=NONE guifg=Red gui=NONE")
+ test_folded_cursorline()
+ end)
+
+ it('with low-priority CursorLine', function()
+ command("hi! CursorLine guibg=NONE guifg=NONE gui=underline")
+ local attrs = screen:get_default_attr_ids()
+ attrs[12] = {underline = true}
+ attrs[13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey, underline = true}
+ screen:set_default_attr_ids(attrs)
+ test_folded_cursorline()
+ end)
end)
it("work with spell", function()
@@ -2017,7 +2033,8 @@ describe("folded lines", function()
end
end)
- it('Folded highlight does not disappear in Visual selection #19691', function()
+ it('Folded and Visual highlights are combined #19691', function()
+ command('hi! Visual guibg=Red')
insert([[
" foo
" {{{1
@@ -2044,9 +2061,9 @@ describe("folded lines", function()
[3:---------------------------------------------]|
## grid 2
{14:" fo}o |
- {5:+-- 3 lines: "······························}|
+ {15:+-- }{5: 3 lines: "······························}|
{14:" ba}r |
- {5:+-- 3 lines: "······························}|
+ {15:+-- }{5: 3 lines: "······························}|
{14:" b}^az |
{1:~ }|
{1:~ }|
@@ -2056,9 +2073,9 @@ describe("folded lines", function()
else
screen:expect([[
{14:" fo}o |
- {5:+-- 3 lines: "······························}|
+ {15:+-- }{5: 3 lines: "······························}|
{14:" ba}r |
- {5:+-- 3 lines: "······························}|
+ {15:+-- }{5: 3 lines: "······························}|
{14:" b}^az |
{1:~ }|
{1:~ }|
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index b31e40d4ab..67e3b774b4 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -117,6 +117,12 @@ local function screen_tests(linegrid)
screen:expect(function()
eq(expected, screen.title)
end)
+ screen:detach()
+ screen.title = nil
+ screen:attach()
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
end)
end)
@@ -128,6 +134,12 @@ local function screen_tests(linegrid)
screen:expect(function()
eq(expected, screen.icon)
end)
+ screen:detach()
+ screen.icon = nil
+ screen:attach()
+ screen:expect(function()
+ eq(expected, screen.icon)
+ end)
end)
end)
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua
index 7f11b06f78..630d0d0948 100644
--- a/test/functional/ui/spell_spec.lua
+++ b/test/functional/ui/spell_spec.lua
@@ -28,6 +28,7 @@ describe("'spell'", function()
[7] = {foreground = Screen.colors.Blue},
[8] = {foreground = Screen.colors.Blue, special = Screen.colors.Red, undercurl = true},
[9] = {bold = true},
+ [10] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue},
})
end)
@@ -82,7 +83,7 @@ describe("'spell'", function()
end)
-- oldtest: Test_spell_screendump_spellcap()
- it('has correct highlight at start of line with trailing space', function()
+ it('SpellCap highlight at start of line', function()
exec([=[
call setline(1, [
\" This line has a sepll error. and missing caps and trailing spaces. ",
@@ -117,7 +118,7 @@ describe("'spell'", function()
|
]])
-- Deleting a full stop removes missing Cap in next line
- feed('5Gddk$x')
+ feed('5Gdd<C-L>k$x')
screen:expect([[
This line has a {1:sepll} error. {2:and} missing caps and trailing spaces. |
{2:another} missing cap here. |
@@ -140,6 +141,43 @@ describe("'spell'", function()
{0:~ }|
|
]])
+ -- Folding an empty line does not remove Cap in next line
+ feed('uzfk:<Esc>')
+ screen:expect([[
+ This line has a {1:sepll} error. {2:and} missing caps and trailing spaces. |
+ {2:another} missing cap here. |
+ Not |
+ {10:^+-- 2 lines: and here.·························································}|
+ {2:and} here. |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- Folding the end of a sentence does not remove Cap in next line
+ -- and editing a line does not remove Cap in current line
+ feed('Jzfkk$x')
+ screen:expect([[
+ This line has a {1:sepll} error. {2:and} missing caps and trailing spaces. |
+ {2:another} missing cap her^e |
+ {10:+-- 2 lines: Not·······························································}|
+ {2:and} here. |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- Cap is correctly applied in the first row of a window
+ feed('<C-E><C-L>')
+ screen:expect([[
+ {2:another} missing cap her^e |
+ {10:+-- 2 lines: Not·······························································}|
+ {2:and} here. |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
end)
-- oldtest: Test_spell_compatible()
diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua
index f349b182c9..c218bd8fd6 100644
--- a/test/functional/ui/statuscolumn_spec.lua
+++ b/test/functional/ui/statuscolumn_spec.lua
@@ -196,10 +196,10 @@ describe('statuscolumn', function()
[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] = {background = Screen.colors.Grey90, underline = true},
- [6] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey, underline = true},
+ [5] = {foreground = Screen.colors.Red},
+ [6] = {foreground = Screen.colors.Red, background = Screen.colors.LightGrey},
})
- command('hi! CursorLine gui=underline guibg=Grey90')
+ command('hi! CursorLine guifg=Red guibg=NONE')
screen:expect([[
{1: 4│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
{1: │ }a |