To: vim_dev@googlegroups.com Subject: Patch 9.0.1043 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1043 Problem: Macro has confusing name and is duplicated. Solution: Use one macro with an understandable name. (closes #11686) Files: src/cmdexpand.c *** ../vim-9.0.1042/src/cmdexpand.c 2022-12-08 12:00:32.414054432 +0000 --- src/cmdexpand.c 2022-12-10 10:20:27.353051881 +0000 *************** *** 35,41 **** static int compl_startcol; static int compl_selected; ! #define SHOW_FILE_TEXT(m) (showtail ? showmatches_gettail(matches[m]) : matches[m]) /* * Returns TRUE if fuzzy completion is supported for a given cmdline completion --- 35,41 ---- static int compl_startcol; static int compl_selected; ! #define SHOW_MATCH(m) (showtail ? showmatches_gettail(matches[m]) : matches[m]) /* * Returns TRUE if fuzzy completion is supported for a given cmdline completion *************** *** 339,345 **** 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_info = NULL; compl_match_array[i].pum_extra = NULL; compl_match_array[i].pum_kind = NULL; --- 339,345 ---- compl_match_array = ALLOC_MULT(pumitem_T, compl_match_arraysize); for (i = 0; i < numMatches; 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,495 **** int match, int showtail) { - #define L_MATCH(m) (showtail ? showmatches_gettail(matches[m]) : matches[m]) int row; char_u *buf; int len; --- 489,494 ---- *************** *** 525,531 **** highlight = FALSE; } // count 1 for the ending ">" ! clen = status_match_len(xp, L_MATCH(match)) + 3; if (match == 0) first_match = 0; else if (match < first_match) --- 524,530 ---- highlight = FALSE; } // count 1 for the ending ">" ! clen = status_match_len(xp, SHOW_MATCH(match)) + 3; if (match == 0) first_match = 0; else if (match < first_match) *************** *** 538,544 **** { // check if match fits on the screen for (i = first_match; i < match; ++i) ! clen += status_match_len(xp, L_MATCH(i)) + 2; if (first_match > 0) clen += 2; // jumping right, put match at the left --- 537,543 ---- { // check if match fits on the screen for (i = first_match; i < match; ++i) ! clen += status_match_len(xp, SHOW_MATCH(i)) + 2; if (first_match > 0) clen += 2; // jumping right, put match at the left *************** *** 549,555 **** clen = 2; for (i = match; i < num_matches; ++i) { ! clen += status_match_len(xp, L_MATCH(i)) + 2; if ((long)clen >= Columns) break; } --- 548,554 ---- clen = 2; for (i = match; i < num_matches; ++i) { ! clen += status_match_len(xp, SHOW_MATCH(i)) + 2; if ((long)clen >= Columns) break; } *************** *** 560,566 **** if (add_left) while (first_match > 0) { ! clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2; if ((long)clen >= Columns) break; --first_match; --- 559,565 ---- if (add_left) while (first_match > 0) { ! clen += status_match_len(xp, SHOW_MATCH(first_match - 1)) + 2; if ((long)clen >= Columns) break; --first_match; *************** *** 581,587 **** clen = len; i = first_match; ! while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) < Columns) { if (i == match) { --- 580,586 ---- clen = len; i = first_match; ! while ((long)(clen + status_match_len(xp, SHOW_MATCH(i)) + 2) < Columns) { if (i == match) { *************** *** 589,595 **** selstart_col = clen; } ! s = L_MATCH(i); // Check for menu separators - replace with '|' #ifdef FEAT_MENU emenu = (xp->xp_context == EXPAND_MENUS --- 588,594 ---- selstart_col = clen; } ! s = SHOW_MATCH(i); // Check for menu separators - replace with '|' #ifdef FEAT_MENU emenu = (xp->xp_context == EXPAND_MENUS *************** *** 1129,1135 **** // Expansion was done here, file names are literal. isdir = mch_isdir(matches[j]); if (showtail) ! p = SHOW_FILE_TEXT(j); else { home_replace(NULL, matches[j], NameBuff, MAXPATHL, --- 1128,1134 ---- // Expansion was done here, file names are literal. isdir = mch_isdir(matches[j]); if (showtail) ! p = SHOW_MATCH(j); else { home_replace(NULL, matches[j], NameBuff, MAXPATHL, *************** *** 1140,1146 **** else { isdir = FALSE; ! p = SHOW_FILE_TEXT(j); } lastlen = msg_outtrans_attr(p, isdir ? dir_attr : 0); } --- 1139,1145 ---- else { isdir = FALSE; ! p = SHOW_MATCH(j); } lastlen = msg_outtrans_attr(p, isdir ? dir_attr : 0); } *************** *** 1219,1225 **** j = vim_strsize(NameBuff); } else ! j = vim_strsize(SHOW_FILE_TEXT(i)); if (j > maxlen) maxlen = j; } --- 1218,1224 ---- j = vim_strsize(NameBuff); } else ! j = vim_strsize(SHOW_MATCH(i)); if (j > maxlen) maxlen = j; } *** ../vim-9.0.1042/src/version.c 2022-12-09 22:49:19.447580421 +0000 --- src/version.c 2022-12-10 10:21:36.733079822 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1043, /**/ -- ARTHUR: Right! Knights! Forward! ARTHUR leads a charge toward the castle. Various shots of them battling on, despite being hit by a variety of farm animals. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///