mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1043: macro has confusing name and is duplicated (#21801)
Problem: Macro has confusing name and is duplicated.
Solution: Use one macro with an understandable name. (closes vim/vim#11686)
c51a376265
This commit is contained in:
parent
7af2c52ef0
commit
f445096cc6
@ -89,9 +89,7 @@ static int compl_match_arraysize;
|
|||||||
static int compl_startcol;
|
static int compl_startcol;
|
||||||
static int compl_selected;
|
static int compl_selected;
|
||||||
|
|
||||||
#define SHOW_FILE_TEXT(m) (showtail \
|
#define SHOW_MATCH(m) (showtail ? showmatches_gettail(matches[m], false) : matches[m])
|
||||||
? showmatches_gettail(matches[m], false) \
|
|
||||||
: matches[m])
|
|
||||||
|
|
||||||
/// Sort function for the completion matches.
|
/// Sort function for the completion matches.
|
||||||
/// <SNR> functions should be sorted to the end.
|
/// <SNR> functions should be sorted to the end.
|
||||||
@ -296,7 +294,7 @@ static int cmdline_pum_create(CmdlineInfo *ccline, expand_T *xp, char **matches,
|
|||||||
compl_match_array = xmalloc(sizeof(pumitem_T) * (size_t)compl_match_arraysize);
|
compl_match_array = xmalloc(sizeof(pumitem_T) * (size_t)compl_match_arraysize);
|
||||||
for (int i = 0; i < numMatches; i++) {
|
for (int i = 0; i < numMatches; i++) {
|
||||||
compl_match_array[i] = (pumitem_T){
|
compl_match_array[i] = (pumitem_T){
|
||||||
.pum_text = SHOW_FILE_TEXT(i),
|
.pum_text = SHOW_MATCH(i),
|
||||||
.pum_info = NULL,
|
.pum_info = NULL,
|
||||||
.pum_extra = NULL,
|
.pum_extra = NULL,
|
||||||
.pum_kind = NULL,
|
.pum_kind = NULL,
|
||||||
@ -397,7 +395,6 @@ static int wildmenu_match_len(expand_T *xp, char *s)
|
|||||||
/// @param matches list of matches
|
/// @param matches list of matches
|
||||||
static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int match, int showtail)
|
static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int match, int showtail)
|
||||||
{
|
{
|
||||||
#define L_MATCH(m) (showtail ? showmatches_gettail(matches[m], false) : matches[m])
|
|
||||||
int row;
|
int row;
|
||||||
char *buf;
|
char *buf;
|
||||||
int len;
|
int len;
|
||||||
@ -426,7 +423,7 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
|
|||||||
highlight = false;
|
highlight = false;
|
||||||
}
|
}
|
||||||
// count 1 for the ending ">"
|
// count 1 for the ending ">"
|
||||||
clen = wildmenu_match_len(xp, L_MATCH(match)) + 3;
|
clen = wildmenu_match_len(xp, SHOW_MATCH(match)) + 3;
|
||||||
if (match == 0) {
|
if (match == 0) {
|
||||||
first_match = 0;
|
first_match = 0;
|
||||||
} else if (match < first_match) {
|
} else if (match < first_match) {
|
||||||
@ -436,7 +433,7 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
|
|||||||
} else {
|
} else {
|
||||||
// check if match fits on the screen
|
// check if match fits on the screen
|
||||||
for (i = first_match; i < match; i++) {
|
for (i = first_match; i < match; i++) {
|
||||||
clen += wildmenu_match_len(xp, L_MATCH(i)) + 2;
|
clen += wildmenu_match_len(xp, SHOW_MATCH(i)) + 2;
|
||||||
}
|
}
|
||||||
if (first_match > 0) {
|
if (first_match > 0) {
|
||||||
clen += 2;
|
clen += 2;
|
||||||
@ -447,7 +444,7 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
|
|||||||
// if showing the last match, we can add some on the left
|
// if showing the last match, we can add some on the left
|
||||||
clen = 2;
|
clen = 2;
|
||||||
for (i = match; i < num_matches; i++) {
|
for (i = match; i < num_matches; i++) {
|
||||||
clen += wildmenu_match_len(xp, L_MATCH(i)) + 2;
|
clen += wildmenu_match_len(xp, SHOW_MATCH(i)) + 2;
|
||||||
if ((long)clen >= Columns) {
|
if ((long)clen >= Columns) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -459,7 +456,7 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
|
|||||||
}
|
}
|
||||||
if (add_left) {
|
if (add_left) {
|
||||||
while (first_match > 0) {
|
while (first_match > 0) {
|
||||||
clen += wildmenu_match_len(xp, L_MATCH(first_match - 1)) + 2;
|
clen += wildmenu_match_len(xp, SHOW_MATCH(first_match - 1)) + 2;
|
||||||
if ((long)clen >= Columns) {
|
if ((long)clen >= Columns) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -479,13 +476,13 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
|
|||||||
clen = len;
|
clen = len;
|
||||||
|
|
||||||
i = first_match;
|
i = first_match;
|
||||||
while (clen + wildmenu_match_len(xp, L_MATCH(i)) + 2 < Columns) {
|
while (clen + wildmenu_match_len(xp, SHOW_MATCH(i)) + 2 < Columns) {
|
||||||
if (i == match) {
|
if (i == match) {
|
||||||
selstart = buf + len;
|
selstart = buf + len;
|
||||||
selstart_col = clen;
|
selstart_col = clen;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = L_MATCH(i);
|
s = SHOW_MATCH(i);
|
||||||
// Check for menu separators - replace with '|'
|
// Check for menu separators - replace with '|'
|
||||||
emenu = (xp->xp_context == EXPAND_MENUS
|
emenu = (xp->xp_context == EXPAND_MENUS
|
||||||
|| xp->xp_context == EXPAND_MENUNAMES);
|
|| xp->xp_context == EXPAND_MENUNAMES);
|
||||||
@ -910,14 +907,14 @@ static void showmatches_oneline(expand_T *xp, char **matches, int numMatches, in
|
|||||||
isdir = os_isdir(matches[j]);
|
isdir = os_isdir(matches[j]);
|
||||||
}
|
}
|
||||||
if (showtail) {
|
if (showtail) {
|
||||||
p = SHOW_FILE_TEXT(j);
|
p = SHOW_MATCH(j);
|
||||||
} else {
|
} else {
|
||||||
home_replace(NULL, matches[j], NameBuff, MAXPATHL, true);
|
home_replace(NULL, matches[j], NameBuff, MAXPATHL, true);
|
||||||
p = NameBuff;
|
p = NameBuff;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isdir = false;
|
isdir = false;
|
||||||
p = SHOW_FILE_TEXT(j);
|
p = SHOW_MATCH(j);
|
||||||
}
|
}
|
||||||
lastlen = msg_outtrans_attr(p, isdir ? dir_attr : 0);
|
lastlen = msg_outtrans_attr(p, isdir ? dir_attr : 0);
|
||||||
}
|
}
|
||||||
@ -990,7 +987,7 @@ int showmatches(expand_T *xp, int wildmenu)
|
|||||||
home_replace(NULL, matches[i], NameBuff, MAXPATHL, true);
|
home_replace(NULL, matches[i], NameBuff, MAXPATHL, true);
|
||||||
j = vim_strsize(NameBuff);
|
j = vim_strsize(NameBuff);
|
||||||
} else {
|
} else {
|
||||||
j = vim_strsize(SHOW_FILE_TEXT(i));
|
j = vim_strsize(SHOW_MATCH(i));
|
||||||
}
|
}
|
||||||
if (j > maxlen) {
|
if (j > maxlen) {
|
||||||
maxlen = j;
|
maxlen = j;
|
||||||
|
Loading…
Reference in New Issue
Block a user