aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/cmdline_spec.lua34
-rw-r--r--test/functional/ui/cursor_spec.lua4
-rw-r--r--test/functional/ui/decorations_spec.lua22
-rw-r--r--test/functional/ui/diff_spec.lua534
-rw-r--r--test/functional/ui/messages_spec.lua8
-rw-r--r--test/functional/ui/mouse_spec.lua14
-rw-r--r--test/functional/ui/popupmenu_spec.lua727
7 files changed, 1300 insertions, 43 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index cb9d978a0f..fb44c2ab52 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -858,7 +858,7 @@ local function test_cmdline(linegrid)
cmdline = {
{
content = { { '' } },
- hl_id = 242,
+ hl_id = 243,
pos = 0,
prompt = 'Prompt:',
},
@@ -886,7 +886,7 @@ local function test_cmdline(linegrid)
},
cmdline_block = { { { 'if 1' } } },
})
- feed(':let x = 1<CR>')
+ feed('let x = 1<CR>')
screen:expect({
grid = s1,
cmdline = {
@@ -897,20 +897,34 @@ local function test_cmdline(linegrid)
pos = 0,
},
},
- cmdline_block = { { { 'if 1' } }, { { ' :let x = 1' } } },
+ cmdline_block = { { { 'if 1' } }, { { ' let x = 1' } } },
})
- feed(':endif')
+ feed('<CR>')
+ eq('let x = 1', eval('@:'))
screen:expect({
grid = s1,
cmdline = {
{
- content = { { ':endif' } },
+ content = { { '' } },
firstc = ':',
indent = 2,
- pos = 6,
+ pos = 0,
+ },
+ },
+ cmdline_block = { { { 'if 1' } }, { { ' let x = 1' } }, { { ' ' } } },
+ })
+ feed('endif')
+ screen:expect({
+ grid = s1,
+ cmdline = {
+ {
+ content = { { 'endif' } },
+ firstc = ':',
+ indent = 2,
+ pos = 5,
},
},
- cmdline_block = { { { 'if 1' } }, { { ' :let x = 1' } } },
+ cmdline_block = { { { 'if 1' } }, { { ' let x = 1' } }, { { ' ' } } },
})
feed('<CR>')
screen:expect({
@@ -1352,6 +1366,12 @@ describe('cmdline height', function()
-- cmdheight unchanged.
eq(1, eval('&cmdheight'))
end)
+
+ it('not increased to 0 from 1 with wincmd _', function()
+ command('set cmdheight=0 laststatus=0')
+ command('wincmd _')
+ eq(0, eval('&cmdheight'))
+ end)
end)
describe('cmdheight=0', function()
diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua
index ff304db54c..087ae79eb1 100644
--- a/test/functional/ui/cursor_spec.lua
+++ b/test/functional/ui/cursor_spec.lua
@@ -258,11 +258,11 @@ describe('ui/cursor', function()
end
end
if m.hl_id then
- m.hl_id = 65
+ m.hl_id = 66
m.attr = { background = Screen.colors.DarkGray }
end
if m.id_lm then
- m.id_lm = 72
+ m.id_lm = 73
m.attr_lm = {}
end
end
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 639d43b560..5ef1ef54bb 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -2956,6 +2956,28 @@ describe('extmark decorations', function()
{1:~ }|*3
|
]])
+ -- No scrolling for concealed topline #33033
+ api.nvim_buf_clear_namespace(0, ns, 0, -1)
+ api.nvim_buf_set_extmark(0, ns, 1, 0, { virt_lines_above = true, virt_lines = { { { "virt_above 2" } } } })
+ api.nvim_buf_set_extmark(0, ns, 0, 0, { conceal_lines = "" })
+ feed('ggjj')
+ screen:expect([[
+ {2: }virt_above 2 |
+ {2: 2 } local text, hl_id_cell, count = unpack(ite|
+ {2: }m) |
+ {2: 3 }^ if hl_id_cell ~= nil then |
+ {2: 4 } hl_id = hl_id_cell |
+ {2: 5 }conceal text |
+ {2: 6 } for _ = 1, (count or 1) do |
+ {2: 7 } local cell = line[colpos] |
+ {2: 8 } cell.text = text |
+ {2: 9 } cell.hl_id = hl_id |
+ {2: 10 } colpos = colpos+1 |
+ {2: 11 } end |
+ {2: 12 }end |
+ {1:~ }|
+ |
+ ]])
end)
end)
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index e0d88771d3..223622eb6b 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -1555,7 +1555,6 @@ it('diff mode overlapped diff blocks will be merged', function()
local screen = Screen.new(35, 20)
command('set winwidth=10 diffopt=filler,internal')
-
command('args Xdifile1 Xdifile2 | vert all | windo diffthis')
WriteDiffFiles('a\nb', 'x\nx')
@@ -2252,3 +2251,536 @@ it('diff mode does not scroll with line("w0")', function()
9 |
]])
end)
+
+-- oldtest: Test_diff_inline()
+it('diff mode inline highlighting', function()
+ write_file('Xdifile1', '')
+ write_file('Xdifile2', '')
+ finally(function()
+ os.remove('Xdifile1')
+ os.remove('Xdifile2')
+ end)
+
+ local screen = Screen.new(37, 20)
+ screen:add_extra_attr_ids({
+ [100] = { background = Screen.colors.Blue1 },
+ [101] = { bold = true, background = Screen.colors.Red, foreground = Screen.colors.Blue1 },
+ [102] = { background = Screen.colors.LightMagenta, foreground = Screen.colors.Blue1 },
+ [103] = { bold = true, background = Screen.colors.Blue1, foreground = Screen.colors.Blue1 },
+ [104] = { bold = true, background = Screen.colors.LightBlue, foreground = Screen.colors.Blue1 },
+ })
+ command('set winwidth=10')
+ command('args Xdifile1 Xdifile2 | vert all | windo diffthis | 1wincmd w')
+
+ WriteDiffFiles('abcdef ghi jk n\nx\ny', 'aBcef gHi lm n\ny\nz')
+ command('set diffopt=internal,filler')
+ local s1 = [[
+ {7: }{4:^a}{27:bcdef ghi jk}{4: n }│{7: }{4:a}{27:Bcef gHi lm}{4: n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]]
+ screen:expect(s1)
+ command('set diffopt=internal,filler diffopt+=inline:none')
+ local s2 = [[
+ {7: }{4:^abcdef ghi jk n }│{7: }{4:aBcef gHi lm n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]]
+ screen:expect(s2)
+
+ -- inline:simple is the same as default
+ command('set diffopt=internal,filler diffopt+=inline:simple')
+ screen:expect(s1)
+
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ local s3 = [[
+ {7: }{4:^a}{27:b}{4:c}{27:d}{4:ef g}{27:h}{4:i }{27:jk}{4: n }│{7: }{4:a}{27:B}{4:cef g}{27:H}{4:i }{27:lm}{4: n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]]
+ screen:expect(s3)
+
+ command('set diffopt=internal,filler diffopt+=inline:word')
+ screen:expect([[
+ {7: }{27:^abcdef}{4: }{27:ghi}{4: }{27:jk}{4: n }│{7: }{27:aBcef}{4: }{27:gHi}{4: }{27:lm}{4: n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ -- multiple inline values will the last one
+ command('set diffopt=internal,filler diffopt+=inline:none,inline:char,inline:simple')
+ screen:expect(s1)
+ command('set diffopt=internal,filler diffopt+=inline:simple,inline:word,inline:none')
+ screen:expect(s2)
+ command('set diffopt=internal,filler diffopt+=inline:simple,inline:word,inline:char')
+ screen:expect(s3)
+
+ -- DiffTextAdd highlight
+ command('hi DiffTextAdd guibg=blue')
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ screen:expect([[
+ {7: }{4:^a}{27:b}{4:c}{100:d}{4:ef g}{27:h}{4:i }{27:jk}{4: n }│{7: }{4:a}{27:B}{4:cef g}{27:H}{4:i }{27:lm}{4: n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ -- Live update in insert mode
+ feed('isometext')
+ screen:expect([[
+ {7: }{27:sometext^abcd}{4:ef g}│{7: }{27:aBc}{4:ef g}{27:H}{4:i }{27:lm}{4: n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 [+] }{2:Xdifile2 }|
+ {5:-- INSERT --} |
+ ]])
+ feed('<Esc>')
+ command('silent! undo')
+
+ -- icase simple scenarios
+ command('set diffopt=internal,filler diffopt+=inline:simple,icase')
+ screen:expect([[
+ {7: }{4:^abc}{27:def ghi jk}{4: n }│{7: }{4:aBc}{27:ef gHi lm}{4: n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:char,icase')
+ screen:expect([[
+ {7: }{4:^abc}{100:d}{4:ef ghi }{27:jk}{4: n }│{7: }{4:aBcef gHi }{27:lm}{4: n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:word,icase')
+ screen:expect([[
+ {7: }{27:^abcdef}{4: ghi }{27:jk}{4: n }│{7: }{27:aBcef}{4: gHi }{27:lm}{4: n }|
+ {7: }{22:x }│{7: }{23:----------------}|
+ {7: }y │{7: }y |
+ {7: }{23:----------------}│{7: }{22:z }|
+ {1:~ }│{1:~ }|*14
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ screen:try_resize(45, 20)
+ command('wincmd =')
+ -- diff algorithms should affect highlight
+ WriteDiffFiles('apples and oranges', 'oranges and apples')
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ screen:expect([[
+ {7: }{27:^appl}{4:es and }{27:orang}{4:es }│{7: }{27:orang}{4:es and }{27:appl}{4:es }|
+ {1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:char,algorithm:patience')
+ screen:expect([[
+ {7: }{100:^apples and }{4:oranges }│{7: }{4:oranges}{100: and apples}{4: }|
+ {1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ screen:try_resize(65, 20)
+ command('wincmd =')
+ -- icase: composing chars and Unicode fold case edge cases
+ WriteDiffFiles(
+ '1 - sigma in 6σ and Ὀδυσσεύς\n1 - angstrom in åå\n1 - composing: ii⃗I⃗',
+ '2 - Sigma in 6Σ and ὈΔΥΣΣΕΎΣ\n2 - Angstrom in ÅÅ\n2 - Composing: i⃗I⃗I⃗'
+ )
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ screen:expect([[
+ {7: }{27:^1}{4: - }{27:s}{4:igma in 6}{27:σ}{4: and Ὀ}{27:δυσσεύς}{4: }│{7: }{27:2}{4: - }{27:S}{4:igma in 6}{27:Σ}{4: and Ὀ}{27:ΔΥΣΣΕΎΣ}{4: }|
+ {7: }{27:1}{4: - }{27:a}{4:ngstrom in }{27:åå}{4: }│{7: }{27:2}{4: - }{27:A}{4:ngstrom in }{27:ÅÅ}{4: }|
+ {7: }{27:1}{4: - }{27:c}{4:omposing: }{100:i}{4:i⃗I⃗ }│{7: }{27:2}{4: - }{27:C}{4:omposing: i⃗I⃗}{100:I⃗}{4: }|
+ {1:~ }│{1:~ }|*15
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:char,icase')
+ screen:expect([[
+ {7: }{27:^1}{4: - sigma in 6σ and Ὀδυσσεύς }│{7: }{27:2}{4: - Sigma in 6Σ and ὈΔΥΣΣΕΎΣ }|
+ {7: }{27:1}{4: - angstrom in åå }│{7: }{27:2}{4: - Angstrom in ÅÅ }|
+ {7: }{27:1}{4: - composing: }{27:i}{4:i⃗I⃗ }│{7: }{27:2}{4: - Composing: }{27:i⃗}{4:I⃗I⃗ }|
+ {1:~ }│{1:~ }|*15
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ screen:try_resize(35, 20)
+ command('wincmd =')
+ -- wide chars
+ WriteDiffFiles('abc😅xde一\nf🚀g', 'abcy😢de\n二f🚀g')
+ command('set diffopt=internal,filler diffopt+=inline:char,icase')
+ screen:expect([[
+ {7: }{4:^abc}{27:😅x}{4:de}{100:一}{4: }│{7: }{4:abc}{27:y😢}{4:de }|
+ {7: }{4:f🚀g }│{7: }{100:二}{4:f🚀g }|
+ {1:~ }│{1:~ }|*16
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ -- NUL char
+ WriteDiffFiles('1\00034\0005\0006', '1234\0005\n6')
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ screen:expect([[
+ {7: }{4:^1}{101:^@}{4:34}{102:^@}{4:5}{101:^@}{4:6 }│{7: }{4:1}{27:2}{4:34}{102:^@}{4:5 }|
+ {7: }{23:---------------}│{7: }{4:6 }|
+ {1:~ }│{1:~ }|*16
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ -- word diff: always use first buffer's iskeyword and ignore others' for consistency
+ WriteDiffFiles('foo+bar test', 'foo+baz test')
+ command('set diffopt=internal,filler diffopt+=inline:word')
+ local sw1 = [[
+ {7: }{4:^foo+}{27:bar}{4: test }│{7: }{4:foo+}{27:baz}{4: test }|
+ {1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]]
+ screen:expect(sw1)
+
+ command('set iskeyword+=+ | diffupdate')
+ screen:expect([[
+ {7: }{27:^foo+bar}{4: test }│{7: }{27:foo+baz}{4: test }|
+ {1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ command('set iskeyword& | wincmd w')
+ command('set iskeyword+=+ | wincmd w | diffupdate')
+ -- Use the previous screen as 2nd buffer's iskeyword does not matter
+ screen:expect(sw1)
+
+ command('windo set iskeyword& | 1wincmd w')
+
+ screen:try_resize(69, 20)
+ command('wincmd =')
+ -- char diff: should slide highlight to whitespace boundary if possible for
+ -- better readability (by using forced indent-heuristics). A wrong result
+ -- would be if the highlight is "Bar, prefix". It should be "prefixBar, "
+ -- instead.
+ WriteDiffFiles('prefixFoo, prefixEnd', 'prefixFoo, prefixBar, prefixEnd')
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ screen:expect([[
+ {7: }{4:^prefixFoo, prefixEnd }│{7: }{4:prefixFoo, }{100:prefixBar, }{4:prefixEnd }|
+ {1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ screen:try_resize(39, 20)
+ command('wincmd =')
+ -- char diff: small gaps between inline diff blocks will be merged during refine step
+ -- - first segment: test that we iteratively merge small gaps after we merged
+ -- adjacent blocks, but only with limited number (set to 4) of iterations.
+ -- - second and third segments: show that we need a large enough adjacent block to
+ -- trigger a merge.
+ -- - fourth segment: small gaps are not merged when adjacent large block is
+ -- on a different line.
+ WriteDiffFiles(
+ 'abcdefghijklmno\nanchor1\n'
+ .. 'abcdefghijklmno\nanchor2\n'
+ .. 'abcdefghijklmno\nanchor3\n'
+ .. 'test\nmultiline',
+ 'a?c?e?g?i?k???o\nanchor1\n'
+ .. 'a??de?????klmno\nanchor2\n'
+ .. 'a??de??????lmno\nanchor3\n'
+ .. 't?s?\n??????i?e'
+ )
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ screen:expect([[
+ {7: }{4:^a}{27:b}{4:c}{27:defghijklmn}{4:o }│{7: }{4:a}{27:?}{4:c}{27:?e?g?i?k???}{4:o }|
+ {7: }anchor1 │{7: }anchor1 |
+ {7: }{4:a}{27:bc}{4:de}{27:fghij}{4:klmno }│{7: }{4:a}{27:??}{4:de}{27:?????}{4:klmno }|
+ {7: }anchor2 │{7: }anchor2 |
+ {7: }{4:a}{27:bcdefghijk}{4:lmno }│{7: }{4:a}{27:??de??????}{4:lmno }|
+ {7: }anchor3 │{7: }anchor3 |
+ {7: }{4:t}{27:e}{4:s}{27:t}{4: }│{7: }{4:t}{27:?}{4:s}{27:?}{4: }|
+ {7: }{27:multilin}{4:e }│{7: }{27:??????i?}{4:e }|
+ {1:~ }│{1:~ }|*10
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ screen:try_resize(49, 20)
+ command('wincmd =')
+ -- Test multi-line blocks and whitespace
+ WriteDiffFiles(
+ 'this is \nsometest text foo\nbaz abc def \none\nword another word\nadditional line',
+ 'this is some test\ntexts\nfoo bar abX Yef \noneword another word'
+ )
+ command('set diffopt=internal,filler diffopt+=inline:char,iwhite')
+ screen:expect([[
+ {7: }{4:^this is }│{7: }{4:this is some}{100: }{4:test }|
+ {7: }{4:sometest text foo }│{7: }{4:text}{100:s}{4: }|
+ {7: }{4:ba}{27:z}{4: ab}{27:c}{4: }{27:d}{4:ef }│{7: }{4:foo ba}{27:r}{4: ab}{27:X}{4: }{27:Y}{4:ef }|
+ {7: }{4:one }│{7: }{4:oneword another word }|
+ {7: }{4:word another word }│{7: }{23:----------------------}|
+ {7: }{22:additional line }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:word,iwhite')
+ screen:expect([[
+ {7: }{4:^this is }│{7: }{4:this is }{27:some}{4: }{27:test}{4: }|
+ {7: }{27:sometest}{4: }{27:text}{4: }{27:foo}{4: }│{7: }{27:texts}{4: }|
+ {7: }{27:baz}{4: }{27:abc}{4: }{27:def}{4: }│{7: }{27:foo}{4: }{27:bar}{4: }{27:abX}{4: }{27:Yef}{4: }|
+ {7: }{27:one}{4: }│{7: }{27:oneword}{4: another word }|
+ {7: }{27:word}{4: another word }│{7: }{23:----------------------}|
+ {7: }{22:additional line }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:char,iwhiteeol')
+ screen:expect([[
+ {7: }{4:^this }{100: }{4:is }│{7: }{4:this is some}{100: }{4:test }|
+ {7: }{4:sometest text foo }│{7: }{4:text}{100:s}{4: }|
+ {7: }{4:ba}{27:z}{4: ab}{27:c}{4: }{27:d}{4:ef }│{7: }{4:foo ba}{27:r}{4: ab}{27:X}{4: }{27:Y}{4:ef }|
+ {7: }{4:one }│{7: }{4:oneword another word }|
+ {7: }{4:word another word }│{7: }{23:----------------------}|
+ {7: }{22:additional line }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:word,iwhiteeol')
+ screen:expect([[
+ {7: }{4:^this }{100: }{4:is }│{7: }{4:this is }{27:some}{4: }{27:test}{4: }|
+ {7: }{27:sometest}{4: }{27:text}{4: foo }│{7: }{27:texts}{4: }|
+ {7: }{27:baz}{4: }{27:abc}{4: }{27:def}{4: }│{7: }{4:foo }{27:bar}{4: }{27:abX}{4: }{27:Yef}{4: }|
+ {7: }{27:one}{4: }│{7: }{27:oneword}{4: another word }|
+ {7: }{27:word}{4: another word }│{7: }{23:----------------------}|
+ {7: }{22:additional line }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:char,iwhiteall')
+ screen:expect([[
+ {7: }{4:^this is }│{7: }{4:this is some test }|
+ {7: }{4:sometest text foo }│{7: }{4:text}{100:s}{4: }|
+ {7: }{4:ba}{27:z}{4: ab}{27:c d}{4:ef }│{7: }{4:foo ba}{27:r}{4: ab}{27:X Y}{4:ef }|
+ {7: }{4:one }│{7: }{4:oneword another word }|
+ {7: }{4:word another word }│{7: }{23:----------------------}|
+ {7: }{22:additional line }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:word,iwhiteall')
+ screen:expect([[
+ {7: }{4:^this is }│{7: }{4:this is }{27:some test}{4: }|
+ {7: }{27:sometest text}{4: foo }│{7: }{27:texts}{4: }|
+ {7: }{27:baz abc def }{4: }│{7: }{4:foo }{27:bar abX Yef }{4: }|
+ {7: }{27:one}{4: }│{7: }{27:oneword}{4: another word }|
+ {7: }{27:word}{4: another word }│{7: }{23:----------------------}|
+ {7: }{22:additional line }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {3:Xdifile1 }{2:Xdifile2 }|
+ |
+ ]])
+
+ -- newline should be highlighted too when 'list' is set
+ command('windo set list listchars=eol:$')
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ screen:expect([[
+ {7: }{4:this }{100: }{4:is }{100: }{103:$}{4: }│{7: }{4:^this is some}{100: }{4:test}{101:$}{4: }|
+ {7: }{4:sometest}{27: }{4:text}{27: }{4:foo}{101:$}{4: }│{7: }{4:text}{27:s}{101:$}{4: }|
+ {7: }{4:ba}{27:z}{4: ab}{27:c}{4: }{27:d}{4:ef }{11:$}{4: }│{7: }{4:foo}{27: }{4:ba}{27:r}{4: ab}{27:X}{4: }{27:Y}{4:ef }{100: }{11:$}{4: }|
+ {7: }{4:one}{103:$}{4: }│{7: }{4:oneword another word}{11:$}{4: }|
+ {7: }{4:word another word}{11:$}{4: }│{7: }{23:----------------------}|
+ {7: }{22:additional line}{104:$}{22: }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {2:Xdifile1 }{3:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:char,iwhite')
+ screen:expect([[
+ {7: }{4:this is }{11:$}{4: }│{7: }{4:^this is some}{100: }{4:test}{11:$}{4: }|
+ {7: }{4:sometest text foo}{11:$}{4: }│{7: }{4:text}{100:s}{11:$}{4: }|
+ {7: }{4:ba}{27:z}{4: ab}{27:c}{4: }{27:d}{4:ef }{11:$}{4: }│{7: }{4:foo ba}{27:r}{4: ab}{27:X}{4: }{27:Y}{4:ef }{11:$}{4: }|
+ {7: }{4:one}{103:$}{4: }│{7: }{4:oneword another word}{11:$}{4: }|
+ {7: }{4:word another word}{11:$}{4: }│{7: }{23:----------------------}|
+ {7: }{22:additional line}{104:$}{22: }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {2:Xdifile1 }{3:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:char,iwhiteeol')
+ screen:expect([[
+ {7: }{4:this }{100: }{4:is }{11:$}{4: }│{7: }{4:^this is some}{100: }{4:test}{11:$}{4: }|
+ {7: }{4:sometest text foo}{11:$}{4: }│{7: }{4:text}{100:s}{11:$}{4: }|
+ {7: }{4:ba}{27:z}{4: ab}{27:c}{4: }{27:d}{4:ef }{11:$}{4: }│{7: }{4:foo ba}{27:r}{4: ab}{27:X}{4: }{27:Y}{4:ef }{11:$}{4: }|
+ {7: }{4:one}{103:$}{4: }│{7: }{4:oneword another word}{11:$}{4: }|
+ {7: }{4:word another word}{11:$}{4: }│{7: }{23:----------------------}|
+ {7: }{22:additional line}{104:$}{22: }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {2:Xdifile1 }{3:Xdifile2 }|
+ |
+ ]])
+ command('set diffopt=internal,filler diffopt+=inline:char,iwhiteall')
+ screen:expect([[
+ {7: }{4:this is }{11:$}{4: }│{7: }{4:^this is some test}{11:$}{4: }|
+ {7: }{4:sometest text foo}{11:$}{4: }│{7: }{4:text}{100:s}{11:$}{4: }|
+ {7: }{4:ba}{27:z}{4: ab}{27:c d}{4:ef }{11:$}{4: }│{7: }{4:foo ba}{27:r}{4: ab}{27:X Y}{4:ef }{11:$}{4: }|
+ {7: }{4:one}{11:$}{4: }│{7: }{4:oneword another word}{11:$}{4: }|
+ {7: }{4:word another word}{11:$}{4: }│{7: }{23:----------------------}|
+ {7: }{22:additional line}{104:$}{22: }│{7: }{23:----------------------}|
+ {1:~ }│{1:~ }|*12
+ {2:Xdifile1 }{3:Xdifile2 }|
+ |
+ ]])
+ command('windo set nolist')
+end)
+
+-- oldtest: Test_diff_inline_multibuffer()
+it('diff mode inline highlighting with 3 buffers', function()
+ write_file('Xdifile1', '')
+ write_file('Xdifile2', '')
+ write_file('Xdifile3', '')
+ finally(function()
+ os.remove('Xdifile1')
+ os.remove('Xdifile2')
+ os.remove('Xdifile3')
+ end)
+
+ local screen = Screen.new(75, 20)
+ screen:add_extra_attr_ids({
+ [100] = { background = Screen.colors.Blue1 },
+ })
+ command('args Xdifile1 Xdifile2 Xdifile3 | vert all | windo diffthis | 1wincmd w')
+ command('wincmd =')
+ command('hi DiffTextAdd guibg=Blue')
+
+ WriteDiffFiles3(
+ 'That is buffer1.\nanchor\nSome random text\nanchor',
+ 'This is buffer2.\nanchor\nSome text\nanchor\nbuffer2/3',
+ 'This is buffer3. Last.\nanchor\nSome more\ntext here.\nanchor\nonly in buffer2/3\nnot in buffer1'
+ )
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ local s1 = [[
+ {7: }{4:^Th}{27:at}{4: is buffer}{27:1}{4:. }│{7: }{4:Th}{27:is}{4: is buffer}{27:2}{4:. }│{7: }{4:Th}{27:is}{4: is buffer}{27:3. Last}{4:.}|
+ {7: }anchor │{7: }anchor │{7: }anchor |
+ {7: }{4:Some }{27:random }{4:text }│{7: }{4:Some text }│{7: }{4:Some }{27:more}{4: }|
+ {7: }{23:-----------------------}│{7: }{23:----------------------}│{7: }{4:text}{100: here.}{4: }|
+ {7: }anchor │{7: }anchor │{7: }anchor |
+ {7: }{23:-----------------------}│{7: }{4:buffer2/3 }│{7: }{100:only in }{4:buffer2/3 }|
+ {7: }{23:-----------------------}│{7: }{23:----------------------}│{7: }{22:not in buffer1 }|
+ {1:~ }│{1:~ }│{1:~ }|*11
+ {3:Xdifile1 }{2:Xdifile2 Xdifile3 }|
+ |
+ ]]
+ screen:expect(s1)
+
+ -- Close one of the buffers and make sure it updates correctly
+ command('diffoff')
+ screen:expect([[
+ ^That is buffer1. │{7: }{4:This is buffer}{27:2}{4:. }│{7: }{4:This is buffer}{27:3. Last}{4:.}|
+ anchor │{7: }anchor │{7: }anchor |
+ Some random text │{7: }{4:Some text }│{7: }{4:Some }{100:more}{4: }|
+ anchor │{7: }{23:----------------------}│{7: }{4:text}{100: here.}{4: }|
+ {1:~ }│{7: }anchor │{7: }anchor |
+ {1:~ }│{7: }{4:buffer2/3 }│{7: }{100:only in }{4:buffer2/3 }|
+ {1:~ }│{7: }{23:----------------------}│{7: }{22:not in buffer1 }|
+ {1:~ }│{1:~ }│{1:~ }|*11
+ {3:Xdifile1 }{2:Xdifile2 Xdifile3 }|
+ |
+ ]])
+
+ -- Update text in the non-diff buffer and nothing should be changed
+ feed('isometext')
+ screen:expect([[
+ sometext^That is buffer1. │{7: }{4:This is buffer}{27:2}{4:. }│{7: }{4:This is buffer}{27:3. Last}{4:.}|
+ anchor │{7: }anchor │{7: }anchor |
+ Some random text │{7: }{4:Some text }│{7: }{4:Some }{100:more}{4: }|
+ anchor │{7: }{23:----------------------}│{7: }{4:text}{100: here.}{4: }|
+ {1:~ }│{7: }anchor │{7: }anchor |
+ {1:~ }│{7: }{4:buffer2/3 }│{7: }{100:only in }{4:buffer2/3 }|
+ {1:~ }│{7: }{23:----------------------}│{7: }{22:not in buffer1 }|
+ {1:~ }│{1:~ }│{1:~ }|*11
+ {3:Xdifile1 [+] }{2:Xdifile2 Xdifile3 }|
+ {5:-- INSERT --} |
+ ]])
+ feed('<Esc>')
+ command('silent! undo')
+
+ command('diffthis')
+ screen:expect(s1)
+
+ -- Test that removing first buffer from diff will in turn use the next
+ -- earliest buffer's iskeyword during word diff.
+ WriteDiffFiles3('This+is=a-setence', 'This+is=another-setence', 'That+is=a-setence')
+ command('set iskeyword+=+ | 2wincmd w | set iskeyword+=- | 1wincmd w')
+ command('set diffopt=internal,filler diffopt+=inline:word')
+ local s4 = [[
+ {7: }{27:^This+is}{4:=}{27:a}{4:-setence }│{7: }{27:This+is}{4:=}{27:another}{4:-setenc}│{7: }{27:That+is}{4:=}{27:a}{4:-setence }|
+ {1:~ }│{1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 Xdifile3 }|
+ |
+ ]]
+ screen:expect(s4)
+ command('diffoff')
+ screen:expect([[
+ ^This+is=a-setence │{7: }{27:This}{4:+is=}{27:another-setenc}│{7: }{27:That}{4:+is=}{27:a-setence}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 Xdifile3 }|
+ |
+ ]])
+ command('diffthis')
+ screen:expect(s4)
+
+ -- Test multi-buffer char diff refinement, and that removing a buffer from
+ -- diff will update the others properly.
+ WriteDiffFiles3('abcdefghijkYmYYY', 'aXXdXXghijklmnop', 'abcdefghijkYmYop')
+ command('set diffopt=internal,filler diffopt+=inline:char')
+ local s6 = [[
+ {7: }{4:^a}{27:bcdef}{4:ghijk}{27:YmYYY}{4: }│{7: }{4:a}{27:XXdXX}{4:ghijk}{27:lmnop}{4: }│{7: }{4:a}{27:bcdef}{4:ghijk}{27:YmYop}{4: }|
+ {1:~ }│{1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 Xdifile3 }|
+ |
+ ]]
+ screen:expect(s6)
+ command('diffoff')
+ screen:expect([[
+ ^abcdefghijkYmYYY │{7: }{4:a}{27:XXdXX}{4:ghijk}{27:l}{4:m}{27:n}{4:op }│{7: }{4:a}{27:bcdef}{4:ghijk}{27:Y}{4:m}{27:Y}{4:op }|
+ {1:~ }│{1:~ }│{1:~ }|*17
+ {3:Xdifile1 }{2:Xdifile2 Xdifile3 }|
+ |
+ ]])
+ command('diffthis')
+ screen:expect(s6)
+end)
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 9b01150411..94faafa9be 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -229,11 +229,11 @@ describe('ui/ext_messages', function()
{
content = {
{ '\n@character ' },
- { 'xxx', 26, 155 },
+ { 'xxx', 26, 156 },
{ ' ' },
{ 'links to', 18, 5 },
{ ' Character\n@character.special ' },
- { 'xxx', 16, 156 },
+ { 'xxx', 16, 157 },
{ ' ' },
{ 'links to', 18, 5 },
{ ' SpecialChar' },
@@ -300,7 +300,7 @@ describe('ui/ext_messages', function()
cmdline = { { abort = false } },
messages = {
{
- content = { { 'Error', 9, 6 }, { 'Message', 16, 99 } },
+ content = { { 'Error', 9, 6 }, { 'Message', 16, 100 } },
history = true,
kind = 'echoerr',
},
@@ -940,7 +940,7 @@ describe('ui/ext_messages', function()
^ |
{1:~ }|*4
]],
- ruler = { { '0,0-1 All', 9, 61 } },
+ ruler = { { '0,0-1 All', 9, 62 } },
})
command('hi clear MsgArea')
feed('i')
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index 3ee4d429c7..90b3094082 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -1719,6 +1719,20 @@ describe('ui/mouse/input', function()
]])
end)
+ it("mouse click on window separator in statusline doesn't crash", function()
+ api.nvim_set_option_value('winwidth', 1, {})
+ api.nvim_set_option_value('statusline', '%f', {})
+
+ command('vsplit')
+ command('redraw')
+
+ local lines = api.nvim_get_option_value('lines', {})
+ local columns = api.nvim_get_option_value('columns', {})
+
+ api.nvim_input_mouse('left', 'press', '', 0, lines - 1, math.floor(columns / 2))
+ command('redraw')
+ end)
+
it('getmousepos() works correctly', function()
local winwidth = api.nvim_get_option_value('winwidth', {})
-- Set winwidth=1 so that window sizes don't change.
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 9403f39ba1..c73cec22a0 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -5478,7 +5478,489 @@ describe('builtin popupmenu', function()
end
end)
- it('does not crash when displayed in the last column with rightleft #12032', function()
+ -- oldtest: Test_pum_maxwidth()
+ it('"pummaxwidth"', function()
+ screen:try_resize(60, 8)
+ api.nvim_buf_set_lines(0, 0, -1, true, {
+ '123456789_123456789_123456789_a',
+ '123456789_123456789_123456789_b',
+ ' 123',
+ })
+ feed('G"zyy')
+ feed('A<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------------------------------------]|*7
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_123456789_a^ |
+ {1:~ }|*4
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
+ ## grid 4
+ {s: 123456789_123456789_123456789_a }|
+ {n: 123456789_123456789_123456789_b }|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_123456789_a^ |
+ {1:~ }{s: 123456789_123456789_123456789_a }{1: }|
+ {1:~ }{n: 123456789_123456789_123456789_b }{1: }|
+ {1:~ }|*2
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
+ ]])
+ end
+ feed('<Esc>3Gdd"zp')
+
+ command('set pummaxwidth=10')
+ feed('GA<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------------------------------------]|*7
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_123456789_a^ |
+ {1:~ }|*4
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
+ ## grid 4
+ {s: 1234567...}|
+ {n: 1234567...}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_123456789_a^ |
+ {1:~ }{s: 1234567...}{1: }|
+ {1:~ }{n: 1234567...}{1: }|
+ {1:~ }|*2
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
+ ]])
+ end
+ feed('<Esc>3Gdd"zp')
+
+ command('set pummaxwidth=20')
+ feed('GA<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------------------------------------]|*7
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_123456789_a^ |
+ {1:~ }|*4
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
+ ## grid 4
+ {s: 123456789_1234567...}|
+ {n: 123456789_1234567...}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_123456789_a^ |
+ {1:~ }{s: 123456789_1234567...}{1: }|
+ {1:~ }{n: 123456789_1234567...}{1: }|
+ {1:~ }|*2
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
+ ]])
+ end
+ feed('<Esc>3Gdd"zp')
+
+ command('set pumwidth=20 pummaxwidth=8')
+ feed('GA<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------------------------------------]|*7
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_123456789_a^ |
+ {1:~ }|*4
+ ## grid 3
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
+ ## grid 4
+ {s: 12345...}|
+ {n: 12345...}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 3, 11, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_123456789_a^ |
+ {1:~ }{s: 12345...}{1: }|
+ {1:~ }{n: 12345...}{1: }|
+ {1:~ }|*2
+ {2:-- Keyword Local completion (^N^P) }{5:match 1 of 2} |
+ ]])
+ end
+ feed('<Esc>3Gdd"zp')
+
+ screen:try_resize(32, 10)
+ feed('GA<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*9
+ [3:--------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_|
+ 123456789_a^ |
+ {1:~ }|*5
+ ## grid 3
+ {2:-- }{5:match 1 of 2} |
+ ## grid 4
+ {s: 12345...}|
+ {n: 12345...}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 4, 11, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_|
+ 123456789_a^ |
+ {1:~ }{s: 12345...}{1: }|
+ {1:~ }{n: 12345...}{1: }|
+ {1:~ }|*3
+ {2:-- }{5:match 1 of 2} |
+ ]])
+ end
+ feed('<Esc>3Gdd"zp')
+ end)
+
+ -- oldtest: Test_pum_maxwidth_multibyte()
+ it("'pummaxwidth' with multibyte", function()
+ screen:try_resize(60, 8)
+ exec([[
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return [
+ \ #{word: "123456789_123456789_123456789_"},
+ \ #{word: "一二三四五六七八九十"},
+ \ #{word: "abcdefghij"},
+ \ #{word: "上下左右"},
+ \ ]
+ endfunc
+ set omnifunc=Omni_test
+ ]])
+
+ feed('S<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------------------------------------]|*7
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
+ ## grid 4
+ {s:123456789_123456789_123456789_ }|
+ {n:一二三四五六七八九十 }|
+ {n:abcdefghij }|
+ {n:上下左右 }|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_^ |
+ {s:123456789_123456789_123456789_ }{1: }|
+ {n:一二三四五六七八九十 }{1: }|
+ {n:abcdefghij }{1: }|
+ {n:上下左右 }{1: }|
+ {1:~ }|*2
+ {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
+ ]])
+ end
+ feed('<Esc>')
+
+ command('set pummaxwidth=10')
+ feed('S<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------------------------------------]|*7
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
+ ## grid 4
+ {s:1234567...}|
+ {n:一二三 ...}|
+ {n:abcdefghij}|
+ {n:上下左右 }|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_^ |
+ {s:1234567...}{1: }|
+ {n:一二三 ...}{1: }|
+ {n:abcdefghij}{1: }|
+ {n:上下左右 }{1: }|
+ {1:~ }|*2
+ {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
+ ]])
+ end
+ feed('<Esc>')
+
+ command('set rightleft')
+ feed('S<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------------------------------------]|*7
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ ^ _987654321_987654321_987654321|
+ {1: ~}|*6
+ ## grid 3
+ {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
+ ## grid 4
+ {s:...7654321}|
+ {n:... 三二一}|
+ {n:jihgfedcba}|
+ {n: 右左下上}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 50, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ _987654321_987654321_987654321|
+ {1: }{s:...7654321}|
+ {1: }{n:... 三二一}|
+ {1: }{n:jihgfedcba}|
+ {1: }{n: 右左下上}|
+ {1: ~}|*2
+ {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
+ ]])
+ end
+ feed('<Esc>')
+ command('set norightleft')
+
+ command('set pummaxwidth=2')
+ feed('S<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:------------------------------------------------------------]|*7
+ [3:------------------------------------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
+ ## grid 4
+ {s:12}|
+ {n:一}|
+ {n:ab}|
+ {n:上}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_^ |
+ {s:12}{1: }|
+ {n:一}{1: }|
+ {n:ab}{1: }|
+ {n:上}{1: }|
+ {1:~ }|*2
+ {2:-- Omni completion (^O^N^P) }{5:match 1 of 4} |
+ ]])
+ end
+ feed('<Esc>')
+ end)
+
+ it([['pummaxwidth' works with "kind" and "menu"]], function()
+ exec([[
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return [
+ \ #{word: "foo", menu: "fooMenu", kind: "fooKind"},
+ \ #{word: "bar", menu: "barMenu", kind: "barKind"},
+ \ #{word: "baz", menu: "bazMenu", kind: "bazKind"},
+ \ ]
+ endfunc
+ set omnifunc=Omni_test
+ ]])
+
+ command('set pummaxwidth=14')
+ feed('S<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ foo^ |
+ {1:~ }|*18
+ ## grid 3
+ {2:-- }{5:match 1 of 3} |
+ ## grid 4
+ {s:foo fooKind...}|
+ {n:bar barKind...}|
+ {n:baz bazKind...}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ foo^ |
+ {s:foo fooKind...}{1: }|
+ {n:bar barKind...}{1: }|
+ {n:baz bazKind...}{1: }|
+ {1:~ }|*15
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ end
+ feed('<Esc>')
+
+ command('set rightleft')
+ feed('S<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ ^ oof|
+ {1: ~}|*18
+ ## grid 3
+ {2:-- }{5:match 1 of 3} |
+ ## grid 4
+ {s:...dniKoof oof}|
+ {n:...dniKrab rab}|
+ {n:...dniKzab zab}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 18, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ oof|
+ {1: }{s:...dniKoof oof}|
+ {1: }{n:...dniKrab rab}|
+ {1: }{n:...dniKzab zab}|
+ {1: ~}|*15
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ end
+ feed('<Esc>')
+ command('set norightleft')
+
+ command('set pummaxwidth=13')
+ feed('S<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ foo^ |
+ {1:~ }|*18
+ ## grid 3
+ {2:-- }{5:match 1 of 3} |
+ ## grid 4
+ {s:foo fooKin...}|
+ {n:bar barKin...}|
+ {n:baz bazKin...}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ foo^ |
+ {s:foo fooKin...}{1: }|
+ {n:bar barKin...}{1: }|
+ {n:baz bazKin...}{1: }|
+ {1:~ }|*15
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ end
+ feed('<Esc>')
+
+ command('set rightleft')
+ feed('S<C-X><C-O>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*19
+ [3:--------------------------------]|
+ ## grid 2
+ ^ oof|
+ {1: ~}|*18
+ ## grid 3
+ {2:-- }{5:match 1 of 3} |
+ ## grid 4
+ {s:...niKoof oof}|
+ {n:...niKrab rab}|
+ {n:...niKzab zab}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 19, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ oof|
+ {1: }{s:...niKoof oof}|
+ {1: }{n:...niKrab rab}|
+ {1: }{n:...niKzab zab}|
+ {1: ~}|*15
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ end
+ feed('<Esc>')
+ command('set norightleft')
+ end)
+
+ it('does not crash when displayed in last column with rightleft #12032', function()
local col = 30
local items = { 'word', 'choice', 'text', 'thing' }
local max_len = 0
@@ -5498,31 +5980,115 @@ describe('builtin popupmenu', function()
screen:try_resize(32, 8)
command('set completeopt+=menuone,noselect')
feed('i' .. string.rep(' ', 13))
- fn.complete(14, { '哦哦哦哦哦哦哦哦哦哦' })
+
+ fn.complete(14, { '一二三四五六七八九十' })
if multigrid then
screen:expect({
grid = [[
- ## grid 1
- [2:--------------------------------]|*7
- [3:--------------------------------]|
- ## grid 2
- ^ |
- {1:~ }|*6
- ## grid 3
- {2:-- INSERT --} |
- ## grid 4
- {n: 哦哦哦哦哦哦哦哦哦>}|
+ ## grid 1
+ [2:--------------------------------]|*7
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: 一二三四五六七八九>}|
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 12, false, 100 } },
})
else
screen:expect([[
^ |
- {1:~ }{n: 哦哦哦哦哦哦哦哦哦>}|
+ {1:~ }{n: 一二三四五六七八九>}|
{1:~ }|*5
{2:-- INSERT --} |
]])
end
+ feed('<C-E>')
+
+ fn.complete(14, { { word = '一二三', kind = '四五六', menu = '七八九十' } })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*7
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: 一二三 四五六 七八>}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 12, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ |
+ {1:~ }{n: 一二三 四五六 七八>}|
+ {1:~ }|*5
+ {2:-- INSERT --} |
+ ]])
+ end
+ feed('<C-E>')
+
+ command('set rightleft')
+ fn.complete(14, { '一二三四五六七八九十' })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*7
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1: ~}|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n:<九八七六五四三二一 }|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ |
+ {n:<九八七六五四三二一 }{1: ~}|
+ {1: ~}|*5
+ {2:-- INSERT --} |
+ ]])
+ end
+ feed('<C-E>')
+
+ fn.complete(14, { { word = '一二三', kind = '四五六', menu = '七八九十' } })
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*7
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1: ~}|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n:<八七 六五四 三二一 }|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ |
+ {n:<八七 六五四 三二一 }{1: ~}|
+ {1: ~}|*5
+ {2:-- INSERT --} |
+ ]])
+ end
+ feed('<C-E>')
end)
it('truncates double-width character correctly with scrollbar', function()
@@ -5530,37 +6096,140 @@ describe('builtin popupmenu', function()
command('set completeopt+=noselect')
command('set pumheight=4')
feed('i' .. string.rep(' ', 12))
- local items = {}
+ local items1 = {}
+ local items2 = {}
for _ = 1, 8 do
- table.insert(items, { word = '哦哦哦哦哦哦哦哦哦哦', equal = 1, dup = 1 })
+ table.insert(items1, { word = '一二三四五六七八九十', equal = 1, dup = 1 })
end
- fn.complete(13, items)
+ for _ = 1, 2 do
+ table.insert(
+ items2,
+ { word = 'abcdef', kind = 'ghijkl', menu = 'mnopqrst', equal = 1, dup = 1 }
+ )
+ end
+ for _ = 3, 8 do
+ table.insert(
+ items2,
+ { word = '一二三', kind = '四五六', menu = '七八九十', equal = 1, dup = 1 }
+ )
+ end
+
+ fn.complete(13, items1)
if multigrid then
screen:expect({
grid = [[
- ## grid 1
- [2:--------------------------------]|*7
- [3:--------------------------------]|
- ## grid 2
- ^ |
- {1:~ }|*6
- ## grid 3
- {2:-- INSERT --} |
- ## grid 4
- {n: 哦哦哦哦哦哦哦哦哦>}{c: }|*2
- {n: 哦哦哦哦哦哦哦哦哦>}{s: }|*2
+ ## grid 1
+ [2:--------------------------------]|*7
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: 一二三四五六七八九>}{c: }|*2
+ {n: 一二三四五六七八九>}{s: }|*2
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 11, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ |
+ {1:~ }{n: 一二三四五六七八九>}{c: }|*2
+ {1:~ }{n: 一二三四五六七八九>}{s: }|*2
+ {1:~ }|*2
+ {2:-- INSERT --} |
+ ]])
+ end
+ feed('<C-E>')
+
+ fn.complete(13, items2)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*7
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {n: abcdef ghijkl mnopq}{c: }|*2
+ {n: 一二三 四五六 七八>}{s: }|*2
]],
float_pos = { [4] = { -1, 'NW', 2, 1, 11, false, 100 } },
})
else
screen:expect([[
^ |
- {1:~ }{n: 哦哦哦哦哦哦哦哦哦>}{c: }|*2
- {1:~ }{n: 哦哦哦哦哦哦哦哦哦>}{s: }|*2
+ {1:~ }{n: abcdef ghijkl mnopq}{c: }|*2
+ {1:~ }{n: 一二三 四五六 七八>}{s: }|*2
{1:~ }|*2
{2:-- INSERT --} |
]])
end
+ feed('<C-E>')
+
+ command('set rightleft')
+ fn.complete(13, items1)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*7
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1: ~}|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {c: }{n:<九八七六五四三二一 }|*2
+ {s: }{n:<九八七六五四三二一 }|*2
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ |
+ {c: }{n:<九八七六五四三二一 }{1: ~}|*2
+ {s: }{n:<九八七六五四三二一 }{1: ~}|*2
+ {1: ~}|*2
+ {2:-- INSERT --} |
+ ]])
+ end
+ feed('<C-E>')
+
+ fn.complete(13, items2)
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*7
+ [3:--------------------------------]|
+ ## grid 2
+ ^ |
+ {1: ~}|*6
+ ## grid 3
+ {2:-- INSERT --} |
+ ## grid 4
+ {c: }{n:qponm lkjihg fedcba }|*2
+ {s: }{n:<八七 六五四 三二一 }|*2
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100 } },
+ })
+ else
+ screen:expect([[
+ ^ |
+ {c: }{n:qponm lkjihg fedcba }{1: ~}|*2
+ {s: }{n:<八七 六五四 三二一 }{1: ~}|*2
+ {1: ~}|*2
+ {2:-- INSERT --} |
+ ]])
+ end
+ feed('<C-E>')
end)
it('supports mousemodel=popup', function()