diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-05-16 10:27:06 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-05-16 10:27:06 +0000 |
commit | 8e20d1da63d320c599490a222c33543201893b5e (patch) | |
tree | f1210bba2f37155a9f5534bcfe392e418cd0ffcc /Src/Zle | |
parent | 5f8a498d4dec3f6d21dd0c04ee784ae08b6bf656 (diff) | |
download | zsh-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)
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/zle_tricky.c | 30 |
1 files changed, 24 insertions, 6 deletions
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. */ |