patch 9.2.0442: completion: i_CTRL-X_CTRL-V doesn't use dict from customlist

Problem:  Completion with i_CTRL-X_CTRL-V doesn't use dict from cmdline
          "customlist" completion.
Solution: Include abbr/kind/menu/info in the completion items
          (zeertzjq).

closes: #20139

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2026-05-05 18:56:56 +00:00
committed by Christian Brabandt
parent 1903020b82
commit 2bfddbea47
16 changed files with 128 additions and 7 deletions
+1 -1
View File
@@ -1027,7 +1027,7 @@ find_longest_match(expand_T *xp, int options)
return ss;
}
static void
void
free_xp_files_extra(expand_T *xp, int numfiles)
{
if (xp->xp_files_abbr != NULL)
+26 -1
View File
@@ -4801,7 +4801,32 @@ get_next_cmdline_completion(void)
if (expand_cmdline(&compl_xp, compl_pattern.string,
(int)compl_pattern.length, &num_matches, &matches) == EXPAND_OK)
ins_compl_add_matches(num_matches, matches, FALSE);
{
int add_r = OK;
int dir = compl_direction;
for (int i = 0; i < num_matches && add_r != FAIL; i++)
{
char_u *(cptext[CPT_COUNT]) = {NULL, NULL, NULL, NULL};
if (compl_xp.xp_files_abbr != NULL)
cptext[CPT_ABBR] = compl_xp.xp_files_abbr[i];
if (compl_xp.xp_files_kind != NULL)
cptext[CPT_KIND] = compl_xp.xp_files_kind[i];
if (compl_xp.xp_files_menu != NULL)
cptext[CPT_MENU] = compl_xp.xp_files_menu[i];
if (compl_xp.xp_files_info != NULL)
cptext[CPT_INFO] = compl_xp.xp_files_info[i];
add_r = ins_compl_add(matches[i], -1, NULL, cptext, NULL, dir,
CP_FAST, FALSE, NULL, FUZZY_SCORE_NONE);
if (add_r == OK)
// if dir was BACKWARD then honor it just once
dir = FORWARD;
}
FreeWild(num_matches, matches);
free_xp_files_extra(&compl_xp, num_matches);
}
}
/*
+1
View File
@@ -8,6 +8,7 @@ void cmdline_pum_cleanup(cmdline_info_T *cclp);
int cmdline_compl_startcol(void);
char_u *cmdline_compl_pattern(void);
int cmdline_compl_is_fuzzy(void);
void free_xp_files_extra(expand_T *xp, int numfiles);
char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode);
void ExpandInit(expand_T *xp);
void ExpandCleanup(expand_T *xp);
+12
View File
@@ -0,0 +1,12 @@
|D+0&#ffffff0|i|c|t|C|m|d| |a|p@1|l|e> @13|╔+0#0000001#e0e0e08|═@12|X| +0#0000000#ffffff0@32
|~+0#4040ff13&| @5| +0#0000001#e0e0e08|a|p@1|l|e| @1|f| |f|r|u|i|t| @4|║| |A| |r|e|d| |f|r|u|i|t| |║| +0#4040ff13#ffffff0@32
|~| @5| +0#0000001#ffd7ff255|b|a|n|a|n|a| |f| |f|r|u|i|t| @4|╚+0&#e0e0e08|═@12|⇲| +0#4040ff13#ffffff0@32
|~| @5| +0#0000001#ffd7ff255|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| | +0#4040ff13#ffffff0@47
|~| @5| +0#0000001#ffd7ff255|p|l|a|i|n| @13| +0#4040ff13#ffffff0@47
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|-+2#0000000&@1| |C|o|m@1|a|n|d|-|l|i|n|e| |c|o|m|p|l|e|t|i|o|n| |(|^|V|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |4| +0#0000000&@26
+12
View File
@@ -0,0 +1,12 @@
|D+0&#ffffff0|i|c|t|C|m|d| |b|a|n|a|n|a> @60
|~+0#4040ff13&| @5| +0#0000001#ffd7ff255|a|p@1|l|e| @1|f| |f|r|u|i|t| @4|╔+0&#e0e0e08|═@15|X| +0#4040ff13#ffffff0@29
|~| @5| +0#0000001#e0e0e08|b|a|n|a|n|a| |f| |f|r|u|i|t| @4|║| |A| |y|e|l@1|o|w| |f|r|u|i|t| |║| +0#4040ff13#ffffff0@29
|~| @5| +0#0000001#ffd7ff255|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| |╚+0&#e0e0e08|═@15|⇲| +0#4040ff13#ffffff0@29
|~| @5| +0#0000001#ffd7ff255|p|l|a|i|n| @13| +0#4040ff13#ffffff0@47
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|-+2#0000000&@1| |C|o|m@1|a|n|d|-|l|i|n|e| |c|o|m|p|l|e|t|i|o|n| |(|^|V|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |2| |o|f| |4| +0#0000000&@26
+12
View File
@@ -0,0 +1,12 @@
|D+0&#ffffff0|i|c|t|C|m|d| |c|a|r@1|o|t> @60
|~+0#4040ff13&| @5| +0#0000001#ffd7ff255|a|p@1|l|e| @1|f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@47
|~| @5| +0#0000001#ffd7ff255|b|a|n|a|n|a| |f| |f|r|u|i|t| @4|╔+0&#e0e0e08|═@20|X| +0#4040ff13#ffffff0@24
|~| @5| +0#0000001#e0e0e08|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| |║| |A|n| |o|r|a|n|g|e| |v|e|g|e|t|a|b|l|e| |║| +0#4040ff13#ffffff0@24
|~| @5| +0#0000001#ffd7ff255|p|l|a|i|n| @13|╚+0&#e0e0e08|═@20|⇲| +0#4040ff13#ffffff0@24
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|-+2#0000000&@1| |C|o|m@1|a|n|d|-|l|i|n|e| |c|o|m|p|l|e|t|i|o|n| |(|^|V|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |3| |o|f| |4| +0#0000000&@26
+12
View File
@@ -0,0 +1,12 @@
|D+0&#ffffff0|i|c|t|C|m|d| |p|l|a|i|n> @61
|~+0#4040ff13&| @5| +0#0000001#ffd7ff255|a|p@1|l|e| @1|f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@47
|~| @5| +0#0000001#ffd7ff255|b|a|n|a|n|a| |f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@47
|~| @5| +0#0000001#ffd7ff255|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| | +0#4040ff13#ffffff0@47
|~| @5| +0#0000001#e0e0e08|p|l|a|i|n| @13| +0#4040ff13#ffffff0@47
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|-+2#0000000&@1| |C|o|m@1|a|n|d|-|l|i|n|e| |c|o|m|p|l|e|t|i|o|n| |(|^|V|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |4| |o|f| |4| +0#0000000&@26
+12
View File
@@ -0,0 +1,12 @@
|D+0&#ffffff0|i|c|t|C|m|d| > @66
|~+0#4040ff13&| @5| +0#0000001#ffd7ff255|a|p@1|l|e| @1|f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@47
|~| @5| +0#0000001#ffd7ff255|b|a|n|a|n|a| |f| |f|r|u|i|t| @4| +0#4040ff13#ffffff0@47
|~| @5| +0#0000001#ffd7ff255|c|a|r@1|o|t| |v| |v|e|g|e|t|a|b|l|e| | +0#4040ff13#ffffff0@47
|~| @5| +0#0000001#ffd7ff255|p|l|a|i|n| @13| +0#4040ff13#ffffff0@47
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|-+2#0000000&@1| |C|o|m@1|a|n|d|-|l|i|n|e| |c|o|m|p|l|e|t|i|o|n| |(|^|V|^|N|^|P|)| |B+0#e000002&|a|c|k| |a|t| |o|r|i|g|i|n|a|l| +0#0000000&@22
+12
View File
@@ -0,0 +1,12 @@
|s+0&#ffffff0|i|g|n| |u|n|d|e|f|i|n|e> @61
|~+0#4040ff13&| @2| +0#0000001#e0e0e08|u|n|d|e|f|i|n|e| @6| +0#4040ff13#ffffff0@54
|~| @2| +0#0000001#ffd7ff255|u|n|p|l|a|c|e| @7| +0#4040ff13#ffffff0@54
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|-+2#0000000&@1| |C|o|m@1|a|n|d|-|l|i|n|e| |c|o|m|p|l|e|t|i|o|n| |(|^|V|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |2| +0#0000000&@26
+26 -5
View File
@@ -4662,25 +4662,46 @@ func Test_customlist_dict_completion_info_popup()
call term_sendkeys(buf, ":DictCmd \<Tab>")
call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd apple') + 1)], g:test_timeout, ((rows - 4), 'A red fruit'))
call VerifyScreenDump(buf, 'Test_customlist_info_popup_1', {})
call VerifyScreenDump(buf, 'Test_customlist_info_popup_01', {})
call term_sendkeys(buf, "\<Tab>")
call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd banana') + 1)], g:test_timeout, ((rows - 3), 'A yellow fruit'))
call VerifyScreenDump(buf, 'Test_customlist_info_popup_2', {})
call VerifyScreenDump(buf, 'Test_customlist_info_popup_02', {})
call term_sendkeys(buf, "\<Tab>")
call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd carrot') + 1)], g:test_timeout, ((rows - 2), 'An orange vegetable'))
call VerifyScreenDump(buf, 'Test_customlist_info_popup_3', {})
call VerifyScreenDump(buf, 'Test_customlist_info_popup_03', {})
call term_sendkeys(buf, "\<Tab>")
call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd plain') + 1)], g:test_timeout, ((rows - 1), '^\~\s\+plain\s\+$'))
call VerifyScreenDump(buf, 'Test_customlist_info_popup_4', {})
call VerifyScreenDump(buf, 'Test_customlist_info_popup_04', {})
call term_sendkeys(buf, "\<Tab>")
call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':DictCmd ') + 1)], g:test_timeout)
call VerifyScreenDump(buf, 'Test_customlist_info_popup_5', {})
call VerifyScreenDump(buf, 'Test_customlist_info_popup_05', {})
call term_sendkeys(buf, "\<Esc>")
" Tests for Insert mode i_CTRL-X_CTRL-V
call term_sendkeys(buf, "iDictCmd \<C-X>\<C-V>")
call VerifyScreenDump(buf, 'Test_customlist_info_popup_06', {})
call term_sendkeys(buf, "\<C-N>")
call VerifyScreenDump(buf, 'Test_customlist_info_popup_07', {})
call term_sendkeys(buf, "\<C-N>")
call VerifyScreenDump(buf, 'Test_customlist_info_popup_08', {})
call term_sendkeys(buf, "\<C-N>")
call VerifyScreenDump(buf, 'Test_customlist_info_popup_09', {})
call term_sendkeys(buf, "\<C-N>")
call VerifyScreenDump(buf, 'Test_customlist_info_popup_10', {})
" Starting another i_CTRL-X_CTRL-V completion should not leak memory
call term_sendkeys(buf, "\<C-U>sign un\<C-X>\<C-V>")
call VerifyScreenDump(buf, 'Test_customlist_info_popup_11', {})
call StopVimInTerminal(buf)
endfunc
+2
View File
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
442,
/**/
441,
/**/