summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-16 10:27:06 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-16 10:27:06 +0000
commit8e20d1da63d320c599490a222c33543201893b5e (patch)
treef1210bba2f37155a9f5534bcfe392e418cd0ffcc
parent5f8a498d4dec3f6d21dd0c04ee784ae08b6bf656 (diff)
downloadzsh-8e20d1da63d320c599490a222c33543201893b5e.tar.gz
zsh-8e20d1da63d320c599490a222c33543201893b5e.tar.xz
zsh-8e20d1da63d320c599490a222c33543201893b5e.zip
more fixage for expansion: just convert the command line to the original when expansion shouldn't or couldn't do something sensible on the line (14359)
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/zle_tricky.c30
2 files changed, 30 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 29f829c30..6cf32b473 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-05-16  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 14359: Src/Zle/zle_tricky.c: more fixage for expansion: just
+	convert the command line to the original when expansion
+	shouldn't or couldn't do something sensible on the line
+
 2001-05-15  Wayne Davison  <wayned@users.sourceforge.net>
 
 	* 14357: Src/hashtable.c, Src/hist.c, Src/zsh.h, Doc/Zsh/options.yo:
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index afd9c409a..f2e6524ee 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -783,8 +783,20 @@ docomplete(int lst)
 			}
 		}
 		ret = docompletion(s, lst, lincmd);
-	    } else if (ret)
-		clearlist = 1;
+            } else {
+                if (ret)
+                    clearlist = 1;
+                if (!strcmp(ol, (char *)line)) {
+                    /* We may have removed some quotes. For completion, other
+                     * parts of the code re-install them, but for expansion
+                     * we have to do it here. */
+                    cs = 0;
+                    foredel(ll);
+                    spaceinline(origll);
+                    memcpy(line, origline, origll);
+                    cs = origcs;
+                }
+            }
 	} else
 	    /* Just do completion. */
 	    ret = docompletion(s, lst, lincmd);
@@ -1348,7 +1360,7 @@ get_comp_string(void)
                 *p = '\'';
             else if (level && *p == Dnull)
                 *p = '"';
-            else if (*p == String && p[1] == Inbrace)
+            else if ((*p == String || *p == Qstring) && p[1] == Inbrace)
                 level++;
             else if (*p == Outbrace)
                 level--;
@@ -1722,9 +1734,15 @@ doexpansion(char *s, int lst, int olst, int explincmd)
 	goto end;
     }
     if (lst == COMP_LIST_EXPAND) {
-	/* Only the list of expansions was requested. */
-	ret = listlist(vl);
-	showinglist = 0;
+	/* Only the list of expansions was requested. Restore the 
+         * command line. */
+        cs = 0;
+        foredel(ll);
+        spaceinline(origll);
+        memcpy(line, origline, origll);
+        cs = origcs;
+        ret = listlist(vl);
+        showinglist = 0;
 	goto end;
     }
     /* Remove the current word and put the expansions there. */