From fa1baa9a47cdb3eed17d48b6011a164d4009d2ee Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 7 May 2023 08:00:08 +0800 Subject: vim-patch:9.0.1520: completion for option name includes all bool options (#23518) Problem: Completion for option name includes all bool options. Solution: Do not recognize the "noinv" prefix. Prefix "no" or "inv" when appropriate. https://github.com/vim/vim/commit/048d9d25214049dfde04c468c14bd1708fb692b8 Co-authored-by: Bram Moolenaar --- src/nvim/cmdexpand.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/nvim/cmdexpand.c') diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 5f135ff7b0..bf0944a81d 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -897,12 +897,27 @@ char *ExpandOne(expand_T *xp, char *str, char *orig, int options, int mode) if (mode == WILD_ALL && xp->xp_numfiles > 0 && !got_int) { size_t len = 0; for (int i = 0; i < xp->xp_numfiles; i++) { + if (i > 0) { + if (xp->xp_prefix == XP_PREFIX_NO) { + len += 2; // prefix "no" + } else if (xp->xp_prefix == XP_PREFIX_INV) { + len += 3; // prefix "inv" + } + } len += strlen(xp->xp_files[i]) + 1; } ss = xmalloc(len); *ss = NUL; for (int i = 0; i < xp->xp_numfiles; i++) { + if (i > 0) { + if (xp->xp_prefix == XP_PREFIX_NO) { + STRCAT(ss, "no"); + } else if (xp->xp_prefix == XP_PREFIX_INV) { + STRCAT(ss, "inv"); + } + } STRCAT(ss, xp->xp_files[i]); + if (i != xp->xp_numfiles - 1) { STRCAT(ss, (options & WILD_USE_NL) ? "\n" : " "); } @@ -927,6 +942,7 @@ void ExpandInit(expand_T *xp) { CLEAR_POINTER(xp); xp->xp_backslash = XP_BS_NONE; + xp->xp_prefix = XP_PREFIX_NONE; xp->xp_numfiles = -1; } -- cgit