patch 9.1.0654: completion does not respect completeslash with fuzzy

Problem:  completion does not respect completeslash with fuzzy
          (egesip)
Solution: Change path separator on Windows, depending on 'completeslash'
          option value (glepnir)

fixes: #15392
closes: #15418

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/insexpand.c b/src/insexpand.c
index 3a16884..9a8d0fa 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -3552,9 +3552,34 @@
     size_t	path_with_wildcard_len;
     char_u	*path_with_wildcard;
 
+#ifdef BACKSLASH_IN_FILENAME
+    char pathsep = (curbuf->b_p_csl[0] == 's') ?
+	'/' : (curbuf->b_p_csl[0] == 'b') ? '\\' : PATHSEP;
+#else
+    char pathsep = PATHSEP;
+#endif
+
     if (in_fuzzy)
     {
-	last_sep = vim_strrchr(leader, PATHSEP);
+#ifdef BACKSLASH_IN_FILENAME
+	if (curbuf->b_p_csl[0] == 's')
+	{
+	    for (i = 0; i < leader_len; i++)
+	    {
+		if (leader[i] == '\\')
+		    leader[i] = '/';
+	    }
+	}
+	else if (curbuf->b_p_csl[0] == 'b')
+	{
+	    for (i = 0; i < leader_len; i++)
+	    {
+		if (leader[i] == '/')
+		    leader[i] = '\\';
+	    }
+	}
+#endif
+	last_sep = vim_strrchr(leader, pathsep);
 	if (last_sep == NULL)
 	{
 	    // No path separator or separator is the last character,