about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Core/_expand8
-rw-r--r--Src/utils.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 9f083338e..df9e0b9ea 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -77,6 +77,10 @@ else
   expl2=(-n)
 fi
 
+# Quote the results and remove unnecessary quotes before `='s.
+
+    exp=( "${(@)${(@)${(@q)exp}//\\\\=/=}/#=/\\=}" )
+
 # We have expansions, should we menucomplete them?
 
 if [[ -z "$compconfig[expand_menu]" ]]; then
@@ -112,7 +116,7 @@ else
      "$compconfig[expand_original]" != *last* ]] &&
       compadd "$expl[@]" -UQ -V _expand_original - "$word"
 
-  [[ "$compconfig[expand_menu]" = *last* &&
+  [[ $#exp -ne 1 && "$compconfig[expand_menu]" = *last* &&
      "$compconfig[expand_menu]" != *only* ]] &&
       compadd "$expl2[@]" -UQ -V _expand_all - "$exp"
 
@@ -122,7 +126,7 @@ else
     compadd -UQ -X "${compconfig[expand_prompt]//\\%o/$word}" \
             $group _expand - "$exp[@]"
   fi
-  [[ "$compconfig[expand_menu]" != *last* &&
+  [[ $#exp -ne 1 && "$compconfig[expand_menu]" != *last* &&
      "$compconfig[expand_menu]" != *only* ]] &&
       compadd "$expl2[@]" -UQ -V _expand_all - "$exp"
 
diff --git a/Src/utils.c b/Src/utils.c
index 9eaae7762..cbcdfc91e 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3073,7 +3073,7 @@ bslashquote(const char *s, char **e, int instring)
 	  }
 	  continue;
 	}
-	else if (ispecial(*u) &&
+	else if (ispecial(*u) && (*u != '=' || u == s) &&
 	    (!instring ||
 	     (isset(BANGHIST) && *u == (char)bangchar) ||
 	     (instring == 2 &&