]> granicus.if.org Git - vim/commitdiff
patch 9.0.1043: macro has confusing name and is duplicated v9.0.1043
authorzeertzjq <zeertzjq@outlook.com>
Sat, 10 Dec 2022 10:22:29 +0000 (10:22 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 10 Dec 2022 10:22:29 +0000 (10:22 +0000)
Problem:    Macro has confusing name and is duplicated.
Solution:   Use one macro with an understandable name. (closes #11686)

src/cmdexpand.c
src/version.c

index 3e2ecb373882628efa9346f96b068be31a713d90..cc34f296a840a04d3d4fff1de6f2646df5eb6de2 100644 (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;
        }
index 14b6d2868a2c7da56ec6edcf4dcece857ad685c5..0acd21764ff8eaf6ba797a459e853e4eb8cb842f 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1043,
 /**/
     1042,
 /**/