aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua2
-rw-r--r--test/functional/ui/cmdline_spec.lua156
-rw-r--r--test/functional/ui/cursor_spec.lua4
-rw-r--r--test/functional/ui/diff_spec.lua408
-rw-r--r--test/functional/ui/embed_spec.lua2
-rw-r--r--test/functional/ui/float_spec.lua916
-rw-r--r--test/functional/ui/fold_spec.lua48
-rw-r--r--test/functional/ui/highlight_spec.lua78
-rw-r--r--test/functional/ui/inccommand_spec.lua27
-rw-r--r--test/functional/ui/input_spec.lua54
-rw-r--r--test/functional/ui/messages_spec.lua139
-rw-r--r--test/functional/ui/multigrid_spec.lua2
-rw-r--r--test/functional/ui/options_spec.lua6
-rw-r--r--test/functional/ui/output_spec.lua3
-rw-r--r--test/functional/ui/popupmenu_spec.lua264
-rw-r--r--test/functional/ui/screen.lua55
-rw-r--r--test/functional/ui/searchhl_spec.lua14
-rw-r--r--test/functional/ui/sign_spec.lua187
-rw-r--r--test/functional/ui/wildmode_spec.lua32
19 files changed, 1935 insertions, 462 deletions
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua
index 1568b7816e..45808b3b1b 100644
--- a/test/functional/ui/cmdline_highlight_spec.lua
+++ b/test/functional/ui/cmdline_highlight_spec.lua
@@ -975,8 +975,6 @@ describe('Expressions coloring support', function()
]])
funcs.setreg('a', {'\192'})
feed('<C-r>="<C-r><C-r>a"<C-r><C-r>a"foo"')
- -- TODO(ZyX-I): Parser highlighting should not override special character
- -- highlighting.
screen:expect([[
|
{EOB:~ }|
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 5d112d7f35..5d563895d6 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -116,6 +116,31 @@ local function test_cmdline(linegrid)
}}}
end)
+ it('from normal mode when : is mapped', function()
+ command('nnoremap ; :')
+
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {3:n }|
+ |
+ ]]}
+
+ feed(';')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {3:c }|
+ |
+ ]], cmdline={{
+ firstc = ":",
+ content = {{""}},
+ pos = 0,
+ }}}
+ end)
+
it('but not with scrolled messages', function()
screen:try_resize(35,10)
feed(':echoerr doesnotexist<cr>')
@@ -600,6 +625,137 @@ local function test_cmdline(linegrid)
pos = 12,
}}}
end)
+
+ it('works together with ext_popupmenu', function()
+ local expected = {
+ {'define', '', '', ''},
+ {'jump', '', '', ''},
+ {'list', '', '', ''},
+ {'place', '', '', ''},
+ {'undefine', '', '', ''},
+ {'unplace', '', '', ''},
+ }
+
+ command('set wildmode=full')
+ command('set wildmenu')
+ screen:set_option('ext_popupmenu', true)
+ feed(':sign <tab>')
+
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], cmdline={{
+ firstc = ":",
+ content = {{"sign define"}},
+ pos = 11,
+ }}, popupmenu={items=expected, pos=0, anchor={-1, 0, 5}}}
+
+ feed('<tab>')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], cmdline={{
+ firstc = ":",
+ content = {{"sign jump"}},
+ pos = 9,
+ }}, popupmenu={items=expected, pos=1, anchor={-1, 0, 5}}}
+
+ feed('<left><left>')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], cmdline={{
+ firstc = ":",
+ content = {{"sign "}},
+ pos = 5,
+ }}, popupmenu={items=expected, pos=-1, anchor={-1, 0, 5}}}
+
+ feed('<right>')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], cmdline={{
+ firstc = ":",
+ content = {{"sign define"}},
+ pos = 11,
+ }}, popupmenu={items=expected, pos=0, anchor={-1, 0, 5}}}
+
+ feed('a')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], cmdline={{
+ firstc = ":",
+ content = {{"sign definea"}},
+ pos = 12,
+ }}}
+ feed('<esc>')
+
+ -- check positioning with multibyte char in pattern
+ command("e långfile1")
+ command("sp långfile2")
+ feed(':b lå<tab>')
+ screen:expect{grid=[[
+ ^ |
+ {3:långfile2 }|
+ |
+ {2:långfile1 }|
+ |
+ ]], popupmenu={
+ anchor = { -1, 0, 2 },
+ items = {{ "långfile1", "", "", "" }, { "långfile2", "", "", "" }},
+ pos = 0
+ }, cmdline={{
+ content = {{ "b långfile1" }},
+ firstc = ":",
+ pos = 12
+ }}}
+ end)
+
+ it('ext_wildmenu takes precedence over ext_popupmenu', function()
+ local expected = {
+ 'define',
+ 'jump',
+ 'list',
+ 'place',
+ 'undefine',
+ 'unplace',
+ }
+
+ command('set wildmode=full')
+ command('set wildmenu')
+ screen:set_option('ext_wildmenu', true)
+ screen:set_option('ext_popupmenu', true)
+ feed(':sign <tab>')
+
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], cmdline={{
+ firstc = ":",
+ content = {{"sign define"}},
+ pos = 11,
+ }}, wildmenu_items=expected, wildmenu_pos=0}
+ end)
+
end
-- the representation of cmdline and cmdline_block contents changed with ext_linegrid
diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua
index 3e0370db14..4dc86f1e1f 100644
--- a/test/functional/ui/cursor_spec.lua
+++ b/test/functional/ui/cursor_spec.lua
@@ -216,10 +216,10 @@ describe('ui/cursor', function()
if m.blinkwait then m.blinkwait = 700 end
end
if m.hl_id then
- m.hl_id = 49
+ m.hl_id = 50
m.attr = {background = Screen.colors.DarkGray}
end
- if m.id_lm then m.id_lm = 50 end
+ if m.id_lm then m.id_lm = 51 end
end
-- Assert the new expectation.
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index 8e6756e550..8eb2bbf779 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -62,12 +62,12 @@ describe('Diff mode screen', function()
{1: }5 {3:│}{1: }5 |
{1: }6 {3:│}{1: }6 |
{1:+ }{5:+-- 4 lines: 7···}{3:│}{1:+ }{5:+-- 4 lines: 7··}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler |
]])
@@ -82,12 +82,12 @@ describe('Diff mode screen', function()
{1: }5 {3:│}{1: }5 |
{1: }6 {3:│}{1: }6 |
{1:+ }{5:+-- 4 lines: 7···}{3:│}{1:+ }{5:+-- 4 lines: 7··}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -108,12 +108,12 @@ describe('Diff mode screen', function()
{1: }5 {3:│}{1: }5 |
{1: }6 {3:│}{1: }6 |
{1:+ }{5:+-- 4 lines: 7···}{3:│}{1:+ }{5:+-- 4 lines: 7··}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler |
]])
@@ -128,12 +128,12 @@ describe('Diff mode screen', function()
{1: }5 {3:│}{1: }5 |
{1: }6 {3:│}{1: }6 |
{1:+ }{5:+-- 4 lines: 7···}{3:│}{1:+ }{5:+-- 4 lines: 7··}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -154,12 +154,12 @@ describe('Diff mode screen', function()
{1: }9 {3:│}{1: }9 |
{1: }10 {3:│}{1: }10 |
{1: }{2:------------------}{3:│}{1: }{4:11 }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler |
]])
@@ -174,12 +174,12 @@ describe('Diff mode screen', function()
{1: }9 {3:│}{1: }9 |
{1: }10 {3:│}{1: }10 |
{1: }{2:------------------}{3:│}{1: }{4:11 }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -200,12 +200,12 @@ describe('Diff mode screen', function()
{1: }9 {3:│}{1: }9 |
{1: }10 {3:│}{1: }10 |
{1: }{4:11 }{3:│}{1: }{2:-----------------}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler |
]])
@@ -220,12 +220,12 @@ describe('Diff mode screen', function()
{1: }9 {3:│}{1: }9 |
{1: }10 {3:│}{1: }10 |
{1: }{4:11 }{3:│}{1: }{2:-----------------}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -250,8 +250,8 @@ describe('Diff mode screen', function()
{1: }9 {3:│}{1: }9 |
{1: }10 {3:│}{1: }10 |
{1: }{4:11 }{3:│}{1: }{2:-----------------}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler |
]])
@@ -270,8 +270,8 @@ describe('Diff mode screen', function()
{1: }9 {3:│}{1: }9 |
{1: }10 {3:│}{1: }10 |
{1: }{4:11 }{3:│}{1: }{2:-----------------}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -296,8 +296,8 @@ describe('Diff mode screen', function()
{1: }9 {3:│}{1: }9 |
{1: }10 {3:│}{1: }10 |
{1: }{2:------------------}{3:│}{1: }{4:11 }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler |
]])
@@ -316,8 +316,8 @@ describe('Diff mode screen', function()
{1: }9 {3:│}{1: }9 |
{1: }10 {3:│}{1: }10 |
{1: }{2:------------------}{3:│}{1: }{4:11 }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -546,11 +546,11 @@ int main(int argc, char **argv)
{1: }{2:------------------}{3:│}{1: }{4: values.each do }|
{1: } v.finalize {3:│}{1: } v.finalize |
{1: } end {3:│}{1: } end |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=internal,filler |
]])
@@ -569,11 +569,11 @@ int main(int argc, char **argv)
{1: } values.each do |{3:│}{1: } values.each do |
{1: } v.finalize {3:│}{1: } v.finalize |
{1: } end {3:│}{1: } end |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
|
]])
@@ -593,11 +593,11 @@ int main(int argc, char **argv)
{1: } values.each do |{3:│}{1: } values.each do |
{1: } v.finalize {3:│}{1: } v.finalize |
{1: } end {3:│}{1: } end |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
: |
]])
@@ -612,19 +612,19 @@ int main(int argc, char **argv)
feed(':set diffopt=filler<cr>')
screen:expect([[
{1:+ }{5:^+-- 10 lines: 1···}{3:│}{1:+ }{5:+-- 10 lines: 1··}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler |
]])
@@ -632,19 +632,19 @@ int main(int argc, char **argv)
feed(':set diffopt+=internal<cr>')
screen:expect([[
{1:+ }{5:^+-- 10 lines: 1···}{3:│}{1:+ }{5:+-- 10 lines: 1··}|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -658,19 +658,19 @@ int main(int argc, char **argv)
feed(':set diffopt=filler<cr>')
screen:expect([[
{1:- }^ {3:│}{1:- } |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler |
]])
@@ -678,19 +678,19 @@ int main(int argc, char **argv)
feed(':set diffopt+=internal<cr>')
screen:expect([[
{1:- }^ {3:│}{1:- } |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -706,17 +706,17 @@ int main(int argc, char **argv)
{1: }^a {3:│}{1: }A |
{1: }b {3:│}{1: }b |
{1: }{9:cd }{3:│}{1: }{9:cD}{8:e}{9: }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler,icase |
]])
@@ -726,17 +726,17 @@ int main(int argc, char **argv)
{1: }^a {3:│}{1: }A |
{1: }b {3:│}{1: }b |
{1: }{9:cd }{3:│}{1: }{9:cD}{8:e}{9: }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt+=internal |
]])
@@ -763,12 +763,12 @@ int main(int argc, char **argv)
{1: } return 0; {3:│}{1: } return 0; |
{1: }{2:------------------}{3:│}{1: }{4: } }|
{1: }} {3:│}{1: }} |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler,iwhite |
]])
@@ -786,12 +786,12 @@ int main(int argc, char **argv)
{1: } return 0; {3:│}{1: } return 0; |
{1: }{2:------------------}{3:│}{1: }{4: } }|
{1: }} {3:│}{1: }} |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=filler,iwhite,internal |
]])
@@ -815,14 +815,14 @@ int main(int argc, char **argv)
{1: }cd {3:│}{1: }cd |
{1: }ef {3:│}{1: } |
{1: }{8:xxx}{9: }{3:│}{1: }ef |
- {1: }{6:~ }{3:│}{1: }{8:yyy}{9: }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{1: }{8:yyy}{9: }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
:set diffopt=internal,filler,iblank |
]])
@@ -838,15 +838,15 @@ int main(int argc, char **argv)
{1: } {3:│}{1: } |
{1: }cd {3:│}{1: }ef |
{1: }ef {3:│}{1: }{8:yyy}{9: }|
- {1: }{8:xxx}{9: }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {1: }{8:xxx}{9: }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
: |
]])
@@ -862,15 +862,15 @@ int main(int argc, char **argv)
{1: } {3:│}{1: } |
{1: }cd {3:│}{1: }ef |
{1: }ef {3:│}{1: }{8:yyy}{9: }|
- {1: }{8:xxx}{9: }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {1: }{8:xxx}{9: }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
: |
]])
@@ -886,15 +886,15 @@ int main(int argc, char **argv)
{1: } {3:│}{1: } |
{1: }cd {3:│}{1: }ef |
{1: }ef {3:│}{1: }{8:yyy}{9: }|
- {1: }{8:xxx}{9: }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {1: }{8:xxx}{9: }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
: |
]])
@@ -921,12 +921,12 @@ int main(int argc, char **argv)
{1: }foo {3:│}{1: }foo |
{1: }{2:------------------}{3:│}{1: }{4: }|
{1: }bar {3:│}{1: }bar |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
: |
]])
@@ -945,12 +945,12 @@ int main(int argc, char **argv)
{1: }foo {3:│}{1: }foo |
{1: }{2:------------------}{3:│}{1: }{4: }|
{1: }bar {3:│}{1: }bar |
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
- {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
+ {6:~ }{3:│}{6:~ }|
{7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
: |
]])
diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua
index 10dbc68672..9196c8af40 100644
--- a/test/functional/ui/embed_spec.lua
+++ b/test/functional/ui/embed_spec.lua
@@ -8,7 +8,7 @@ local clear = helpers.clear
local function test_embed(ext_linegrid)
local screen
local function startup(...)
- clear{headless=false, args={...}}
+ clear{args_rm={'--headless'}, args={...}}
-- attach immediately after startup, for early UI
screen = Screen.new(60, 8)
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 3be2182eb4..a567fbb941 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -5,6 +5,7 @@ local clear, feed = helpers.clear, helpers.feed
local command, feed_command = helpers.command, helpers.feed_command
local eval = helpers.eval
local eq = helpers.eq
+local insert = helpers.insert
local meths = helpers.meths
local curbufmeths = helpers.curbufmeths
local funcs = helpers.funcs
@@ -29,9 +30,27 @@ describe('floating windows', function()
[10] = {background = Screen.colors.LightGrey, underline = true, bold = true, foreground = Screen.colors.Magenta},
[11] = {bold = true, foreground = Screen.colors.Magenta},
[12] = {background = Screen.colors.Red, bold = true, foreground = Screen.colors.Blue1},
- [13] = {background = Screen.colors.WebGray}
+ [13] = {background = Screen.colors.WebGray},
+ [14] = {foreground = Screen.colors.Brown},
+ [15] = {background = Screen.colors.Grey20},
+ [16] = {background = Screen.colors.Grey20, bold = true, foreground = Screen.colors.Blue1},
+ [17] = {background = Screen.colors.Yellow},
}
+ it('behavior', function()
+ -- Create three windows and test that ":wincmd <direction>" changes to the
+ -- first window, if the previous window is invalid.
+ command('split')
+ meths.open_win(0, true, {width=10, height=10, relative='editor', row=0, col=0})
+ eq(1002, funcs.win_getid())
+ eq('editor', meths.win_get_config(1002).relative)
+ command([[
+ call nvim_win_close(1001, v:false)
+ wincmd j
+ ]])
+ eq(1000, funcs.win_getid())
+ end)
+
local function with_ext_multigrid(multigrid)
local screen
before_each(function()
@@ -42,13 +61,11 @@ describe('floating windows', function()
it('can be created and reconfigured', function()
local buf = meths.create_buf(false,false)
- local win = meths.open_win(buf, false, 20, 2, {relative='editor', row=2, col=5})
- meths.win_set_option(win , 'winhl', 'Normal:PMenu')
+ local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
local expected_pos = {
[3]={{id=1001}, 'NW', 1, 2, 5, true},
}
-
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -83,7 +100,7 @@ describe('floating windows', function()
end
- meths.win_config(win,0,0,{relative='editor', row=0, col=10})
+ meths.win_set_config(win, {relative='editor', row=0, col=10})
expected_pos[3][4] = 0
expected_pos[3][5] = 10
if multigrid then
@@ -151,20 +168,226 @@ describe('floating windows', function()
end
end)
+ it('return their configuration', function()
+ local buf = meths.create_buf(false, false)
+ local win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=3, col=5})
+ local expected = {anchor='NW', col=5, external=false, focusable=true, height=2, relative='editor', row=3, width=20}
+ eq(expected, meths.win_get_config(win))
+
+ eq({relative='', external=false, focusable=true}, meths.win_get_config(0))
+
+ if multigrid then
+ meths.win_set_config(win, {external=true, width=10, height=1})
+ eq({external=true,focusable=true,width=10,height=1,relative=''}, meths.win_get_config(win))
+ end
+ end)
+
+ it('defaults to nonumber and NormalFloat highlight', function()
+ command('set number')
+ command('hi NormalFloat guibg=#333333')
+ feed('ix<cr>y<cr><esc>gg')
+ local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ |
+ ## grid 2
+ {14: 1 }^x |
+ {14: 2 }y |
+ {14: 3 } |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {15:x }|
+ {15:y }|
+ {15: }|
+ {16:~ }|
+ ]], float_pos={[3] = {{id = 1001}, "NW", 1, 4, 10, true}}}
+ else
+ screen:expect([[
+ {14: 1 }^x |
+ {14: 2 }y |
+ {14: 3 } {15:x } |
+ {0:~ }{15:y }{0: }|
+ {0:~ }{15: }{0: }|
+ {0:~ }{16:~ }{0: }|
+ |
+ ]])
+ end
+
+ local buf = meths.create_buf(false, true)
+ meths.win_set_buf(win, buf)
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ |
+ ## grid 2
+ {14: 1 }^x |
+ {14: 2 }y |
+ {14: 3 } |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {15: }|
+ {16:~ }|
+ {16:~ }|
+ {16:~ }|
+ ]], float_pos={[3] = {{id = 1001}, "NW", 1, 4, 10, true}}}
+ else
+ screen:expect([[
+ {14: 1 }^x |
+ {14: 2 }y |
+ {14: 3 } {15: } |
+ {0:~ }{16:~ }{0: }|
+ {0:~ }{16:~ }{0: }|
+ {0:~ }{16:~ }{0: }|
+ |
+ ]])
+ end
+ end)
+
+ it('can have minimum size', function()
+ insert("the background text")
+ local buf = meths.create_buf(false, true)
+ meths.buf_set_lines(buf, 0, -1, true, {'x'})
+ local win = meths.open_win(buf, false, {relative='win', width=1, height=1, row=0, col=4, focusable=false})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ |
+ ## grid 2
+ the background tex^t |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 4
+ {1:x}|
+ ]], float_pos={
+ [4] = {{id = 1002}, "NW", 2, 0, 4, false}
+ }}
+ else
+ screen:expect([[
+ the {1:x}ackground tex^t |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ meths.win_set_config(win, {relative='win', row=0, col=15})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ |
+ ## grid 2
+ the background tex^t |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 4
+ {1:x}|
+ ]], float_pos={
+ [4] = {{id = 1002}, "NW", 2, 0, 15, false}
+ }}
+ else
+ screen:expect([[
+ the background {1:x}ex^t |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ meths.win_close(win,false)
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ |
+ ## grid 2
+ the background tex^t |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ]])
+ else
+ screen:expect([[
+ the background tex^t |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+ end)
+
it('API has proper error messages', function()
local buf = meths.create_buf(false,false)
- eq({false, "Invalid options key 'bork'"},
- meth_pcall(meths.open_win,buf, false, 20, 2, {bork=true}))
- eq({false, "'win' option is only valid with relative='win'"},
- meth_pcall(meths.open_win,buf, false, 20, 2, {relative='editor',row=0,col=0,win=0}))
- eq({false, "Only one of 'relative' and 'external' should be used"},
- meth_pcall(meths.open_win,buf, false, 20, 2, {relative='editor',row=0,col=0,external=true}))
- eq({false, "Invalid value of 'relative' option"},
- meth_pcall(meths.open_win,buf, false, 20, 2, {relative='shell',row=0,col=0}))
- eq({false, "Invalid value of 'anchor' option"},
- meth_pcall(meths.open_win,buf, false, 20, 2, {relative='editor',row=0,col=0,anchor='bottom'}))
+ eq({false, "Invalid key 'bork'"},
+ meth_pcall(meths.open_win,buf, false, {width=20,height=2,bork=true}))
+ eq({false, "'win' key is only valid with relative='win'"},
+ meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0}))
+ eq({false, "Only one of 'relative' and 'external' must be used"},
+ meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true}))
+ eq({false, "Invalid value of 'relative' key"},
+ meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0}))
+ eq({false, "Invalid value of 'anchor' key"},
+ meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'}))
eq({false, "All of 'relative', 'row', and 'col' has to be specified at once"},
- meth_pcall(meths.open_win,buf, false, 20, 2, {relative='editor'}))
+ meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='editor'}))
+ eq({false, "'width' key must be a positive Integer"},
+ meth_pcall(meths.open_win,buf, false, {width=-1,height=2,relative='editor'}))
+ eq({false, "'height' key must be a positive Integer"},
+ meth_pcall(meths.open_win,buf, false, {width=20,height=-1,relative='editor'}))
+ eq({false, "'height' key must be a positive Integer"},
+ meth_pcall(meths.open_win,buf, false, {width=20,height=0,relative='editor'}))
+ eq({false, "Must specify 'width' and 'height'"},
+ meth_pcall(meths.open_win,buf, false, {relative='editor'}))
end)
it('can be placed relative window or cursor', function()
@@ -210,8 +433,7 @@ describe('floating windows', function()
local buf = meths.create_buf(false,false)
-- no 'win' arg, relative default window
- local win = meths.open_win(buf, false, 20, 2, {relative='win', row=0, col=10})
- meths.win_set_option(win, 'winhl', 'Normal:PMenu')
+ local win = meths.open_win(buf, false, {relative='win', width=20, height=2, row=0, col=10})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -252,7 +474,7 @@ describe('floating windows', function()
]])
end
- meths.win_config(win, -1, -1, {relative='cursor', row=1, col=-2})
+ meths.win_set_config(win, {relative='cursor', row=1, col=-2})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -293,7 +515,7 @@ describe('floating windows', function()
]])
end
- meths.win_config(win, -1, -1, {relative='cursor', row=0, col=0, anchor='SW'})
+ meths.win_set_config(win, {relative='cursor', row=0, col=0, anchor='SW'})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -335,7 +557,7 @@ describe('floating windows', function()
end
- meths.win_config(win, -1, -1, {relative='win', win=oldwin, row=1, col=10, anchor='NW'})
+ meths.win_set_config(win, {relative='win', win=oldwin, row=1, col=10, anchor='NW'})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -376,7 +598,7 @@ describe('floating windows', function()
]])
end
- meths.win_config(win, -1, -1, {relative='win', win=oldwin, row=3, col=39, anchor='SE'})
+ meths.win_set_config(win, {relative='win', win=oldwin, row=3, col=39, anchor='SE'})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -417,7 +639,7 @@ describe('floating windows', function()
]])
end
- meths.win_config(win, -1, -1, {relative='win', win=0, row=0, col=50, anchor='NE'})
+ meths.win_set_config(win, {relative='win', win=0, row=0, col=50, anchor='NE'})
if multigrid then
screen:expect{grid=[[
## grid 1
@@ -459,6 +681,66 @@ describe('floating windows', function()
end
end)
+ it('validates cursor even when window is not entered', function()
+ screen:try_resize(30,5)
+ command("set nowrap")
+ insert([[some text that is wider than the window]])
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ |
+ ## grid 2
+ that is wider than the windo^w |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ]])
+ else
+ screen:expect([[
+ that is wider than the windo^w |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end
+
+ local buf = meths.create_buf(false,true)
+ meths.buf_set_lines(buf, 0, -1, true, {'some floaty text'})
+ meths.open_win(buf, false, {relative='editor', width=20, height=1, row=3, col=1})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ |
+ ## grid 2
+ that is wider than the windo^w |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 4
+ {1:some floaty text }|
+ ]], float_pos={
+ [4] = {{id = 1002}, "NW", 1, 3, 1, true}
+ }}
+ else
+ screen:expect([[
+ that is wider than the windo^w |
+ {0:~ }|
+ {0:~ }|
+ {0:~}{1:some floaty text }{0: }|
+ |
+ ]])
+ end
+ end)
+
if multigrid then
pending("supports second UI without multigrid", function()
local session2 = helpers.connect(eval('v:servername'))
@@ -467,8 +749,7 @@ describe('floating windows', function()
screen2:attach(nil, session2)
screen2:set_default_attr_ids(attrs)
local buf = meths.create_buf(false,false)
- local win = meths.open_win(buf, true, 20, 2, {relative='editor', row=2, col=5})
- meths.win_set_option(win, 'winhl', 'Normal:PMenu')
+ meths.open_win(buf, true, {relative='editor', width=20, height=2, row=2, col=5})
local expected_pos = {
[2]={{id=1001}, 'NW', 1, 2, 5}
}
@@ -501,8 +782,7 @@ describe('floating windows', function()
it('handles resized screen', function()
local buf = meths.create_buf(false,false)
meths.buf_set_lines(buf, 0, -1, true, {'such', 'very', 'float'})
- local win = meths.open_win(buf, false, 15, 4, {relative='editor', row=2, col=10})
- meths.win_set_option(win , 'winhl', 'Normal:PMenu')
+ local win = meths.open_win(buf, false, {relative='editor', width=15, height=4, row=2, col=10})
local expected_pos = {
[4]={{id=1002}, 'NW', 1, 2, 10, true},
}
@@ -673,15 +953,15 @@ describe('floating windows', function()
screen:expect([[
|
{0:~ }|
+ {0:~ }{1:such }{0: }|
{0:~ }{1:very }{0: }|
{0:~ }{1:^float }{0: }|
- {0:~ }|
- {0:~ }|
+ {0:~ }{2:~ }{0: }|
|
]])
end
- meths.win_config(win, -1, 3, {})
+ meths.win_set_config(win, {height=3})
feed('gg')
if multigrid then
screen:expect{grid=[[
@@ -1010,10 +1290,126 @@ describe('floating windows', function()
screen:expect([[
|
{0:~ }|
- {0:~ }{1:^such }{0: }|
+ {0:~ }{1:^such }{0: }|
+ {0:~ }{1:very }{0: }|
+ {0:~ }{1:float }{0: }|
{0:~ }|
+ |
+ ]])
+ end
+ end)
+
+ it('does not crash with inccommand #9379', function()
+ local expected_pos = {
+ [3]={{id=1001}, 'NW', 1, 2, 0, true},
+ }
+
+ command("set inccommand=split")
+ command("set laststatus=2")
+
+ local buf = meths.create_buf(false,false)
+ meths.open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0})
+
+ insert([[
+ foo
+ bar
+ ]])
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {5:[No Name] }|
+ |
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {1:foo }|
+ {1:bar }|
+ {1:^ }|
+ ]], float_pos=expected_pos}
+ else
+ screen:expect([[
+ |
{0:~ }|
+ {1:foo }{0: }|
+ {1:bar }{0: }|
+ {1:^ }{0: }|
+ {5:[No Name] }|
+ |
+ ]])
+ end
+
+ feed(':%s/.')
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {5:[Preview] }|
+ :%s/.^ |
+ ## grid 2
+ |
+ ## grid 3
+ {17:f}{1:oo }|
+ {17:b}{1:ar }|
+ {1: }|
+ ]], float_pos=expected_pos}
+ else
+ screen:expect([[
+ |
+ {5:[No Name] }|
+ {17:f}{1:oo } |
+ {17:b}{1:ar } |
+ {1: }{0: }|
+ {5:[Preview] }|
+ :%s/.^ |
+ ]])
+ end
+
+ feed('<Esc>')
+
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {5:[No Name] }|
+ |
+ ## grid 2
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {1:foo }|
+ {1:bar }|
+ {1:^ }|
+ ]], float_pos=expected_pos}
+ else
+ screen:expect([[
+ |
{0:~ }|
+ {1:foo }{0: }|
+ {1:bar }{0: }|
+ {1:^ }{0: }|
+ {5:[No Name] }|
|
]])
end
@@ -1021,7 +1417,7 @@ describe('floating windows', function()
it('does not crash when set cmdheight #9680', function()
local buf = meths.create_buf(false,false)
- meths.open_win(buf, false, 20, 2, {relative='editor', row=2, col=5})
+ meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
command("set cmdheight=2")
eq(1, meths.eval('1'))
end)
@@ -1029,7 +1425,7 @@ describe('floating windows', function()
describe('and completion', function()
before_each(function()
local buf = meths.create_buf(false,false)
- local win = meths.open_win(buf, true, 12, 4, {relative='editor', row=2, col=5})
+ local win = meths.open_win(buf, true, {relative='editor', width=12, height=4, row=2, col=5})
meths.win_set_option(win , 'winhl', 'Normal:ErrorMsg')
if multigrid then
screen:expect{grid=[[
@@ -1266,7 +1662,7 @@ describe('floating windows', function()
]], float_pos={
[3] = {{ id = 1001 }, "NW", 1, 2, 5, true},
}, popupmenu={
- anchor = {0, 2, 3}, items = items, pos = 0
+ anchor = {3, 0, 2}, items = items, pos = 0
}}
else
screen:expect{grid=[[
@@ -1278,7 +1674,7 @@ describe('floating windows', function()
{0:~ }{12:~ }{0: }|
{3:-- INSERT --} |
]], popupmenu={
- anchor = {2, 7}, items = items, pos = 0
+ anchor = {1, 2, 7}, items = items, pos = 0
}}
end
@@ -1348,7 +1744,7 @@ describe('floating windows', function()
]], float_pos={
[3] = {{ id = 1001 }, "NW", 1, 2, 5, true},
}, popupmenu={
- anchor = {0, 0, 2}, items = items, pos = 0
+ anchor = {2, 0, 0}, items = items, pos = 0
}}
else
screen:expect{grid=[[
@@ -1360,7 +1756,7 @@ describe('floating windows', function()
{0:~ }{12:~ }{0: }|
{3:-- INSERT --} |
]], popupmenu={
- anchor = {0, 0}, items = items, pos = 0
+ anchor = {1, 0, 0}, items = items, pos = 0
}}
end
@@ -1402,9 +1798,233 @@ describe('floating windows', function()
]])
end
end)
-
end)
+ describe('float shown after pum', function()
+ local win
+ before_each(function()
+ command('hi NormalFloat guibg=#333333')
+ feed('i')
+ funcs.complete(1, {'aa', 'word', 'longtext'})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {3:-- INSERT --} |
+ ## grid 2
+ aa^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {13:aa }|
+ {1:word }|
+ {1:longtext }|
+ ]], float_pos={
+ [3] = {{id = -1}, "NW", 2, 1, 0, false}}
+ }
+ else
+ screen:expect([[
+ aa^ |
+ {13:aa }{0: }|
+ {1:word }{0: }|
+ {1:longtext }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ end
+
+ local buf = meths.create_buf(false,true)
+ meths.buf_set_lines(buf,0,-1,true,{"some info", "about item"})
+ win = meths.open_win(buf, false, {relative='cursor', width=12, height=2, row=1, col=10})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {3:-- INSERT --} |
+ ## grid 2
+ aa^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {13:aa }|
+ {1:word }|
+ {1:longtext }|
+ ## grid 5
+ {15:some info }|
+ {15:about item }|
+ ]], float_pos={
+ [3] = {{id = -1}, "NW", 2, 1, 0, false},
+ [5] = {{id = 1002}, "NW", 2, 1, 12, true},
+ }}
+ else
+ screen:expect([[
+ aa^ |
+ {13:aa }{15:e info }{0: }|
+ {1:word }{15:ut item }{0: }|
+ {1:longtext }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ end
+ end)
+
+ it('and close pum first', function()
+ feed('<c-y>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {3:-- INSERT --} |
+ ## grid 2
+ aa^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 5
+ {15:some info }|
+ {15:about item }|
+ ]], float_pos={
+ [5] = {{id = 1002}, "NW", 2, 1, 12, true},
+ }}
+ else
+ screen:expect([[
+ aa^ |
+ {0:~ }{15:some info }{0: }|
+ {0:~ }{15:about item }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ end
+
+ meths.win_close(win, false)
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {3:-- INSERT --} |
+ ## grid 2
+ aa^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ]])
+ else
+ screen:expect([[
+ aa^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ end
+ end)
+
+ it('and close float first', function()
+ meths.win_close(win, false)
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {3:-- INSERT --} |
+ ## grid 2
+ aa^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {13:aa }|
+ {1:word }|
+ {1:longtext }|
+ ]], float_pos={
+ [3] = {{id = -1}, "NW", 2, 1, 0, false},
+ }}
+ else
+ screen:expect([[
+ aa^ |
+ {13:aa }{0: }|
+ {1:word }{0: }|
+ {1:longtext }{0: }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ end
+
+ feed('<c-y>')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {3:-- INSERT --} |
+ ## grid 2
+ aa^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ]])
+ else
+ screen:expect([[
+ aa^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:-- INSERT --} |
+ ]])
+ end
+ end)
+ end)
describe("handles :wincmd", function()
local win
@@ -1415,9 +2035,8 @@ describe('floating windows', function()
command("set hidden")
meths.buf_set_lines(0,0,-1,true,{"x"})
local buf = meths.create_buf(false,false)
- win = meths.open_win(buf, false, 20, 2, {relative='editor', row=2, col=5})
+ win = meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5})
meths.buf_set_lines(buf,0,-1,true,{"y"})
- meths.win_set_option(win , 'winhl', 'Normal:PMenu')
expected_pos = {
[3]={{id=1001}, 'NW', 1, 2, 5, true}
}
@@ -1526,7 +2145,7 @@ describe('floating windows', function()
end)
it("w with focusable=false", function()
- meths.win_config(win, -1, -1, {focusable=false})
+ meths.win_set_config(win, {focusable=false})
expected_pos[3][6] = false
feed("<c-w>wi") -- i to provoke redraw
if multigrid then
@@ -1740,7 +2359,7 @@ describe('floating windows', function()
end)
it("focus by mouse (focusable=false)", function()
- meths.win_config(win, -1, -1, {focusable=false})
+ meths.win_set_config(win, {focusable=false})
meths.buf_set_lines(0, -1, -1, true, {"a"})
expected_pos[3][6] = false
if multigrid then
@@ -2074,39 +2693,6 @@ describe('floating windows', function()
{1:y }|
{2:~ }|
## grid 4
- {1:^y }|
- {2:~ }|
- ]], float_pos=expected_pos}
- else
- screen:expect([[
- {1:^y }|
- {2:~ }|
- {4:[No N}{1:y }{4: }|
- x {2:~ } |
- {0:~ }|
- {5:[No Name] [+] }|
- |
- ]])
- end
-
- feed(":set winhighlight=<cr><c-l>")
- if multigrid then
- screen:expect{grid=[[
- ## grid 1
- [4:----------------------------------------]|
- [4:----------------------------------------]|
- {4:[No Name] [+] }|
- [2:----------------------------------------]|
- [2:----------------------------------------]|
- {5:[No Name] [+] }|
- |
- ## grid 2
- x |
- {0:~ }|
- ## grid 3
- {1:y }|
- {2:~ }|
- ## grid 4
^y |
{0:~ }|
]], float_pos=expected_pos}
@@ -2122,7 +2708,6 @@ describe('floating windows', function()
]])
end
-
feed("<c-w>j")
if multigrid then
screen:expect{grid=[[
@@ -2405,6 +2990,119 @@ describe('floating windows', function()
eq(exited, true)
end)
+ it(':quit two floats in a row', function()
+ -- enter first float
+ feed('<c-w><c-w>')
+ -- enter second float
+ meths.open_win(0, true, {relative='editor', width=20, height=2, row=4, col=8})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ |
+ ## grid 2
+ x |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {1:y }|
+ {2:~ }|
+ ## grid 4
+ {1:^y }|
+ {2:~ }|
+ ]], float_pos={
+ [3] = {{id = 1001}, "NW", 1, 2, 5, true},
+ [4] = {{id = 1002}, "NW", 1, 4, 8, true}
+ }}
+ else
+ screen:expect([[
+ x |
+ {0:~ }|
+ {0:~ }{1:y }{0: }|
+ {0:~ }{2:~ }{0: }|
+ {0:~ }{1:^y }{0: }|
+ {0:~ }{2:~ }{0: }|
+ |
+ ]])
+ end
+
+ feed(':quit<cr>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ {5:[No Name] [+] }|
+ :quit |
+ ## grid 2
+ x |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ {1:^y }|
+ {2:~ }|
+ ]], float_pos={
+ [3] = {{id = 1001}, "NW", 1, 2, 5, true},
+ }}
+ else
+ screen:expect([[
+ x |
+ {0:~ }|
+ {0:~ }{1:^y }{0: }|
+ {0:~ }{2:~ }{0: }|
+ {0:~ }|
+ {5:[No Name] [+] }|
+ :quit |
+ ]])
+ end
+
+ feed(':quit<cr>')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ :quit |
+ ## grid 2
+ ^x |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ]])
+ else
+ screen:expect([[
+ ^x |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ :quit |
+ ]])
+ end
+
+ eq(2, eval('1+1'))
+ end)
+
it("o (:only) non-float", function()
feed("<c-w>o")
if multigrid then
@@ -2659,23 +3357,23 @@ describe('floating windows', function()
x |
{0:~ }|
## grid 3
- {1:^y }|
- {2:~ }|
+ ^y |
+ {0:~ }|
]]}
else
screen:expect([[
x |
{0:~ }|
{5:[No Name] [+] }|
- {1:^y }|
- {2:~ }|
+ ^y |
+ {0:~ }|
{4:[No Name] [+] }|
|
]])
end
if multigrid then
- meths.win_config(0,-1,-1,{external=true})
+ meths.win_set_config(0, {external=true, width=30, height=2})
expected_pos = {[3]={external=true}}
screen:expect{grid=[[
## grid 1
@@ -2693,12 +3391,12 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
## grid 3
- {1:^y }|
- {2:~ }|
+ ^y |
+ {0:~ }|
]], float_pos=expected_pos}
else
eq({false, "UI doesn't support external windows"},
- meth_pcall(meths.win_config, 0,-1,-1,{external=true}))
+ meth_pcall(meths.win_set_config, 0, {external=true, width=30, height=2}))
return
end
@@ -2717,11 +3415,10 @@ describe('floating windows', function()
x |
{0:~ }|
## grid 3
- {1:^y }|
- {2:~ }|
+ ^y |
+ {0:~ }|
]])
end
-
end)
it('movements with nested split layout', function()
@@ -2786,8 +3483,8 @@ describe('floating windows', function()
4 |
{0:~ }|
## grid 3
- ^5 |
- {0:~ }|
+ {1:^5 }|
+ {2:~ }|
## grid 4
2 |
{0:~ }|
@@ -2802,8 +3499,8 @@ describe('floating windows', function()
screen:expect([[
1 {5:│}2 |
{0:~ }{5:│}{0:~ }|
- {5:[No N}^5 {5:ame] [+] }|
- 3 {0:~ } |
+ {5:[No N}{1:^5 }{5:ame] [+] }|
+ 3 {2:~ } |
{0:~ }{5:│}{0:~ }|
{5:[No Name] [+] [No Name] [+] }|
:enew |
@@ -2895,13 +3592,14 @@ describe('floating windows', function()
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
- {4:[No Name] [+] }|
+ [2:----------------------------------------]|
:tabnext |
## grid 2
^x |
{0:~ }|
{0:~ }|
{0:~ }|
+ {0:~ }|
## grid 3
{1:y }|
{2:~ }|
@@ -2919,7 +3617,7 @@ describe('floating windows', function()
{0:~ }{1:y }{0: }|
{0:~ }{2:~ }{0: }|
{0:~ }|
- {4:[No Name] [+] }|
+ {0:~ }|
:tabnext |
]])
end
@@ -2940,6 +3638,7 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
{0:~ }|
+ {0:~ }|
## grid 3
{1:y }|
{2:~ }|
@@ -2965,7 +3664,8 @@ describe('floating windows', function()
it(":tabnew and :tabnext (external)", function()
if multigrid then
- meths.win_config(win,-1,-1,{external=true})
+ -- also test external window wider than main screen
+ meths.win_set_config(win, {external=true, width=65, height=4})
expected_pos = {[3]={external=true}}
feed(":tabnew<cr>")
screen:expect{grid=[[
@@ -2985,8 +3685,10 @@ describe('floating windows', function()
{0:~ }|
{0:~ }|
## grid 3
- {1:y }|
- {2:~ }|
+ y |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
## grid 4
^ |
{0:~ }|
@@ -2996,7 +3698,7 @@ describe('floating windows', function()
]], float_pos=expected_pos}
else
eq({false, "UI doesn't support external windows"},
- meth_pcall(meths.win_config, 0,-1,-1,{external=true}))
+ meth_pcall(meths.win_set_config, 0, {external=true, width=65, height=4}))
end
feed(":tabnext<cr>")
@@ -3008,16 +3710,19 @@ describe('floating windows', function()
[2:----------------------------------------]|
[2:----------------------------------------]|
[2:----------------------------------------]|
- {4:[No Name] [+] }|
+ [2:----------------------------------------]|
:tabnext |
## grid 2
^x |
{0:~ }|
{0:~ }|
{0:~ }|
+ {0:~ }|
## grid 3
- {1:y }|
- {2:~ }|
+ y |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
## grid 4
|
{0:~ }|
@@ -3036,21 +3741,25 @@ describe('floating windows', function()
[4:----------------------------------------]|
[4:----------------------------------------]|
[4:----------------------------------------]|
- {4:[No Name] }|
+ [4:----------------------------------------]|
:tabnext |
## grid 2
x |
{0:~ }|
{0:~ }|
{0:~ }|
+ {0:~ }|
## grid 3
- {1:y }|
- {2:~ }|
+ y |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
## grid 4
^ |
{0:~ }|
{0:~ }|
{0:~ }|
+ {0:~ }|
]], float_pos=expected_pos}
end
end)
@@ -3063,6 +3772,5 @@ describe('floating windows', function()
describe('without ext_multigrid', function()
with_ext_multigrid(false)
end)
-
end)
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 943cbcef56..5fa299bed9 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -39,11 +39,11 @@ describe("folded lines", function()
screen:expect([[
{7:+ }{5: 1 +-- 2 lines: ·························}|
{7:+ }{5: 0 ^+-- 2 lines: ·························}|
- {7: }{1:~ }|
- {7: }{1:~ }|
- {7: }{1:~ }|
- {7: }{1:~ }|
- {7: }{1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
:set foldcolumn=2 |
]])
end)
@@ -93,12 +93,12 @@ describe("folded lines", function()
feed_command("set number foldcolumn=2")
screen:expect([[
{7:+ }{5: 1 ^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة···········}|
- {7: }{1:~ }|
- {7: }{1:~ }|
- {7: }{1:~ }|
- {7: }{1:~ }|
- {7: }{1:~ }|
- {7: }{1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
:set number foldcolumn=2 |
]])
@@ -106,12 +106,12 @@ describe("folded lines", function()
feed_command("set rightleft")
screen:expect([[
{5:+-- 2 lines: å ······················^· 1 }{7: +}|
- {1: ~}{7: }|
- {1: ~}{7: }|
- {1: ~}{7: }|
- {1: ~}{7: }|
- {1: ~}{7: }|
- {1: ~}{7: }|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
+ {1: ~}|
:set rightleft |
]])
@@ -178,7 +178,7 @@ describe("folded lines", function()
{1::}set foldmethod=manual |
{1::}let x = 1 |
{1::}^ |
- {1::~ }|
+ {1:~ }|
{3:[Command Line] }|
: |
]])
@@ -189,8 +189,8 @@ describe("folded lines", function()
{2:[No Name] }|
{1::}{5:^+-- 2 lines: set foldmethod=manual·········}|
{1::} |
- {1::~ }|
- {1::~ }|
+ {1:~ }|
+ {1:~ }|
{3:[Command Line] }|
: |
]])
@@ -214,7 +214,7 @@ describe("folded lines", function()
{1:/}alpha |
{1:/}{6:omega} |
{1:/}^ |
- {1:/~ }|
+ {1:~ }|
{3:[Command Line] }|
/ |
]])
@@ -224,9 +224,9 @@ describe("folded lines", function()
|
{2:[No Name] }|
{1:/}{5:^+-- 3 lines: alpha·························}|
- {1:/~ }|
- {1:/~ }|
- {1:/~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
{3:[Command Line] }|
/ |
]])
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 3ee3f173d6..85b5aed2f8 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -748,6 +748,66 @@ describe('CursorLine highlight', function()
]])
end)
+ it('always updated. vim-patch:8.1.0849', function()
+ local screen = Screen.new(50,5)
+ screen:set_default_attr_ids({
+ [1] = {foreground = Screen.colors.SlateBlue},
+ [2] = {bold = true, foreground = Screen.colors.Brown},
+ [3] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [4] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90},
+ [5] = {background = Screen.colors.Gray90},
+ [6] = {bold = true, foreground = Screen.colors.Blue1},
+ [7] = {background = Screen.colors.LightRed},
+ [8] = {foreground = Screen.colors.Brown},
+ })
+ screen:attach()
+ command('set cursorline relativenumber')
+ command('call setline(1, ["","1","2","3",""])')
+ feed('Gy3k')
+ screen:expect([[
+ {2: 0 }{5:^1 }|
+ {8: 1 }2 |
+ {8: 2 }3 |
+ {8: 3 } |
+ 4 lines yanked |
+ ]])
+ feed('jj')
+ screen:expect([[
+ {8: 2 }1 |
+ {8: 1 }2 |
+ {2: 0 }{5:^3 }|
+ {8: 1 } |
+ 4 lines yanked |
+ ]])
+ end)
+
+ it('with visual area. vim-patch:8.1.1001', function()
+ local screen = Screen.new(50,5)
+ screen:set_default_attr_ids({
+ [1] = {foreground = Screen.colors.SlateBlue},
+ [2] = {bold = true, foreground = Screen.colors.Brown},
+ [3] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [4] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90},
+ [5] = {background = Screen.colors.Gray90},
+ [6] = {bold = true, foreground = Screen.colors.Blue1},
+ [7] = {background = Screen.colors.LightRed},
+ [8] = {foreground = Screen.colors.Brown},
+ [9] = {background = Screen.colors.LightGrey},
+ [10] = {bold = true},
+ })
+ screen:attach()
+ command('set cursorline')
+ command('call setline(1, repeat(["abc"], 50))')
+ feed('V<C-f>zbkkjk')
+ screen:expect([[
+ {9:abc} |
+ ^a{9:bc} |
+ abc |
+ abc |
+ {10:-- VISUAL LINE --} |
+ ]])
+ end)
+
it('with split-windows in diff-mode', function()
local screen = Screen.new(50,12)
screen:set_default_attr_ids({
@@ -781,9 +841,9 @@ describe('CursorLine highlight', function()
{1: }extra line! {4:│}{1: }extra line! |
{1: }last line ... {4:│}{1: }last line ... |
{1: } {4:│}{1: } |
- {1: }{8:~ }{4:│}{1: }{8:~ }|
- {1: }{8:~ }{4:│}{1: }{8:~ }|
- {1: }{8:~ }{4:│}{1: }{8:~ }|
+ {8:~ }{4:│}{8:~ }|
+ {8:~ }{4:│}{8:~ }|
+ {8:~ }{4:│}{8:~ }|
{4:[No Name] [+] }{9:[No Name] [+] }|
|
]])
@@ -796,9 +856,9 @@ describe('CursorLine highlight', function()
{1: }extra line! {4:│}{1: }extra line! |
{1: }last line ... {4:│}{1: }last line ... |
{1: }{7: }{4:│}{1: }{7:^ }|
- {1: }{8:~ }{4:│}{1: }{8:~ }|
- {1: }{8:~ }{4:│}{1: }{8:~ }|
- {1: }{8:~ }{4:│}{1: }{8:~ }|
+ {8:~ }{4:│}{8:~ }|
+ {8:~ }{4:│}{8:~ }|
+ {8:~ }{4:│}{8:~ }|
{4:[No Name] [+] }{9:[No Name] [+] }|
|
]])
@@ -815,9 +875,9 @@ describe('CursorLine highlight', function()
{1: }extra line! {4:│}{1: }extra line! |
{1: }last line ... {4:│}{1: }last line ... |
{1: } {4:│}{1: } |
- {1: }{8:~ }{4:│}{1: }{8:~ }|
- {1: }{8:~ }{4:│}{1: }{8:~ }|
- {1: }{8:~ }{4:│}{1: }{8:~ }|
+ {8:~ }{4:│}{8:~ }|
+ {8:~ }{4:│}{8:~ }|
+ {8:~ }{4:│}{8:~ }|
{4:[No Name] [+] }{9:[No Name] [+] }|
|
]], {
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index c215ece2f2..4f243e6413 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -2607,3 +2607,30 @@ it(':substitute with inccommand during :terminal activity', function()
end)
end)
+
+it(':substitute with inccommand, timer-induced :redraw #9777', function()
+ local screen = Screen.new(30,12)
+ clear()
+ command('set cmdwinheight=3')
+ command('call timer_start(10, {-> execute("redraw")}, {"repeat":-1})')
+ command('call timer_start(10, {-> execute("redrawstatus")}, {"repeat":-1})')
+ common_setup(screen, 'split', 'foo bar baz\nbar baz fox\nbar foo baz')
+
+ feed('gg')
+ feed(':%s/foo/ZZZ')
+ sleep(20) -- Allow some timer activity.
+ screen:expect([[
+ {12:ZZZ} bar baz |
+ bar baz fox |
+ bar {12:ZZZ} baz |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {11:[No Name] [+] }|
+ |1| {12:ZZZ} bar baz |
+ |3| bar {12:ZZZ} baz |
+ {15:~ }|
+ {10:[Preview] }|
+ :%s/foo/ZZZ^ |
+ ]])
+end)
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 850efed282..121cbe47d6 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -30,6 +30,24 @@ describe('mappings', function()
add_mapping('<c-s-a-d-up>', '<c-s-a-d-up>')
add_mapping('<c-d-a>', '<c-d-a>')
add_mapping('<d-1>', '<d-1>')
+ add_mapping('<khome>','<khome>')
+ add_mapping('<kup>','<kup>')
+ add_mapping('<kpageup>','<kpageup>')
+ add_mapping('<kleft>','<kleft>')
+ add_mapping('<korigin>','<korigin>')
+ add_mapping('<kright>','<kright>')
+ add_mapping('<kend>','<kend>')
+ add_mapping('<kdown>','<kdown>')
+ add_mapping('<kpagedown>','<kpagedown>')
+ add_mapping('<kinsert>','<kinsert>')
+ add_mapping('<kdel>','<kdel>')
+ add_mapping('<kdivide>','<kdivide>')
+ add_mapping('<kmultiply>','<kmultiply>')
+ add_mapping('<kminus>','<kminus>')
+ add_mapping('<kplus>','<kplus>')
+ add_mapping('<kenter>','<kenter>')
+ add_mapping('<kcomma>','<kcomma>')
+ add_mapping('<kequal>','<kequal>')
end)
it('ok', function()
@@ -48,6 +66,42 @@ describe('mappings', function()
check_mapping('<c-d-a>', '<c-d-a>')
check_mapping('<d-c-a>', '<c-d-a>')
check_mapping('<d-1>', '<d-1>')
+ check_mapping('<khome>','<khome>')
+ check_mapping('<KP7>','<khome>')
+ check_mapping('<kup>','<kup>')
+ check_mapping('<KP8>','<kup>')
+ check_mapping('<kpageup>','<kpageup>')
+ check_mapping('<KP9>','<kpageup>')
+ check_mapping('<kleft>','<kleft>')
+ check_mapping('<KP4>','<kleft>')
+ check_mapping('<korigin>','<korigin>')
+ check_mapping('<KP5>','<korigin>')
+ check_mapping('<kright>','<kright>')
+ check_mapping('<KP6>','<kright>')
+ check_mapping('<kend>','<kend>')
+ check_mapping('<KP1>','<kend>')
+ check_mapping('<kdown>','<kdown>')
+ check_mapping('<KP2>','<kdown>')
+ check_mapping('<kpagedown>','<kpagedown>')
+ check_mapping('<KP3>','<kpagedown>')
+ check_mapping('<kinsert>','<kinsert>')
+ check_mapping('<KP0>','<kinsert>')
+ check_mapping('<kdel>','<kdel>')
+ check_mapping('<KPPeriod>','<kdel>')
+ check_mapping('<kdivide>','<kdivide>')
+ check_mapping('<KPDiv>','<kdivide>')
+ check_mapping('<kmultiply>','<kmultiply>')
+ check_mapping('<KPMult>','<kmultiply>')
+ check_mapping('<kminus>','<kminus>')
+ check_mapping('<KPMinus>','<kminus>')
+ check_mapping('<kplus>','<kplus>')
+ check_mapping('<KPPlus>','<kplus>')
+ check_mapping('<kenter>','<kenter>')
+ check_mapping('<KPEnter>','<kenter>')
+ check_mapping('<kcomma>','<kcomma>')
+ check_mapping('<KPComma>','<kcomma>')
+ check_mapping('<kequal>','<kequal>')
+ check_mapping('<KPEquals>','<kequal>')
end)
end)
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 388c6b3e95..d49d2f0316 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -22,8 +22,129 @@ describe('ui/ext_messages', function()
[6] = {bold = true, reverse = true},
})
end)
+ after_each(function()
+ os.remove('Xtest')
+ end)
+
+ it('msg_show kind=confirm,confirm_sub,emsg,wmsg', function()
+ feed('iline 1\nline 2<esc>')
+
+ -- kind=confirm
+ feed(':echo confirm("test")<cr>')
+ screen:expect{grid=[[
+ line 1 |
+ line ^2 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], messages={ {
+ content = {{"\ntest\n[O]k: ", 4}},
+ kind = 'confirm',
+ }}}
+ feed('<cr><cr>')
+ screen:expect{grid=[[
+ line 1 |
+ line ^2 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], messages={ {
+ content = { { "\ntest\n[O]k: ", 4 } },
+ kind = "confirm"
+ }, {
+ content = { { "1" } },
+ kind = "echo"
+ }, {
+ content = { { "Press ENTER or type command to continue", 4 } },
+ kind = "return_prompt"
+ } }}
+ feed('<cr><cr>')
+
+ -- kind=confirm_sub
+ feed(':%s/i/X/gc<cr>')
+ screen:expect{grid=[[
+ l{7:i}ne 1 |
+ l{8:i}ne ^2 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], attr_ids={
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [3] = {bold = true},
+ [4] = {bold = true, foreground = Screen.colors.SeaGreen4},
+ [5] = {foreground = Screen.colors.Blue1},
+ [6] = {bold = true, reverse = true},
+ [7] = {reverse = true},
+ [8] = {background = Screen.colors.Yellow},
+ }, messages={ {
+ content = { { "replace with X (y/n/a/q/l/^E/^Y)?", 4 } },
+ kind = "confirm_sub"
+ } }}
+ feed('nq')
+
+ -- kind=wmsg (editing readonly file)
+ command('write Xtest')
+ command('set readonly nohls')
+ feed('G$x')
+ screen:expect{grid=[[
+ line 1 |
+ {IGNORE}|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], attr_ids={
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [7] = {foreground = Screen.colors.Red},
+ }, messages={ {
+ content = { { "W10: Warning: Changing a readonly file", 7 } },
+ kind = "wmsg"
+ }
+ }}
+
+ -- kind=wmsg ('wrapscan' after search reaches EOF)
+ feed('uG$/i<cr>')
+ screen:expect{grid=[[
+ l^ine 1 |
+ line 2 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], attr_ids={
+ [1] = {bold = true, foreground = Screen.colors.Blue1},
+ [2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [3] = {bold = true},
+ [4] = {bold = true, foreground = Screen.colors.SeaGreen4},
+ [5] = {foreground = Screen.colors.Blue1},
+ [6] = {bold = true, reverse = true},
+ [7] = {foreground = Screen.colors.Red},
+ }, messages={ {
+ content = { { "search hit BOTTOM, continuing at TOP", 7 } },
+ kind = "wmsg"
+ } }}
+
+ -- kind=emsg after :throw
+ feed(':throw "foo"<cr>')
+ screen:expect{grid=[[
+ l^ine 1 |
+ line 2 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], messages={ {
+ content = { { "Error detected while processing :", 2 } },
+ kind = "emsg"
+ }, {
+ content = { { "E605: Exception not caught: foo", 2 } },
+ kind = ""
+ }, {
+ content = { { "Press ENTER or type command to continue", 4 } },
+ kind = "return_prompt"
+ } }
+ }
+ end)
- it('supports :echoerr', function()
+ it(':echoerr', function()
feed(':echoerr "raa"<cr>')
screen:expect{grid=[[
^ |
@@ -142,7 +263,7 @@ describe('ui/ext_messages', function()
}}
end)
- it('supports showmode', function()
+ it('&showmode', function()
command('imap <f2> <cmd>echomsg "stuff"<cr>')
feed('i')
screen:expect{grid=[[
@@ -179,7 +300,7 @@ describe('ui/ext_messages', function()
{1:~ }|
{1:~ }|
]], popupmenu={
- anchor = { 2, 0 },
+ anchor = { 1, 2, 0 },
items = { { "alphpabet", "", "", "" }, { "alphanum", "", "", "" } },
pos = 1
}, showmode={ { "-- Keyword Local completion (^N^P) ", 3 }, { "match 1 of 2", 4 } }}
@@ -194,7 +315,7 @@ describe('ui/ext_messages', function()
{1:~ }|
{1:~ }|
]], popupmenu={
- anchor = { 2, 0 },
+ anchor = { 1, 2, 0 },
items = { { "alphpabet", "", "", "" }, { "alphanum", "", "", "" } },
pos = 1
}, messages={ {
@@ -210,7 +331,7 @@ describe('ui/ext_messages', function()
{1:~ }|
{1:~ }|
]], popupmenu={
- anchor = { 2, 0 },
+ anchor = { 1, 2, 0 },
items = { { "alphpabet", "", "", "" }, { "alphanum", "", "", "" } },
pos = 0
}, messages={ {
@@ -230,7 +351,7 @@ describe('ui/ext_messages', function()
}}
end)
- it('supports showmode with recording message', function()
+ it('&showmode with macro-recording message', function()
feed('qq')
screen:expect{grid=[[
^ |
@@ -268,7 +389,7 @@ describe('ui/ext_messages', function()
]])
end)
- it('shows recording message with noshowmode', function()
+ it('shows macro-recording message with &noshowmode', function()
command("set noshowmode")
feed('qq')
-- also check mode to avoid immediate success
@@ -308,7 +429,7 @@ describe('ui/ext_messages', function()
]], mode="normal"}
end)
- it('supports showcmd and ruler', function()
+ it('supports &showcmd and &ruler', function()
command('set showcmd ruler')
screen:expect{grid=[[
^ |
@@ -529,7 +650,7 @@ describe('ui/ext_messages', function()
local screen
before_each(function()
- clear{headless=false, args={"--cmd", "set shortmess-=I"}}
+ 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:set_default_attr_ids({
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index c54d608ec4..c5a23e4661 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -11,7 +11,7 @@ describe('ext_multigrid', function()
local screen
before_each(function()
- clear{headless=false, args={'--cmd', 'set laststatus=2'}}
+ clear{args_rm={'--headless'}, args={'--cmd', 'set laststatus=2'}}
screen = Screen.new(53,14)
screen:attach({ext_multigrid=true})
screen:set_default_attr_ids({
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
index ed630259be..93192934c7 100644
--- a/test/functional/ui/options_spec.lua
+++ b/test/functional/ui/options_spec.lua
@@ -1,10 +1,9 @@
-local global_helpers = require('test.helpers')
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
-local shallowcopy = global_helpers.shallowcopy
+local shallowcopy = helpers.shallowcopy
describe('ui receives option updates', function()
local screen
@@ -115,7 +114,8 @@ describe('ui receives option updates', function()
end)
local function startup_test(headless)
- local expected = reset(nil,{headless=headless,args={'--cmd', 'set guifont=Comic\\ Sans\\ 12'}})
+ local expected = reset(nil, {args_rm=(headless and {} or {'--headless'}),
+ args={'--cmd', 'set guifont=Comic\\ Sans\\ 12'}})
expected.guifont = "Comic Sans 12"
screen:expect(function()
eq(expected, screen.options)
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index 87b489fd71..38c4527a5b 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -51,7 +51,8 @@ describe("shell command :!", function()
end)
it("throttles shell-command output greater than ~10KB", function()
- if helpers.skip_fragile(pending) then
+ if helpers.skip_fragile(pending,
+ (os.getenv("TRAVIS") and helpers.os_name() == "osx")) then
return
end
child_session.feed_data(
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 1e6ebb87f5..b457ebebab 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -50,7 +50,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=0,
- anchor={1,0},
+ anchor={1,1,0},
}}
feed('<c-p>')
@@ -66,7 +66,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=-1,
- anchor={1,0},
+ anchor={1,1,0},
}}
-- down moves the selection in the menu, but does not insert anything
@@ -83,7 +83,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=1,
- anchor={1,0},
+ anchor={1,1,0},
}}
feed('<cr>')
@@ -113,7 +113,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=0,
- anchor={1,0},
+ anchor={1,1,0},
}}
meths.select_popupmenu_item(1,false,false,{})
@@ -129,7 +129,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=1,
- anchor={1,0},
+ anchor={1,1,0},
}}
meths.select_popupmenu_item(2,true,false,{})
@@ -145,7 +145,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=2,
- anchor={1,0},
+ anchor={1,1,0},
}}
meths.select_popupmenu_item(0,true,true,{})
@@ -174,7 +174,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=0,
- anchor={1,0},
+ anchor={1,1,0},
}}
meths.select_popupmenu_item(-1,false,false,{})
@@ -190,7 +190,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=-1,
- anchor={1,0},
+ anchor={1,1,0},
}}
meths.select_popupmenu_item(1,true,false,{})
@@ -206,7 +206,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=1,
- anchor={1,0},
+ anchor={1,1,0},
}}
meths.select_popupmenu_item(-1,true,false,{})
@@ -222,7 +222,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=-1,
- anchor={1,0},
+ anchor={1,1,0},
}}
meths.select_popupmenu_item(0,true,false,{})
@@ -238,7 +238,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=0,
- anchor={1,0},
+ anchor={1,1,0},
}}
meths.select_popupmenu_item(-1,true,true,{})
@@ -269,7 +269,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=0,
- anchor={1,0},
+ anchor={1,1,0},
}}
feed('<f1>')
@@ -285,7 +285,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=2,
- anchor={1,0},
+ anchor={1,1,0},
}}
feed('<f2>')
@@ -301,7 +301,7 @@ describe('ui/ext_popupmenu', function()
]], popupmenu={
items=expected,
pos=-1,
- anchor={1,0},
+ anchor={1,1,0},
}}
feed('<f3>')
@@ -366,6 +366,113 @@ describe('ui/ext_popupmenu', function()
{2:-- INSERT --} |
]])
end)
+
+ it('works with wildoptions=pum', function()
+ screen:try_resize(32,10)
+ command('set wildmenu')
+ command('set wildoptions=pum')
+
+ local wild_expected = {
+ {'define', '', '', ''},
+ {'jump', '', '', ''},
+ {'list', '', '', ''},
+ {'place', '', '', ''},
+ {'undefine', '', '', ''},
+ {'unplace', '', '', ''},
+ }
+
+ feed(':sign ')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :sign ^ |
+ ]])
+
+ feed('<tab>')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :sign define^ |
+ ]], popupmenu={items=wild_expected, pos=0, anchor={1, 9, 6}}}
+
+ feed('<left>')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :sign ^ |
+ ]], popupmenu={items=wild_expected, pos=-1, anchor={1, 9, 6}}}
+
+ feed('<left>')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :sign unplace^ |
+ ]], popupmenu={items=wild_expected, pos=5, anchor={1, 9, 6}}}
+
+ feed('x')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :sign unplacex^ |
+ ]])
+ feed('<esc>')
+
+ -- check positioning with multibyte char in pattern
+ command("e långfile1")
+ command("sp långfile2")
+ feed(':b lå<tab>')
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {4:långfile2 }|
+ |
+ {1:~ }|
+ {1:~ }|
+ {3:långfile1 }|
+ :b långfile1^ |
+ ]], popupmenu={
+ anchor = {1, 9, 3},
+ items = {{"långfile1", "", "", "" }, {"långfile2", "", "", ""}},
+ pos = 0,
+ }}
+ end)
end)
@@ -1209,7 +1316,7 @@ describe('builtin popupmenu', function()
]])
meths.input_mouse('wheel', 'down', '', 0, 6, 15)
- screen:expect([[
+ screen:expect{grid=[[
choice^ |
{1:~ }|
{n:word }{1: }|
@@ -1218,7 +1325,7 @@ describe('builtin popupmenu', function()
{n:thing }{1: }|
{3:[No Name] [+] }|
{2:-- INSERT --} |
- ]])
+ ]], unchanged=true}
end)
it('works with kind, menu and abbr attributes', function()
@@ -1273,6 +1380,131 @@ describe('builtin popupmenu', function()
]])
end)
+ it('works with wildoptions=pum', function()
+ screen:try_resize(32,10)
+ command('set wildmenu')
+ command('set wildoptions=pum')
+
+ feed(':sign ')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :sign ^ |
+ ]])
+
+ feed('<tab>')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }{s: define }{1: }|
+ {1:~ }{n: jump }{1: }|
+ {1:~ }{n: list }{1: }|
+ {1:~ }{n: place }{1: }|
+ {1:~ }{n: undefine }{1: }|
+ {1:~ }{n: unplace }{1: }|
+ :sign define^ |
+ ]])
+
+ feed('<left>')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }{n: define }{1: }|
+ {1:~ }{n: jump }{1: }|
+ {1:~ }{n: list }{1: }|
+ {1:~ }{n: place }{1: }|
+ {1:~ }{n: undefine }{1: }|
+ {1:~ }{n: unplace }{1: }|
+ :sign ^ |
+ ]])
+
+ feed('<left>')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }{n: define }{1: }|
+ {1:~ }{n: jump }{1: }|
+ {1:~ }{n: list }{1: }|
+ {1:~ }{n: place }{1: }|
+ {1:~ }{n: undefine }{1: }|
+ {1:~ }{s: unplace }{1: }|
+ :sign unplace^ |
+ ]])
+
+ feed('x')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :sign unplacex^ |
+ ]])
+
+ feed('<esc>')
+
+ -- check positioning with multibyte char in pattern
+ command("e långfile1")
+ command("sp långfile2")
+ feed(':b lå<tab>')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {4:långfile2 }|
+ |
+ {1:~ }|
+ {1:~ }{s: långfile1 }{1: }|
+ {3:lå}{n: långfile2 }{3: }|
+ :b långfile1^ |
+ ]])
+
+ -- check doesn't crash on screen resize
+ screen:try_resize(20,6)
+ screen:expect([[
+ |
+ {1:~ }|
+ {4:långfile2 }|
+ {s: långfile1 } |
+ {3:lå}{n: långfile2 }{3: }|
+ :b långfile1^ |
+ ]])
+
+ screen:try_resize(50,15)
+ screen:expect([[
+ |
+ {1:~ }|
+ {4:långfile2 }|
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }{s: långfile1 }{1: }|
+ {3:lå}{n: långfile2 }{3: }|
+ :b långfile1^ |
+ ]])
+ end)
+
it("'pumblend' RGB-color", function()
screen:try_resize(60,14)
screen:set_default_attr_ids({
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 8b1b77eb81..a81851cbba 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -71,10 +71,10 @@
-- To help write screen tests, see Screen:snapshot_util().
-- To debug screen tests, see Screen:redraw_debug().
-local global_helpers = require('test.helpers')
-local deepcopy = global_helpers.deepcopy
-local shallowcopy = global_helpers.shallowcopy
local helpers = require('test.functional.helpers')(nil)
+local deepcopy = helpers.deepcopy
+local shallowcopy = helpers.shallowcopy
+local concat_tables = helpers.concat_tables
local request, run_session = helpers.request, helpers.run_session
local eq = helpers.eq
local dedent = helpers.dedent
@@ -259,22 +259,19 @@ local ext_keys = {
'messages', 'showmode', 'showcmd', 'ruler', 'float_pos',
}
--- Asserts that the screen state eventually matches an expected state
+-- Asserts that the screen state eventually matches an expected state.
--
--- This function can either be called with the positional forms
---
--- screen:expect(grid, [attr_ids, attr_ignore])
--- screen:expect(condition)
---
--- or to use additional arguments (or grid and condition at the same time)
--- the keyword form has to be used:
---
--- screen:expect{grid=[[...]], cmdline={...}, condition=function() ... end}
+-- Can be called with positional args:
+-- screen:expect(grid, [attr_ids, attr_ignore])
+-- screen:expect(condition)
+-- or keyword args (supports more options):
+-- screen:expect{grid=[[...]], cmdline={...}, condition=function() ... end}
--
--
-- grid: Expected screen state (string). Each line represents a screen
-- row. Last character of each row (typically "|") is stripped.
-- Common indentation is stripped.
+-- Lines containing only "{IGNORE}|" are skipped.
-- attr_ids: Expected text attributes. Screen rows are transformed according
-- to this table, as follows: each substring S composed of
-- characters having the same attributes will be substituted by
@@ -416,26 +413,23 @@ screen:redraw_debug() to show all intermediate screen states. ]])
end
end
- -- Extension features. The default expectations should cover the case of
+ -- UI extensions. The default expectations should cover the case of
-- the ext_ feature being disabled, or the feature currently not activated
- -- (for instance no external cmdline visible). Some extensions require
+ -- (e.g. no external cmdline visible). Some extensions require
-- preprocessing to represent highlights in a reproducible way.
local extstate = self:_extstate_repr(attr_state)
-
- -- convert assertion errors into invalid screen state descriptions
- local status, res = pcall(function()
- for _, k in ipairs(ext_keys) do
- -- Empty states is considered the default and need not be mentioned
- if not (expected[k] == nil and isempty(extstate[k])) then
- eq(expected[k], extstate[k], k)
+ if expected['mode'] ~= nil then
+ extstate['mode'] = self.mode
+ end
+ -- Convert assertion errors into invalid screen state descriptions.
+ for _, k in ipairs(concat_tables(ext_keys, {'mode'})) do
+ -- Empty states are considered the default and need not be mentioned.
+ if (not (expected[k] == nil and isempty(extstate[k]))) then
+ local status, res = pcall(eq, expected[k], extstate[k], k)
+ if not status then
+ return (tostring(res)..'\nHint: full state of "'..k..'":\n '..inspect(extstate[k]))
end
end
- if expected.mode ~= nil then
- eq(expected.mode, self.mode, "mode")
- end
- end)
- if not status then
- return tostring(res)
end
end, expected)
end
@@ -937,10 +931,7 @@ function Screen:_handle_option_set(name, value)
end
function Screen:_handle_popupmenu_show(items, selected, row, col, grid)
- if (not self._options.ext_multigrid) and grid == 1 then
- grid = nil
- end
- self.popupmenu = {items=items, pos=selected, anchor={row, col, grid}}
+ self.popupmenu = {items=items, pos=selected, anchor={grid, row, col}}
end
function Screen:_handle_popupmenu_select(selected)
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index a46670d8a2..65ae124353 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -163,12 +163,14 @@ describe('search highlighting', function()
]])
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 |
+ -- NB: in earlier versions terminal output was redrawn during cmdline mode.
+ -- For now just assert that the screens remain unchanged.
+ screen:expect([[
+ {3:foo} bar baz {3:│} |
+ bar baz {2:foo} {3:│} |
+ bar {2:foo} baz {3:│} |
+ {3:│} |
+ {1:~ }{3:│} |
{5:[No Name] [+] }{3:term }|
/foo^ |
]], { [1] = {bold = true, foreground = Screen.colors.Blue1},
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index bc0e2e3799..74019046c0 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -43,15 +43,15 @@ describe('Signs', function()
{2: }b |
{1:>>}c |
{2: }^ |
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
]])
end)
@@ -72,14 +72,14 @@ describe('Signs', function()
{1:>>}b |
{2: }c |
{2: } |
- {2: }{0:~ }|
- {2: }{0:~ }|
+ {0:~ }|
+ {0:~ }|
{4:[No Name] [+] }|
{2: }{3:a }|
{1:>>}b |
{2: }c |
{2: } |
- {2: }{0:~ }|
+ {0:~ }|
{5:[No Name] [+] }|
|
]])
@@ -102,31 +102,140 @@ describe('Signs', function()
{2: }{6: 2 }{8:b }|
{2: }{7: 3 }c |
{1:>>}{7: 4 }{8:^ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
]])
end)
+ it('multiple signs #9295', function()
+ feed('ia<cr>b<cr>c<cr><esc>')
+ command('set number')
+ command('set signcolumn=yes:2')
+ command('sign define pietSearch text=>> texthl=Search')
+ command('sign define pietError text=XX texthl=Error')
+ command('sign define pietWarn text=WW texthl=Warning')
+ command('sign place 1 line=1 name=pietSearch buffer=1')
+ command('sign place 2 line=1 name=pietError buffer=1')
+ -- Line 2 helps checking that signs in the same line are ordered by Id.
+ command('sign place 4 line=2 name=pietSearch buffer=1')
+ command('sign place 3 line=2 name=pietError buffer=1')
+ -- Line 3 checks that with a limit over the maximum number
+ -- of signs, the ones with the highest Ids are being picked,
+ -- and presented by their sorted Id order.
+ command('sign place 4 line=3 name=pietSearch buffer=1')
+ command('sign place 5 line=3 name=pietWarn buffer=1')
+ command('sign place 3 line=3 name=pietError buffer=1')
+ screen:expect([[
+ {1:>>}XX{6: 1 }a |
+ XX{1:>>}{6: 2 }b |
+ {1:>>}WW{6: 3 }c |
+ {2: }{6: 4 }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- With the default setting, we get the sign with the top id.
+ command('set signcolumn=yes:1')
+ screen:expect([[
+ XX{6: 1 }a |
+ {1:>>}{6: 2 }b |
+ WW{6: 3 }c |
+ {2: }{6: 4 }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- "auto:3" accommodates all the signs we defined so far.
+ command('set signcolumn=auto:3')
+ screen:expect([[
+ {1:>>}XX{2: }{6: 1 }a |
+ XX{1:>>}{2: }{6: 2 }b |
+ XX{1:>>}WW{6: 3 }c |
+ {2: }{6: 4 }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- Check "yes:9".
+ command('set signcolumn=yes:9')
+ screen:expect([[
+ {1:>>}XX{2: }{6: 1 }a |
+ XX{1:>>}{2: }{6: 2 }b |
+ XX{1:>>}WW{2: }{6: 3 }c |
+ {2: }{6: 4 }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- Check "auto:N" larger than the maximum number of signs defined in
+ -- a single line (same result as "auto:3").
+ command('set signcolumn=auto:4')
+ screen:expect{grid=[[
+ {1:>>}XX{2: }{6: 1 }a |
+ XX{1:>>}{2: }{6: 2 }b |
+ XX{1:>>}WW{6: 3 }c |
+ {2: }{6: 4 }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]}
+ end)
+
it('can have 32bit sign IDs', function()
command('sign define piet text=>> texthl=Search')
command('sign place 100000 line=1 name=piet buffer=1')
feed(':sign place<cr>')
screen:expect([[
{1:>>} |
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
{4: }|
:sign place |
{9:--- Signs ---} |
@@ -139,18 +248,18 @@ describe('Signs', function()
feed('<cr>')
screen:expect([[
{1:>>}^ |
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
- {2: }{0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
]])
end)
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 7cd09fb222..f4b80fd428 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -1,7 +1,6 @@
-local global_helpers = require('test.helpers')
-local shallowcopy = global_helpers.shallowcopy
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
+local shallowcopy = helpers.shallowcopy
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
local iswin = helpers.iswin
local funcs = helpers.funcs
@@ -29,8 +28,7 @@ describe("'wildmenu'", function()
end
it(':sign <tab> shows wildmenu completions', function()
- command('set wildmode=full')
- command('set wildmenu')
+ command('set wildmenu wildmode=full')
feed(':sign <tab>')
screen:expect([[
|
@@ -96,10 +94,12 @@ describe("'wildmenu'", function()
feed([[<C-\><C-N>gg]])
feed([[:sign <Tab>]]) -- Invoke wildmenu.
+ -- NB: in earlier versions terminal output was redrawn during cmdline mode.
+ -- For now just assert that the screen remains unchanged.
expect_stay_unchanged{grid=[[
- foo |
- foo |
- foo |
+ |
+ |
+ |
define jump list > |
:sign define^ |
]]}
@@ -201,14 +201,28 @@ describe('command line completion', function()
]])
end)
+ it('completes env var names #9681', function()
+ clear()
+ screen:attach()
+ command('let $XTEST_1 = "foo" | let $XTEST_2 = "bar"')
+ command('set wildmenu wildmode=full')
+ feed(':!echo $XTEST_<tab>')
+ screen:expect([[
+ |
+ {1:~ }|
+ {1:~ }|
+ {2:XTEST_1}{3: XTEST_2 }|
+ :!echo $XTEST_1^ |
+ ]])
+ end)
+
it('completes (multibyte) env var names #9655', function()
clear({env={
['XTEST_1AaあB']='foo',
['XTEST_2']='bar',
}})
screen:attach()
- command('set wildmode=full')
- command('set wildmenu')
+ command('set wildmenu wildmode=full')
feed(':!echo $XTEST_<tab>')
screen:expect([[
|