Skip to content

Commit c51a376

Browse files
zeertzjqbrammool
authored andcommitted
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)
1 parent 4ae0057 commit c51a376

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

src/cmdexpand.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static int compl_match_arraysize;
3535
static int compl_startcol;
3636
static int compl_selected;
3737

38-
#define SHOW_FILE_TEXT(m) (showtail ? showmatches_gettail(matches[m]) : matches[m])
38+
#define SHOW_MATCH(m) (showtail ? showmatches_gettail(matches[m]) : matches[m])
3939

4040
/*
4141
* Returns TRUE if fuzzy completion is supported for a given cmdline completion
@@ -339,7 +339,7 @@ cmdline_pum_create(
339339
compl_match_array = ALLOC_MULT(pumitem_T, compl_match_arraysize);
340340
for (i = 0; i < numMatches; i++)
341341
{
342-
compl_match_array[i].pum_text = SHOW_FILE_TEXT(i);
342+
compl_match_array[i].pum_text = SHOW_MATCH(i);
343343
compl_match_array[i].pum_info = NULL;
344344
compl_match_array[i].pum_extra = NULL;
345345
compl_match_array[i].pum_kind = NULL;
@@ -489,7 +489,6 @@ win_redr_status_matches(
489489
int match,
490490
int showtail)
491491
{
492-
#define L_MATCH(m) (showtail ? showmatches_gettail(matches[m]) : matches[m])
493492
int row;
494493
char_u *buf;
495494
int len;
@@ -525,7 +524,7 @@ win_redr_status_matches(
525524
highlight = FALSE;
526525
}
527526
// count 1 for the ending ">"
528-
clen = status_match_len(xp, L_MATCH(match)) + 3;
527+
clen = status_match_len(xp, SHOW_MATCH(match)) + 3;
529528
if (match == 0)
530529
first_match = 0;
531530
else if (match < first_match)
@@ -538,7 +537,7 @@ win_redr_status_matches(
538537
{
539538
// check if match fits on the screen
540539
for (i = first_match; i < match; ++i)
541-
clen += status_match_len(xp, L_MATCH(i)) + 2;
540+
clen += status_match_len(xp, SHOW_MATCH(i)) + 2;
542541
if (first_match > 0)
543542
clen += 2;
544543
// jumping right, put match at the left
@@ -549,7 +548,7 @@ win_redr_status_matches(
549548
clen = 2;
550549
for (i = match; i < num_matches; ++i)
551550
{
552-
clen += status_match_len(xp, L_MATCH(i)) + 2;
551+
clen += status_match_len(xp, SHOW_MATCH(i)) + 2;
553552
if ((long)clen >= Columns)
554553
break;
555554
}
@@ -560,7 +559,7 @@ win_redr_status_matches(
560559
if (add_left)
561560
while (first_match > 0)
562561
{
563-
clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2;
562+
clen += status_match_len(xp, SHOW_MATCH(first_match - 1)) + 2;
564563
if ((long)clen >= Columns)
565564
break;
566565
--first_match;
@@ -581,15 +580,15 @@ win_redr_status_matches(
581580
clen = len;
582581

583582
i = first_match;
584-
while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) < Columns)
583+
while ((long)(clen + status_match_len(xp, SHOW_MATCH(i)) + 2) < Columns)
585584
{
586585
if (i == match)
587586
{
588587
selstart = buf + len;
589588
selstart_col = clen;
590589
}
591590

592-
s = L_MATCH(i);
591+
s = SHOW_MATCH(i);
593592
// Check for menu separators - replace with '|'
594593
#ifdef FEAT_MENU
595594
emenu = (xp->xp_context == EXPAND_MENUS
@@ -1129,7 +1128,7 @@ showmatches_oneline(
11291128
// Expansion was done here, file names are literal.
11301129
isdir = mch_isdir(matches[j]);
11311130
if (showtail)
1132-
p = SHOW_FILE_TEXT(j);
1131+
p = SHOW_MATCH(j);
11331132
else
11341133
{
11351134
home_replace(NULL, matches[j], NameBuff, MAXPATHL,
@@ -1140,7 +1139,7 @@ showmatches_oneline(
11401139
else
11411140
{
11421141
isdir = FALSE;
1143-
p = SHOW_FILE_TEXT(j);
1142+
p = SHOW_MATCH(j);
11441143
}
11451144
lastlen = msg_outtrans_attr(p, isdir ? dir_attr : 0);
11461145
}
@@ -1219,7 +1218,7 @@ showmatches(expand_T *xp, int wildmenu UNUSED)
12191218
j = vim_strsize(NameBuff);
12201219
}
12211220
else
1222-
j = vim_strsize(SHOW_FILE_TEXT(i));
1221+
j = vim_strsize(SHOW_MATCH(i));
12231222
if (j > maxlen)
12241223
maxlen = j;
12251224
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1043,
698700
/**/
699701
1042,
700702
/**/

0 commit comments

Comments
 (0)