mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.1735: Rename completion specific findex var
Problem: Rename completion specific findex var Solution: Move "findex" static variable to xp_selected in expand_T closes: #12548 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
parent
be5cdd1d63
commit
e9ef347c13
@ -691,16 +691,15 @@ win_redr_status_matches(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the next or prev cmdline completion match. The index of the match is set
|
* Get the next or prev cmdline completion match. The index of the match is set
|
||||||
* in "p_findex"
|
* in "xp->xp_selected"
|
||||||
*/
|
*/
|
||||||
static char_u *
|
static char_u *
|
||||||
get_next_or_prev_match(
|
get_next_or_prev_match(
|
||||||
int mode,
|
int mode,
|
||||||
expand_T *xp,
|
expand_T *xp,
|
||||||
int *p_findex,
|
|
||||||
char_u *orig_save)
|
char_u *orig_save)
|
||||||
{
|
{
|
||||||
int findex = *p_findex;
|
int findex = xp->xp_selected;
|
||||||
int ht;
|
int ht;
|
||||||
|
|
||||||
if (xp->xp_numfiles <= 0)
|
if (xp->xp_numfiles <= 0)
|
||||||
@ -778,7 +777,7 @@ get_next_or_prev_match(
|
|||||||
else if (p_wmnu)
|
else if (p_wmnu)
|
||||||
win_redr_status_matches(xp, xp->xp_numfiles, xp->xp_files,
|
win_redr_status_matches(xp, xp->xp_numfiles, xp->xp_files,
|
||||||
findex, cmd_showtail);
|
findex, cmd_showtail);
|
||||||
*p_findex = findex;
|
xp->xp_selected = findex;
|
||||||
|
|
||||||
if (findex == -1)
|
if (findex == -1)
|
||||||
return vim_strsave(orig_save);
|
return vim_strsave(orig_save);
|
||||||
@ -957,7 +956,6 @@ ExpandOne(
|
|||||||
int mode)
|
int mode)
|
||||||
{
|
{
|
||||||
char_u *ss = NULL;
|
char_u *ss = NULL;
|
||||||
static int findex; // TODO: Move into expand_T
|
|
||||||
static char_u *orig_save = NULL; // kept value of orig
|
static char_u *orig_save = NULL; // kept value of orig
|
||||||
int orig_saved = FALSE;
|
int orig_saved = FALSE;
|
||||||
int i;
|
int i;
|
||||||
@ -966,14 +964,14 @@ ExpandOne(
|
|||||||
// first handle the case of using an old match
|
// first handle the case of using an old match
|
||||||
if (mode == WILD_NEXT || mode == WILD_PREV
|
if (mode == WILD_NEXT || mode == WILD_PREV
|
||||||
|| mode == WILD_PAGEUP || mode == WILD_PAGEDOWN)
|
|| mode == WILD_PAGEUP || mode == WILD_PAGEDOWN)
|
||||||
return get_next_or_prev_match(mode, xp, &findex, orig_save);
|
return get_next_or_prev_match(mode, xp, orig_save);
|
||||||
|
|
||||||
if (mode == WILD_CANCEL)
|
if (mode == WILD_CANCEL)
|
||||||
ss = vim_strsave(orig_save ? orig_save : (char_u *)"");
|
ss = vim_strsave(orig_save ? orig_save : (char_u *)"");
|
||||||
else if (mode == WILD_APPLY)
|
else if (mode == WILD_APPLY)
|
||||||
ss = vim_strsave(findex == -1
|
ss = vim_strsave(xp->xp_selected == -1
|
||||||
? (orig_save ? orig_save : (char_u *)"")
|
? (orig_save ? orig_save : (char_u *)"")
|
||||||
: xp->xp_files[findex]);
|
: xp->xp_files[xp->xp_selected]);
|
||||||
|
|
||||||
// free old names
|
// free old names
|
||||||
if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST)
|
if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST)
|
||||||
@ -986,9 +984,7 @@ ExpandOne(
|
|||||||
if (compl_match_array != NULL)
|
if (compl_match_array != NULL)
|
||||||
cmdline_pum_remove();
|
cmdline_pum_remove();
|
||||||
}
|
}
|
||||||
// TODO: Remove condition if "findex" is part of expand_T ?
|
xp->xp_selected = 0;
|
||||||
if (mode != WILD_EXPAND_FREE && mode != WILD_ALL && mode != WILD_ALL_KEEP)
|
|
||||||
findex = 0;
|
|
||||||
|
|
||||||
if (mode == WILD_FREE) // only release file name
|
if (mode == WILD_FREE) // only release file name
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1006,7 +1002,7 @@ ExpandOne(
|
|||||||
if (mode == WILD_LONGEST && xp->xp_numfiles > 0)
|
if (mode == WILD_LONGEST && xp->xp_numfiles > 0)
|
||||||
{
|
{
|
||||||
ss = find_longest_match(xp, options);
|
ss = find_longest_match(xp, options);
|
||||||
findex = -1; // next p_wc gets first one
|
xp->xp_selected = -1; // next p_wc gets first one
|
||||||
}
|
}
|
||||||
|
|
||||||
// Concatenate all matching names. Unless interrupted, this can be slow
|
// Concatenate all matching names. Unless interrupted, this can be slow
|
||||||
|
@ -609,6 +609,7 @@ typedef struct expand
|
|||||||
int xp_numfiles; // number of files found by
|
int xp_numfiles; // number of files found by
|
||||||
// file name completion
|
// file name completion
|
||||||
int xp_col; // cursor position in line
|
int xp_col; // cursor position in line
|
||||||
|
int xp_selected; // selected index in completion
|
||||||
char_u **xp_files; // list of files
|
char_u **xp_files; // list of files
|
||||||
char_u *xp_line; // text being completed
|
char_u *xp_line; // text being completed
|
||||||
#define EXPAND_BUF_LEN 256
|
#define EXPAND_BUF_LEN 256
|
||||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1735,
|
||||||
/**/
|
/**/
|
||||||
1734,
|
1734,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user