diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-10-17 21:42:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-17 21:42:34 +0800 |
commit | 356a6728ac077fa7ec4f6fbc51eda33e025d86e0 (patch) | |
tree | 1666a37840228a5370815e4d25f137105ba5f4af /test/functional | |
parent | c9963e2212bda7a4d2186469ad07078d348353cf (diff) | |
download | rneovim-356a6728ac077fa7ec4f6fbc51eda33e025d86e0.tar.gz rneovim-356a6728ac077fa7ec4f6fbc51eda33e025d86e0.tar.bz2 rneovim-356a6728ac077fa7ec4f6fbc51eda33e025d86e0.zip |
vim-patch:9.0.2037: A few remaining cmdline completion issues with C-E/Y (#25686)
Problem: A few remaining cmdline completion issues with C-E/Y
Solution: Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not
used at the end
Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not used at the end
A few places in the cmdline completion code only works properly when the
user hits Tab (or 'wildchar') at the end of the cmdline, even though
it's supposed to work even in the middle of the line.
For fuzzy search, `:e ++ff`, and `:set hl=`, fix completion code to make
sure to use `xp_pattern_len` instead of assuming the entire `xp_pattern`
is the search pattern (since it contains texts after the cursor).
Fix Ctrl-E / Ctrl-Y to not jump to the end when canceling/accepting a
wildmenu completion. Also, make them work even when not using
`set wildoptions+=pum` as there is no drawback to doing so.
(Related issue where this was brought up: vim/vim#13331)
closes: vim/vim#13362
https://github.com/vim/vim/commit/209ec90b9b9bd948d76511c9cd2b17f47a97afe6
Cherry-pick ex_getln.c changes from patch 9.0.2035.
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/fixtures/wildpum/Xnamedir/XdirA/XdirB/XfileC (renamed from test/functional/fixtures/wildpum/Xdir/XdirA/XdirB/XfileC) | 0 | ||||
-rw-r--r-- | test/functional/fixtures/wildpum/Xnamedir/XdirA/XfileB (renamed from test/functional/fixtures/wildpum/Xdir/XdirA/XfileB) | 0 | ||||
-rw-r--r-- | test/functional/fixtures/wildpum/Xnamedir/XfileA (renamed from test/functional/fixtures/wildpum/Xdir/XfileA) | 0 | ||||
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 67 |
4 files changed, 55 insertions, 12 deletions
diff --git a/test/functional/fixtures/wildpum/Xdir/XdirA/XdirB/XfileC b/test/functional/fixtures/wildpum/Xnamedir/XdirA/XdirB/XfileC index e69de29bb2..e69de29bb2 100644 --- a/test/functional/fixtures/wildpum/Xdir/XdirA/XdirB/XfileC +++ b/test/functional/fixtures/wildpum/Xnamedir/XdirA/XdirB/XfileC diff --git a/test/functional/fixtures/wildpum/Xdir/XdirA/XfileB b/test/functional/fixtures/wildpum/Xnamedir/XdirA/XfileB index e69de29bb2..e69de29bb2 100644 --- a/test/functional/fixtures/wildpum/Xdir/XdirA/XfileB +++ b/test/functional/fixtures/wildpum/Xnamedir/XdirA/XfileB diff --git a/test/functional/fixtures/wildpum/Xdir/XfileA b/test/functional/fixtures/wildpum/Xnamedir/XfileA index e69de29bb2..e69de29bb2 100644 --- a/test/functional/fixtures/wildpum/Xdir/XfileA +++ b/test/functional/fixtures/wildpum/Xnamedir/XfileA diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 38649a2be3..bfa4b7f14e 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -3096,7 +3096,7 @@ describe('builtin popupmenu', function() :sign define culhl= culhl=^ | ]]) - feed('<C-U>e Xdi<Tab><Tab>') + feed('<C-U>e Xnamedi<Tab><Tab>') screen:expect([[ | {1:~ }| @@ -3105,9 +3105,9 @@ describe('builtin popupmenu', function() {1:~ }| {1:~ }| {1:~ }| - {1:~ }{s: XdirA/ }{1: }| - {1:~ }{n: XfileA }{1: }| - :e Xdir/XdirA/^ | + {1:~ }{s: XdirA/ }{1: }| + {1:~ }{n: XfileA }{1: }| + :e Xnamedir/XdirA/^ | ]]) -- Pressing <Down> on a directory name should go into that directory @@ -3120,9 +3120,9 @@ describe('builtin popupmenu', function() {1:~ }| {1:~ }| {1:~ }| - {1:~ }{s: XdirB/ }{1: }| - {1:~ }{n: XfileB }{1: }| - :e Xdir/XdirA/XdirB/^ | + {1:~ }{s: XdirB/ }{1: }| + {1:~ }{n: XfileB }{1: }| + :e Xnamedir/XdirA/XdirB/^ | ]]) -- Pressing <Up> on a directory name should go to the parent directory @@ -3135,9 +3135,9 @@ describe('builtin popupmenu', function() {1:~ }| {1:~ }| {1:~ }| - {1:~ }{s: XdirA/ }{1: }| - {1:~ }{n: XfileA }{1: }| - :e Xdir/XdirA/^ | + {1:~ }{s: XdirA/ }{1: }| + {1:~ }{n: XfileA }{1: }| + :e Xnamedir/XdirA/^ | ]]) -- Pressing <C-A> when the popup menu is displayed should list all the @@ -3511,6 +3511,49 @@ describe('builtin popupmenu', function() :sign define^ | ]]) + -- pressing <C-E> to end completion should work in middle of the line too + feed('<Esc>:set wildchazz<Left><Left><Tab>') + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }{s: wildchar }{1: }| + {1:~ }{n: wildcharm }{1: }| + :set wildchar^zz | + ]]) + feed('<C-E>') + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + :set wildcha^zz | + ]]) + + -- pressing <C-Y> should select the current match and end completion + feed('<Esc>:set wildchazz<Left><Left><Tab><C-Y>') + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + :set wildchar^zz | + ]]) + feed('<Esc>') -- check positioning with multibyte char in pattern @@ -3726,13 +3769,13 @@ describe('builtin popupmenu', function() end) -- oldtest: Test_wildmenu_pum_clear_entries() - it('wildoptions=pum when using Ctrl-E as wildchar vim-patch:9.0.1030', function() + it('wildoptions=pum when using odd wildchar', function() screen:try_resize(30, 10) exec([[ set wildoptions=pum set wildchar=<C-E> ]]) - feed(':sign <C-E><C-E>') + feed(':sign <C-E>') screen:expect([[ | {1:~ }| |