aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/popupmenu_spec.lua108
-rw-r--r--test/old/testdir/test_popup.vim55
2 files changed, 163 insertions, 0 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 4c5b1d2bd2..0a28ea2d0a 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -5935,6 +5935,114 @@ describe('builtin popupmenu', function()
]])
feed('<C-E><Esc>')
end)
+
+ -- oldtest: Test_pum_complete_with_special_characters()
+ it('multi-line completion', function()
+ exec([[
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return [#{word: "func ()\n\t\nend", abbr: "function ()",}, #{word: "foobar"}, #{word: "你好\n\t\n我好"}]
+ endfunc
+ set omnifunc=Omni_test
+ ]])
+
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ func () |
+ |
+ end^ |
+ {s:function () }{1: }|
+ {n:foobar }{1: }|
+ {n:你好^@ ^@我好 }{1: }|
+ {1:~ }|*13
+ {2:-- }{5:match 1 of 3} |
+ ]])
+
+ feed('<C-N>')
+ screen:expect([[
+ foobar^ |
+ {n:function () }{1: }|
+ {s:foobar }{1: }|
+ {n:你好^@ ^@我好 }{1: }|
+ {1:~ }|*15
+ {2:-- }{5:match 2 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+
+ feed('Shello hero<ESC>hhhhha<C-X><C-O>')
+ screen:expect([[
+ hello func () |
+ |
+ end^ hero |
+ {1:~ }{s: function () }{1: }|
+ {1:~ }{n: foobar }{1: }|
+ {1:~ }{n: 你好^@ ^@我好 }{1: }|
+ {1:~ }|*13
+ {2:-- }{5:match 1 of 3} |
+ ]])
+
+ feed('<C-N>')
+ screen:expect([[
+ hello foobar^ hero |
+ {1:~ }{n: function () }{1: }|
+ {1:~ }{s: foobar }{1: }|
+ {1:~ }{n: 你好^@ ^@我好 }{1: }|
+ {1:~ }|*15
+ {2:-- }{5:match 2 of 3} |
+ ]])
+
+ feed('<C-N>')
+ screen:expect([[
+ hello 你好 |
+ |
+ 我好^ hero |
+ {1:~ }{n: function () }{1: }|
+ {1:~ }{n: foobar }{1: }|
+ {1:~ }{s: 你好^@ ^@我好 }{1: }|
+ {1:~ }|*13
+ {2:-- }{5:match 3 of 3} |
+ ]])
+
+ feed('<C-N>')
+ screen:expect([[
+ hello ^ hero |
+ {1:~ }{n: function () }{1: }|
+ {1:~ }{n: foobar }{1: }|
+ {1:~ }{n: 你好^@ ^@我好 }{1: }|
+ {1:~ }|*15
+ {2:-- }{8:Back at original} |
+ ]])
+ feed('<C-E><ESC>')
+
+ command(':hi ComplMatchIns guifg=red')
+ feed('S<C-X><C-O>')
+ screen:expect([[
+ {8:func ()} |
+ {8: } |
+ {8:end}^ |
+ {s:function () }{1: }|
+ {n:foobar }{1: }|
+ {n:你好^@ ^@我好 }{1: }|
+ {1:~ }|*13
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+
+ feed('Shello hero<ESC>hhhhha<C-X><C-O>')
+ screen:expect([[
+ hello {8:func ()} |
+ {8: } |
+ {8:end^ }hero |
+ {1:~ }{s: function () }{1: }|
+ {1:~ }{n: foobar }{1: }|
+ {1:~ }{n: 你好^@ ^@我好 }{1: }|
+ {1:~ }|*13
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><ESC>')
+ end)
end
end
diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim
index e4abf978ab..7f80c60118 100644
--- a/test/old/testdir/test_popup.vim
+++ b/test/old/testdir/test_popup.vim
@@ -1885,4 +1885,59 @@ func Test_popup_completion_many_ctrlp()
bw!
endfunc
+func Test_pum_complete_with_special_characters()
+ CheckScreendump
+
+ let lines =<< trim END
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return [#{word: "func ()\n\t\nend", abbr: "function ()",}, #{word: "foobar"}, #{word: "你好\n\t\n我好"}]
+ endfunc
+ set omnifunc=Omni_test
+ END
+
+ call writefile(lines, 'Xpreviewscript', 'D')
+ let buf = RunVimInTerminal('-S Xpreviewscript', #{rows: 12})
+ call term_sendkeys(buf, "S\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_with_special_characters_01', {})
+
+ call term_sendkeys(buf, "\<C-N>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_with_special_characters_02', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ call term_sendkeys(buf, "Shello hero\<ESC>hhhhha\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_with_special_characters_03', {})
+
+ call term_sendkeys(buf, "\<C-N>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_with_special_characters_04', {})
+
+ call term_sendkeys(buf, "\<C-N>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_with_special_characters_05', {})
+
+ call term_sendkeys(buf, "\<C-N>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_with_special_characters_06', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ call term_sendkeys(buf, ":hi ComplMatchIns ctermfg=red\<CR>")
+ call TermWait(buf, 50)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>")
+ call VerifyScreenDump(buf, 'Test_pum_with_special_characters_07', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ call term_sendkeys(buf, "Shello hero\<ESC>hhhhha\<C-X>\<C-O>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_pum_with_special_characters_08', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab