diff options
author | glepnir <glephunter@gmail.com> | 2025-02-09 10:43:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-09 10:43:02 +0800 |
commit | 53e737748e0e5c032fd6e2c2172c94bc5baf0cb7 (patch) | |
tree | 30049854ad1b714530a3d470703e25a05fd7de65 /test/functional/ui/popupmenu_spec.lua | |
parent | ec3071ffad8e4cf043e93e1c679a37c947856a26 (diff) | |
download | rneovim-53e737748e0e5c032fd6e2c2172c94bc5baf0cb7.tar.gz rneovim-53e737748e0e5c032fd6e2c2172c94bc5baf0cb7.tar.bz2 rneovim-53e737748e0e5c032fd6e2c2172c94bc5baf0cb7.zip |
vim-patch:9.1.1086: completion doesn't work with multi lines (#32377)
Problem: completion doesn't work with multi lines
(Łukasz Jan Niemier)
Solution: handle linebreaks in completion code as expected
(glepnir)
fixes: vim/vim#2505
closes: vim/vim#15373
https://github.com/vim/vim/commit/76bdb82527a13b5b2baa8f7d7ce14b4d5dc05b82
Diffstat (limited to 'test/functional/ui/popupmenu_spec.lua')
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 108 |
1 files changed, 108 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 |