1
0
forked from aniani/vim

patch 9.0.1043: macro has confusing name and is duplicated

Problem:    Macro has confusing name and is duplicated.
Solution:   Use one macro with an understandable name. (closes #11686)
This commit is contained in:
zeertzjq 2022-12-10 10:22:29 +00:00 committed by Bram Moolenaar
parent 4ae0057308
commit c51a376265
2 changed files with 13 additions and 12 deletions

View File

@ -35,7 +35,7 @@ static int compl_match_arraysize;
static int compl_startcol;
static int compl_selected;
#define SHOW_FILE_TEXT(m) (showtail ? showmatches_gettail(matches[m]) : matches[m])
#define SHOW_MATCH(m) (showtail ? showmatches_gettail(matches[m]) : matches[m])
/*
* Returns TRUE if fuzzy completion is supported for a given cmdline completion
@ -339,7 +339,7 @@ cmdline_pum_create(
compl_match_array = ALLOC_MULT(pumitem_T, compl_match_arraysize);
for (i = 0; i < numMatches; i++)
{
compl_match_array[i].pum_text = SHOW_FILE_TEXT(i);
compl_match_array[i].pum_text = SHOW_MATCH(i);
compl_match_array[i].pum_info = NULL;
compl_match_array[i].pum_extra = NULL;
compl_match_array[i].pum_kind = NULL;
@ -489,7 +489,6 @@ win_redr_status_matches(
int match,
int showtail)
{
#define L_MATCH(m) (showtail ? showmatches_gettail(matches[m]) : matches[m])
int row;
char_u *buf;
int len;
@ -525,7 +524,7 @@ win_redr_status_matches(
highlight = FALSE;
}
// count 1 for the ending ">"
clen = status_match_len(xp, L_MATCH(match)) + 3;
clen = status_match_len(xp, SHOW_MATCH(match)) + 3;
if (match == 0)
first_match = 0;
else if (match < first_match)
@ -538,7 +537,7 @@ win_redr_status_matches(
{
// check if match fits on the screen
for (i = first_match; i < match; ++i)
clen += status_match_len(xp, L_MATCH(i)) + 2;
clen += status_match_len(xp, SHOW_MATCH(i)) + 2;
if (first_match > 0)
clen += 2;
// jumping right, put match at the left
@ -549,7 +548,7 @@ win_redr_status_matches(
clen = 2;
for (i = match; i < num_matches; ++i)
{
clen += status_match_len(xp, L_MATCH(i)) + 2;
clen += status_match_len(xp, SHOW_MATCH(i)) + 2;
if ((long)clen >= Columns)
break;
}
@ -560,7 +559,7 @@ win_redr_status_matches(
if (add_left)
while (first_match > 0)
{
clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2;
clen += status_match_len(xp, SHOW_MATCH(first_match - 1)) + 2;
if ((long)clen >= Columns)
break;
--first_match;
@ -581,7 +580,7 @@ win_redr_status_matches(
clen = len;
i = first_match;
while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) < Columns)
while ((long)(clen + status_match_len(xp, SHOW_MATCH(i)) + 2) < Columns)
{
if (i == match)
{
@ -589,7 +588,7 @@ win_redr_status_matches(
selstart_col = clen;
}
s = L_MATCH(i);
s = SHOW_MATCH(i);
// Check for menu separators - replace with '|'
#ifdef FEAT_MENU
emenu = (xp->xp_context == EXPAND_MENUS
@ -1129,7 +1128,7 @@ showmatches_oneline(
// Expansion was done here, file names are literal.
isdir = mch_isdir(matches[j]);
if (showtail)
p = SHOW_FILE_TEXT(j);
p = SHOW_MATCH(j);
else
{
home_replace(NULL, matches[j], NameBuff, MAXPATHL,
@ -1140,7 +1139,7 @@ showmatches_oneline(
else
{
isdir = FALSE;
p = SHOW_FILE_TEXT(j);
p = SHOW_MATCH(j);
}
lastlen = msg_outtrans_attr(p, isdir ? dir_attr : 0);
}
@ -1219,7 +1218,7 @@ showmatches(expand_T *xp, int wildmenu UNUSED)
j = vim_strsize(NameBuff);
}
else
j = vim_strsize(SHOW_FILE_TEXT(i));
j = vim_strsize(SHOW_MATCH(i));
if (j > maxlen)
maxlen = j;
}

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1043,
/**/
1042,
/**/