From 209ec90b9b9bd948d76511c9cd2b17f47a97afe6 Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Tue, 17 Oct 2023 10:56:25 +0200 Subject: patch 9.0.2037: A few remaining cmdline completion issues with C-E/Y Problem: A few remaining cmdline completion issues with C-E/Y Solution: Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not used at the end Fix cmdline completion fuzzy/Ctrl-E/Ctrl-Y/options when not used at the end A few places in the cmdline completion code only works properly when the user hits Tab (or 'wildchar') at the end of the cmdline, even though it's supposed to work even in the middle of the line. For fuzzy search, `:e ++ff`, and `:set hl=`, fix completion code to make sure to use `xp_pattern_len` instead of assuming the entire `xp_pattern` is the search pattern (since it contains texts after the cursor). Fix Ctrl-E / Ctrl-Y to not jump to the end when canceling/accepting a wildmenu completion. Also, make them work even when not using `set wildoptions+=pum` as there is no drawback to doing so. (Related issue where this was brought up: #13331) closes: #13362 Signed-off-by: Christian Brabandt Co-authored-by: Yee Cheng Chin --- src/cmdexpand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmdexpand.c') diff --git a/src/cmdexpand.c b/src/cmdexpand.c index d27e039443..8bccaa3bb0 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -260,7 +260,7 @@ nextwild( { if (cmdline_fuzzy_completion_supported(xp)) // If fuzzy matching, don't modify the search string - p1 = vim_strsave(xp->xp_pattern); + p1 = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len); else p1 = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); -- cgit v1.2.3