]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1699: Fuzzy completion disabled for 'findfunc' and customlist v9.1.1699
authorMaxim Kim <habamax@gmail.com>
Wed, 27 Aug 2025 16:09:14 +0000 (18:09 +0200)
committerChristian Brabandt <cb@256bit.org>
Wed, 27 Aug 2025 16:09:14 +0000 (18:09 +0200)
Problem:  Fuzzy completion disabled for 'findfunc' and customlist
Solution: Remove those cases from cmdline_fuzzy_completion_supported()
          because it is supported (Maxim Kim).

fixes: #18117
closes: #18122

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/cmdexpand.c
src/testdir/dumps/Test_wildmenu_pum_hl_match_find_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_pum_hl_match_find_2.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_pum_hl_match_list_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_pum_hl_match_list_2.dump [new file with mode: 0644]
src/testdir/test_cmdline.vim
src/version.c

index f4feec94b656e6a1e2ac775b363979cf7f77d1a0..8b42d7ab1ff7ffd1e8c129786b72e57f76b9b8f2 100644 (file)
@@ -58,7 +58,6 @@ cmdline_fuzzy_completion_supported(expand_T *xp)
     case EXPAND_FILES_IN_PATH:
     case EXPAND_FILETYPE:
     case EXPAND_FILETYPECMD:
-    case EXPAND_FINDFUNC:
     case EXPAND_HELP:
     case EXPAND_KEYMAP:
     case EXPAND_OLD_SETTING:
@@ -71,7 +70,6 @@ cmdline_fuzzy_completion_supported(expand_T *xp)
     case EXPAND_SHELLCMDLINE:
     case EXPAND_TAGS:
     case EXPAND_TAGS_LISTFILES:
-    case EXPAND_USER_LIST:
        return FALSE;
 
     default:
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_find_1.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_find_1.dump
new file mode 100644 (file)
index 0000000..8d8bdb2
--- /dev/null
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @3| +0#0000001#e0e0e08|h+1&&|e|l+0&&@1|o|/|w+1&&|o|r+0&&|l|d| @4| +0#4040ff13#ffffff0@27
+|~| @3| +0#0000001#ffd7ff255|h+1&&|e|l+0&&@1|o|/|w+1&&|o|n+0&&|d|e|r|f|u|l| | +0#4040ff13#ffffff0@27
+|:+0#0000000&|f|i|n|d| |h|e|l@1|o|/|w|o|r|l|d> @32
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_find_2.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_find_2.dump
new file mode 100644 (file)
index 0000000..ecbc06d
--- /dev/null
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @3| +0#0000001#e0e0e08|h|e|l@1|o|/|w|o|r|l|d| @4| +0#4040ff13#ffffff0@27
+|~| @3| +0#0000001#ffd7ff255|h|e|l@1|o|/|w|o|n|d|e|r|f|u|l| | +0#4040ff13#ffffff0@27
+|:+0#0000000&|f|i|n|d| |h|e|l@1|o|/|w|o|r|l|d> @32
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_list_1.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_list_1.dump
new file mode 100644 (file)
index 0000000..ce9948d
--- /dev/null
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @4| +0#0000001#e0e0e08|h+1&&|e|l+0&&@1|o|/|w+1&&|o|r+0&&|l|d| @4| +0#4040ff13#ffffff0@26
+|~| @4| +0#0000001#ffd7ff255|h+1&&|e|l+0&&@1|o|/|w+1&&|o|n+0&&|d|e|r|f|u|l| | +0#4040ff13#ffffff0@26
+|:+0#0000000&|L|i|s|t|T| |h|e|l@1|o|/|w|o|r|l|d> @31
diff --git a/src/testdir/dumps/Test_wildmenu_pum_hl_match_list_2.dump b/src/testdir/dumps/Test_wildmenu_pum_hl_match_list_2.dump
new file mode 100644 (file)
index 0000000..0f26c5a
--- /dev/null
@@ -0,0 +1,10 @@
+| +0&#ffffff0@49
+|~+0#4040ff13&| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @48
+|~| @4| +0#0000001#e0e0e08|h|e|l@1|o|/|w|o|r|l|d| @4| +0#4040ff13#ffffff0@26
+|~| @4| +0#0000001#ffd7ff255|h|e|l@1|o|/|w|o|n|d|e|r|f|u|l| | +0#4040ff13#ffffff0@26
+|:+0#0000000&|L|i|s|t|T| |h|e|l@1|o|/|w|o|r|l|d> @31
index 01198e4bc11779b76e996fafa43070f49936713d..d09faed79a28d8c074b9e2ce3ed46ba99fc6b37d 100644 (file)
@@ -3120,6 +3120,62 @@ func Test_wildmenu_pum_hl_match()
   call StopVimInTerminal(buf)
 endfunc
 
+" Test highlighting of matched text in cmdline completion popup menu provided
+" by a command completed with customlist.
+func Test_wildmenu_pum_hl_match_list()
+  CheckScreendump
+
+  let lines =<< trim END
+    set wildoptions=pum,fuzzy
+    hi PmenuMatchSel  cterm=reverse
+    hi PmenuMatch     cterm=reverse
+    command -nargs=1 -complete=customlist,ListComplete ListT echo <q-args>
+    func ListComplete(A, B, C)
+      return ['hello/world', 'hello/wonderful']->matchfuzzy(a:A)
+    endfunc
+  END
+  call writefile(lines, 'Xwildmenu_pum_hl', 'D')
+  let buf = RunVimInTerminal('-S Xwildmenu_pum_hl', #{rows: 10, cols: 50})
+
+  call term_sendkeys(buf, ":ListT hewo\<Tab>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_list_1', {})
+  call term_sendkeys(buf, "\<Esc>:set wildoptions-=fuzzy\<CR>")
+  call TermWait(buf)
+  call term_sendkeys(buf, ":ListT hewo\<Tab>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_list_2', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  call StopVimInTerminal(buf)
+endfunc
+
+" Test highlighting of matched text in cmdline completion popup menu provided
+" by a custom 'findfunc'
+func Test_wildmenu_pum_hl_match_findfunc()
+  CheckScreendump
+
+  let lines =<< trim END
+    set wildoptions=pum,fuzzy
+    hi PmenuMatchSel  cterm=reverse
+    hi PmenuMatch     cterm=reverse
+    func FindComplete(cmdarg, cmdcomplete)
+      return ['hello/world', 'hello/wonderful']->matchfuzzy(a:cmdarg)
+    endfunc
+    set findfunc=FindComplete
+  END
+  call writefile(lines, 'Xwildmenu_pum_hl', 'D')
+  let buf = RunVimInTerminal('-S Xwildmenu_pum_hl', #{rows: 10, cols: 50})
+
+  call term_sendkeys(buf, ":find hewo\<Tab>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_find_1', {})
+  call term_sendkeys(buf, "\<Esc>:set wildoptions-=fuzzy\<CR>")
+  call TermWait(buf)
+  call term_sendkeys(buf, ":find hewo\<Tab>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_find_2', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " Test for completion after a :substitute command followed by a pipe (|)
 " character
 func Test_cmdline_complete_substitute()
index 9d0d4e83a3cc39045820cd8c21289634dc008054..0bcd55691cb638d4eb3fbc17b56bfd41544f9e34 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1699,
 /**/
     1698,
 /**/