about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-03-28 21:24:27 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-03-28 21:24:27 -0700
commit81ba83797240f38769a624a98c1e73ba2f9f9906 (patch)
tree128a30193daaeeef6a29b34ef4b5de37cce84ef4 /Src
parent7d2b53f65bae3f16cf318103e53eb8350af6bd8a (diff)
downloadzsh-81ba83797240f38769a624a98c1e73ba2f9f9906.tar.gz
zsh-81ba83797240f38769a624a98c1e73ba2f9f9906.tar.xz
zsh-81ba83797240f38769a624a98c1e73ba2f9f9906.zip
34781: add implicit space after alias expansion of tokens that form words without spacing
fixes crash when using completion immediately following such an alias
Diffstat (limited to 'Src')
-rw-r--r--Src/lex.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 2e611707e..5fed2be49 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1747,6 +1747,16 @@ checkalias(void)
 	if (an && !an->inuse &&
 	    ((an->node.flags & ALIAS_GLOBAL) ||
 	     (incmdpos && tok == STRING) || inalmore)) {
+	    if (!lexstop) {
+		/*
+		 * Tokens that don't require a space after, get one,
+		 * because they are treated as if preceded by one.
+		 */
+		int c = hgetc();
+		hungetc(c);
+		if (!iblank(c))
+		    inpush(" ", INP_ALIAS, 0);
+	    }
 	    inpush(an->text, INP_ALIAS, an);
 	    if (an->text[0] == ' ' && !(an->node.flags & ALIAS_GLOBAL))
 		aliasspaceflag = 1;