aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/popupmenu_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-12-18 07:34:52 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-12-18 08:15:31 +0800
commit2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3 (patch)
tree22fa7d5d9c4621fb3cf9a313bf348a1135fd4c83 /test/functional/ui/popupmenu_spec.lua
parentc830901e8cde49467d1c99c2d656a13e51979790 (diff)
downloadrneovim-2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3.tar.gz
rneovim-2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3.tar.bz2
rneovim-2f7b385f2ef61626bc034bd6f3a25f5ec9f3a1f3.zip
vim-patch:9.1.0941: ComplMatchIns doesn't work after multibyte chars
Problem: ComplMatchIns doesn't work after multibyte chars (after v9.1.0936) Solution: Use (ptr - line) instead of wlv.col (zeertzjq). closes: vim/vim#16233 https://github.com/vim/vim/commit/f4ccada5c372b2c14cc32490860c6995cd00268c
Diffstat (limited to 'test/functional/ui/popupmenu_spec.lua')
-rw-r--r--test/functional/ui/popupmenu_spec.lua65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index beb3ae385c..1d4709e856 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -5561,6 +5561,71 @@ describe('builtin popupmenu', function()
]])
feed('<C-E><ESC>')
end)
+
+ -- oldtest: Test_pum_matchins_higlight()
+ it('with ComplMatchIns highlight', function()
+ exec([[
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}]
+ endfunc
+ set omnifunc=Omni_test
+ hi ComplMatchIns guifg=red
+ ]])
+
+ feed('Sαβγ <C-X><C-O>')
+ screen:expect([[
+ αβγ {8:foo}^ |
+ {1:~ }{s: foo }{1: }|
+ {1:~ }{n: bar }{1: }|
+ {1:~ }{n: 你好 }{1: }|
+ {1:~ }|*15
+ {2:-- }{5:match 1 of 3} |
+ ]])
+ feed('<C-E><Esc>')
+
+ feed('Sαβγ <C-X><C-O><C-N>')
+ screen:expect([[
+ αβγ {8:bar}^ |
+ {1:~ }{n: foo }{1: }|
+ {1:~ }{s: bar }{1: }|
+ {1:~ }{n: 你好 }{1: }|
+ {1:~ }|*15
+ {2:-- }{5:match 2 of 3} |
+ ]])
+ feed('<C-E><Esc>')
+
+ feed('Sαβγ <C-X><C-O><C-N><C-N>')
+ screen:expect([[
+ αβγ {8:你好}^ |
+ {1:~ }{n: foo }{1: }|
+ {1:~ }{n: bar }{1: }|
+ {1:~ }{s: 你好 }{1: }|
+ {1:~ }|*15
+ {2:-- }{5:match 3 of 3} |
+ ]])
+ feed('<C-E><Esc>')
+
+ -- restore after accept
+ feed('Sαβγ <C-X><C-O><C-Y>')
+ screen:expect([[
+ αβγ foo^ |
+ {1:~ }|*18
+ {2:-- INSERT --} |
+ ]])
+ feed('<Esc>')
+
+ -- restore after cancel completion
+ feed('Sαβγ <C-X><C-O><Space>')
+ screen:expect([[
+ αβγ foo ^ |
+ {1:~ }|*18
+ {2:-- INSERT --} |
+ ]])
+ feed('<Esc>')
+ end)
end
end