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 <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
diff --git a/src/optionstr.c b/src/optionstr.c
index 8458f2a..b7cdcc4 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -2582,12 +2582,13 @@
     if (*matches == NULL)
 	return FAIL;
 
-    size_t pattern_len = STRLEN(xp->xp_pattern);
+    int pattern_len = xp->xp_pattern_len;
 
     for (i = 0; i < num_hl_modes; i++)
     {
 	// Don't allow duplicates as these are unique flags
-	if (vim_strchr(xp->xp_pattern + 1, p_hl_mode_values[i]) != NULL)
+	char_u *dup = vim_strchr(xp->xp_pattern + 1, p_hl_mode_values[i]);
+	if (dup != NULL && (int)(dup - xp->xp_pattern) < pattern_len)
 	    continue;
 
 	// ':' only works by itself, not with other flags.