patch 8.2.3079: Powershell core not supported by default
Problem: Powershell core not supported by default.
Solution: Set option defaults for "pwsh". (Mike Williams, closes #8481)
diff --git a/src/misc2.c b/src/misc2.c
index 6bbfbd7..ead1e63 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1414,8 +1414,9 @@
char_u *escaped_string;
int l;
int csh_like;
-# ifdef MSWIN
+ char_u *shname;
int powershell;
+# ifdef MSWIN
int double_quotes;
# endif
@@ -1425,9 +1426,12 @@
// Csh also needs to have "\n" escaped twice when do_special is set.
csh_like = csh_like_shell();
+ // PowerShell uses it's own version for quoting single quotes
+ shname = gettail(p_sh);
+ powershell = strstr((char *)shname, "pwsh") != NULL;
# ifdef MSWIN
- // PowerShell only accepts single quotes so override p_ssl.
- powershell = strstr((char *)gettail(p_sh), "powershell") != NULL;
+ powershell = powershell || strstr((char *)shname, "powershell") != NULL;
+ // PowerShell only accepts single quotes so override shellslash.
double_quotes = !powershell && !p_ssl;
# endif
@@ -1445,11 +1449,9 @@
# endif
if (*p == '\'')
{
-# ifdef MSWIN
if (powershell)
length +=2; // ' => ''
else
-# endif
length += 3; // ' => '\''
}
if ((*p == '\n' && (csh_like || do_newline))
@@ -1497,14 +1499,12 @@
# endif
if (*p == '\'')
{
-# ifdef MSWIN
if (powershell)
{
*d++ = '\'';
*d++ = '\'';
}
else
-# endif
{
*d++ = '\'';
*d++ = '\\';