0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.0159: completion for user names does not work for a prefix.

Problem:    Completion for user names does not work if a prefix is also a full
            matching name. (Nazri Ramliy)
Solution:   Accept both full and partial matches. (Dominique Pelle)
This commit is contained in:
Bram Moolenaar 2018-07-07 16:41:13 +02:00
parent 1ebff3dc93
commit 6c5d104302
3 changed files with 5 additions and 2 deletions

View File

@ -3764,7 +3764,7 @@ set_one_cmd_context(
* A full match ~user<Tab> will be replaced by user's home * A full match ~user<Tab> will be replaced by user's home
* directory i.e. something like ~user<Tab> -> /home/user/ */ * directory i.e. something like ~user<Tab> -> /home/user/ */
if (*p == NUL && p > xp->xp_pattern + 1 if (*p == NUL && p > xp->xp_pattern + 1
&& match_user(xp->xp_pattern + 1) == 1) && match_user(xp->xp_pattern + 1) >= 1)
{ {
xp->xp_context = EXPAND_USER; xp->xp_context = EXPAND_USER;
++xp->xp_pattern; ++xp->xp_pattern;

View File

@ -4827,7 +4827,8 @@ get_users(expand_T *xp UNUSED, int idx)
* 1 if name partially matches the beginning of a user name. * 1 if name partially matches the beginning of a user name.
* 2 is name fully matches a user name. * 2 is name fully matches a user name.
*/ */
int match_user(char_u* name) int
match_user(char_u *name)
{ {
int i; int i;
int n = (int)STRLEN(name); int n = (int)STRLEN(name);

View File

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