aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/highlight_spec.lua36
-rw-r--r--test/functional/ui/inccommand_spec.lua102
-rw-r--r--test/functional/ui/input_spec.lua4
-rw-r--r--test/functional/ui/screen_basic_spec.lua33
-rw-r--r--test/functional/ui/searchhl_spec.lua34
5 files changed, 176 insertions, 33 deletions
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 364e0eea7f..ab3b1c3cac 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -778,6 +778,9 @@ describe("'winhighlight' highlight", function()
[22] = {bold = true, foreground = Screen.colors.SeaGreen4},
[23] = {background = Screen.colors.LightMagenta},
[24] = {background = Screen.colors.WebGray},
+ [25] = {bold = true, foreground = Screen.colors.Green1},
+ [26] = {background = Screen.colors.Red},
+ [27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1},
})
command("hi Background1 guibg=DarkBlue")
command("hi Background2 guibg=DarkGreen")
@@ -1047,6 +1050,39 @@ describe("'winhighlight' highlight", function()
]])
end)
+ it("background doesn't override syntax background", function()
+ command('syntax on')
+ command('syntax keyword Foobar foobar')
+ command('syntax keyword Article the')
+ command('hi Foobar guibg=#FF0000')
+ command('hi Article guifg=#00FF00 gui=bold')
+ insert('the foobar was foobar')
+ screen:expect([[
+ {25:the} {26:foobar} was {26:fooba}|
+ {26:^r} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+
+ -- winhl=Normal:Group with background doesn't override syntax background,
+ -- but does combine with syntax foreground.
+ command('set winhl=Normal:Background1')
+ screen:expect([[
+ {27:the}{1: }{26:foobar}{1: was }{26:fooba}|
+ {26:^r}{1: }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ {2:~ }|
+ |
+ ]])
+ end)
+
it('can override NonText, Conceal and EndOfBuffer', function()
curbufmeths.set_lines(0,-1,true, {"raa\000"})
command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 27e4066d9f..ee1a3240a2 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -16,6 +16,8 @@ local retry = helpers.retry
local source = helpers.source
local wait = helpers.wait
local nvim = helpers.nvim
+local iswin = helpers.iswin
+local sleep = helpers.sleep
local default_text = [[
Inc substitution on
@@ -1354,6 +1356,23 @@ describe("inccommand=nosplit", function()
:echo 'foo'^ |
]])
end)
+
+ it("does not execute trailing bar-separated commands #7494", function()
+ feed(':%s/two/three/g|q!')
+ screen:expect([[
+ Inc substitution on |
+ {12:three} lines |
+ Inc substitution on |
+ {12:three} lines |
+ |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ :%s/two/three/g|q!^ |
+ ]])
+ eq(eval('v:null'), eval('v:exiting'))
+ end)
end)
describe(":substitute, 'inccommand' with a failing expression", function()
@@ -1833,7 +1852,7 @@ describe(":substitute", function()
clear()
end)
- it(", inccommand=split, highlights multiline substitutions", function()
+ it("inccommand=split, highlights multiline substitutions", function()
common_setup(screen, "split", multiline_text)
feed("gg")
@@ -1895,7 +1914,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=nosplit, highlights multiline substitutions", function()
+ it("inccommand=nosplit, highlights multiline substitutions", function()
common_setup(screen, "nosplit", multiline_text)
feed("gg")
@@ -1938,7 +1957,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=split, highlights multiple matches on a line", function()
+ it("inccommand=split, highlights multiple matches on a line", function()
common_setup(screen, "split", multimatch_text)
command("set gdefault")
feed("gg")
@@ -1963,7 +1982,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=nosplit, highlights multiple matches on a line", function()
+ it("inccommand=nosplit, highlights multiple matches on a line", function()
common_setup(screen, "nosplit", multimatch_text)
command("set gdefault")
feed("gg")
@@ -1988,7 +2007,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=split, with \\zs", function()
+ it("inccommand=split, with \\zs", function()
common_setup(screen, "split", multiline_text)
feed("gg")
@@ -2012,7 +2031,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=nosplit, with \\zs", function()
+ it("inccommand=nosplit, with \\zs", function()
common_setup(screen, "nosplit", multiline_text)
feed("gg")
@@ -2036,7 +2055,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=split, substitutions of different length",
+ it("inccommand=split, substitutions of different length",
function()
common_setup(screen, "split", "T T123 T2T TTT T090804\nx")
@@ -2060,7 +2079,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=nosplit, substitutions of different length", function()
+ it("inccommand=nosplit, substitutions of different length", function()
common_setup(screen, "nosplit", "T T123 T2T TTT T090804\nx")
feed(":%s/T\\([0-9]\\+\\)/\\1\\1/g")
@@ -2083,7 +2102,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=split, contraction of lines", function()
+ it("inccommand=split, contraction of lines", function()
local text = [[
T T123 T T123 T2T TT T23423424
x
@@ -2132,7 +2151,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=nosplit, contraction of lines", function()
+ it("inccommand=nosplit, contraction of lines", function()
local text = [[
T T123 T T123 T2T TT T23423424
x
@@ -2162,7 +2181,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=split, multibyte text", function()
+ it("inccommand=split, multibyte text", function()
common_setup(screen, "split", multibyte_text)
feed(":%s/£.*ѫ/X¥¥")
screen:expect([[
@@ -2203,7 +2222,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=nosplit, multibyte text", function()
+ it("inccommand=nosplit, multibyte text", function()
common_setup(screen, "nosplit", multibyte_text)
feed(":%s/£.*ѫ/X¥¥")
screen:expect([[
@@ -2244,7 +2263,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=split, small cmdwinheight", function()
+ it("inccommand=split, small cmdwinheight", function()
common_setup(screen, "split", long_multiline_text)
command("set cmdwinheight=2")
@@ -2306,7 +2325,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=split, large cmdwinheight", function()
+ it("inccommand=split, large cmdwinheight", function()
common_setup(screen, "split", long_multiline_text)
command("set cmdwinheight=11")
@@ -2368,7 +2387,7 @@ describe(":substitute", function()
]])
end)
- it(", inccommand=split, lookaround", function()
+ it("inccommand=split, lookaround", function()
common_setup(screen, "split", "something\neverything\nsomeone")
feed([[:%s/\(some\)\@<lt>=thing/one/]])
screen:expect([[
@@ -2452,4 +2471,57 @@ describe(":substitute", function()
:%s/some\(thing\)\@!/every/^ |
]])
end)
+
+ it('with inccommand during :terminal activity', function()
+ command("set cmdwinheight=3")
+ if iswin() then
+ feed([[:terminal for /L \%I in (1,1,5000) do @(echo xxx & echo xxx & echo xxx)<cr>]])
+ else
+ feed([[:terminal for i in $(seq 1 5000); do printf 'xxx\nxxx\nxxx\n'; done<cr>]])
+ end
+ command('file term')
+ command('new')
+ common_setup(screen, 'split', 'foo bar baz\nbar baz fox\nbar foo baz')
+ command('wincmd =')
+
+ -- Allow some terminal output.
+ screen:expect([[
+ bar baz fox |
+ bar foo ba^z |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {11:[No Name] [+] }|
+ xxx |
+ xxx |
+ xxx |
+ xxx |
+ xxx |
+ xxx |
+ {10:term }|
+ |
+ ]])
+
+ feed('gg')
+ feed(':%s/foo/ZZZ')
+ sleep(50) -- Allow some terminal activity.
+ screen:expect([[
+ {12:ZZZ} bar baz |
+ bar baz fox |
+ bar {12:ZZZ} baz |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {11:[No Name] [+] }|
+ xxx |
+ xxx |
+ {10:term }|
+ |1| {12:ZZZ} bar baz |
+ |3| bar {12:ZZZ} baz |
+ {15:~ }|
+ {10:[Preview] }|
+ :%s/foo/ZZZ^ |
+ ]])
+ end)
end)
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 9bfc87d835..3dd9a2506e 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -128,6 +128,10 @@ describe('input utf sequences that contain CSI/K_SPECIAL', function()
end)
describe('input non-printable chars', function()
+ after_each(function()
+ os.remove('Xtest-overwrite')
+ end)
+
it("doesn't crash when echoing them back", function()
write_file("Xtest-overwrite", [[foobar]])
clear()
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 563d04416a..7fafd6b352 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -76,11 +76,26 @@ describe('Screen', function()
local function check()
eq(true, screen.suspended)
end
+
+ command('let g:ev = []')
+ command('autocmd VimResume * :call add(g:ev, "r")')
+ command('autocmd VimSuspend * :call add(g:ev, "s")')
+
+ eq(false, screen.suspended)
command('suspend')
+ eq({ 's', 'r' }, eval('g:ev'))
+
screen:expect(check)
screen.suspended = false
+
feed('<c-z>')
+ eq({ 's', 'r', 's', 'r' }, eval('g:ev'))
+
screen:expect(check)
+ screen.suspended = false
+
+ command('suspend')
+ eq({ 's', 'r', 's', 'r', 's', 'r' }, eval('g:ev'))
end)
end)
@@ -631,21 +646,3 @@ describe('Screen', function()
end)
end)
end)
-
-describe('nvim_ui_attach()', function()
- before_each(function()
- clear()
- end)
- it('handles very large width/height #2180', function()
- local screen = Screen.new(999, 999)
- screen:attach()
- eq(999, eval('&lines'))
- eq(999, eval('&columns'))
- end)
- it('invalid option returns error', function()
- local screen = Screen.new()
- local status, rv = pcall(function() screen:attach({foo={'foo'}}) end)
- eq(false, status)
- eq('No such ui option', rv:match("No such .*"))
- end)
-end)
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index 9f273e8dc9..168080a092 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -4,6 +4,8 @@ local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local feed_command = helpers.feed_command
local eq = helpers.eq
local eval = helpers.eval
+local iswin = helpers.iswin
+local sleep = helpers.sleep
describe('search highlighting', function()
local screen
@@ -91,6 +93,38 @@ describe('search highlighting', function()
]])
end)
+ it('is preserved during :terminal activity', function()
+ if iswin() then
+ feed([[:terminal for /L \%I in (1,1,5000) do @(echo xxx & echo xxx & echo xxx)<cr>]])
+ else
+ feed([[:terminal for i in $(seq 1 5000); do printf 'xxx\nxxx\nxxx\n'; done<cr>]])
+ end
+
+ feed(':file term<CR>')
+ feed(':vnew<CR>')
+ insert([[
+ foo bar baz
+ bar baz foo
+ bar foo baz
+ ]])
+ feed('/foo')
+ sleep(50) -- Allow some terminal activity.
+ screen:expect([[
+ {3:foo} bar baz {3:│}xxx |
+ bar baz {2:foo} {3:│}xxx |
+ bar {2:foo} baz {3:│}xxx |
+ {3:│}xxx |
+ {1:~ }{3:│}xxx |
+ {5:[No Name] [+] }{3:term }|
+ /foo^ |
+ ]], { [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {background = Screen.colors.Yellow},
+ [3] = {reverse = true},
+ [4] = {foreground = Screen.colors.Red},
+ [5] = {bold = true, reverse = true},
+ })
+ end)
+
it('works with incsearch', function()
feed_command('set hlsearch')
feed_command('set incsearch')