diff src/insexpand.c @ 17543:77c3f6428b6c v8.1.1769

patch 8.1.1769: 'shellslash' is also used for completion commit https://github.com/vim/vim/commit/ac3150d385e6e3f3fe76642aac3cda954d30583f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 28 16:36:39 2019 +0200 patch 8.1.1769: 'shellslash' is also used for completion Problem: 'shellslash' is also used for completion. Solution: Add the 'completeslash' option. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/3612)
author Bram Moolenaar <Bram@vim.org>
date Sun, 28 Jul 2019 16:45:05 +0200
parents ce04ebdf26b8
children 73a93aae5f68
line wrap: on
line diff
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -2669,6 +2669,26 @@ ins_compl_get_exp(pos_T *ini)
 
 		// May change home directory back to "~".
 		tilde_replace(compl_pattern, num_matches, matches);
+#ifdef BACKSLASH_IN_FILENAME
+		if (curbuf->b_p_csl[0] != NUL)
+		{
+		    int	    i;
+
+		    for (i = 0; i < num_matches; ++i)
+		    {
+			char_u	*ptr = matches[i];
+
+			while (*ptr != NUL)
+			{
+			    if (curbuf->b_p_csl[0] == 's' && *ptr == '\\')
+				*ptr = '/';
+			    else if (curbuf->b_p_csl[0] == 'b' && *ptr == '/')
+				*ptr = '\\';
+			    ptr += (*mb_ptr2len)(ptr);
+			}
+		    }
+		}
+#endif
 		ins_compl_add_matches(num_matches, matches, p_fic || p_wic);
 	    }
 	    break;