diff src/cmdexpand.c @ 25994:e8873138ffbb v8.2.3530

patch 8.2.3530: ":buf {a}" fails while ":edit {a}" works Commit: https://github.com/vim/vim/commit/21c1a0c2f10575dbb72fa873d33f0c1f6e170aa7 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 17 17:20:23 2021 +0100 patch 8.2.3530: ":buf \{a}" fails while ":edit \{a}" works Problem: ":buf \{a}" fails while ":edit \{a}" works. Solution: Unescape "\{". (closes https://github.com/vim/vim/issues/8917)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Oct 2021 18:30:04 +0200
parents 47864a0f9055
children 162ef12a3b5f
line wrap: on
line diff
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -48,6 +48,8 @@ ExpandEscape(
 {
     int		i;
     char_u	*p;
+    int		vse_what = xp->xp_context == EXPAND_BUFFERS
+						       ? VSE_BUFFER : VSE_NONE;
 
     // May change home directory back to "~"
     if (options & WILD_HOME_REPLACE)
@@ -84,9 +86,10 @@ ExpandEscape(
 		    }
 		}
 #ifdef BACKSLASH_IN_FILENAME
-		p = vim_strsave_fnameescape(files[i], FALSE);
+		p = vim_strsave_fnameescape(files[i], vse_what);
 #else
-		p = vim_strsave_fnameescape(files[i], xp->xp_shell);
+		p = vim_strsave_fnameescape(files[i],
+					  xp->xp_shell ? VSE_SHELL : vse_what);
 #endif
 		if (p != NULL)
 		{