diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-24 14:44:28 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-24 14:44:28 +0000 |
commit | 6785dcb5c920b6be812b4d1a70ce53ed47ff2f30 (patch) | |
tree | 332ee00c91dbd07c7982465fb61dd6dbebe95cc5 /Src/Zle/compresult.c | |
parent | 01ffe47e012deb204dc74a3fff794f8b4a3ec795 (diff) | |
download | zsh-6785dcb5c920b6be812b4d1a70ce53ed47ff2f30.tar.gz zsh-6785dcb5c920b6be812b4d1a70ce53ed47ff2f30.tar.xz zsh-6785dcb5c920b6be812b4d1a70ce53ed47ff2f30.zip |
zsh-workers/9865
Diffstat (limited to 'Src/Zle/compresult.c')
-rw-r--r-- | Src/Zle/compresult.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index e5d0617ef..64de5c744 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -610,6 +610,7 @@ do_ambiguous(void) do_ambig_menu(); } else if (ainfo) { int atend = (cs == we), la, eq, tcs; + VARARR(char, old, we - wb); minfo.cur = NULL; minfo.asked = 0; @@ -617,11 +618,25 @@ do_ambiguous(void) fixsuffix(); /* First remove the old string from the line. */ + tcs = cs; cs = wb; + memcpy(old, (char *) line + wb, we - wb); foredel(we - wb); /* Now get the unambiguous string and insert it into the line. */ cline_str(ainfo->line, 1, NULL); + + /* Sometimes the different match specs used may result in a cline + * that is shorter than the original string. If that happened, we + * re-insert the old string. Unless there were matches added with + * -U, that is. */ + if (lastend - wb < we - wb && !hasunmatched) { + cs = wb; + foredel(lastend - wb); + inststrlen(old, 0, we - wb); + lastend = we; + cs = tcs; + } if (eparq) { tcs = cs; cs = lastend; |