mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-06-14 08:08:10 +02:00
34781: add implicit space after alias expansion of tokens that form words without spacing
fixes crash when using completion immediately following such an alias
This commit is contained in:
parent
7d2b53f65b
commit
81ba837972
3 changed files with 15 additions and 1 deletions
|
@ -3,6 +3,10 @@
|
|||
* 34804: Src/lex.c: refine 34734 POSIX_ALIAS change to preserve
|
||||
old behavior of [[ ]] conditionals
|
||||
|
||||
* 34781: Src/lex.c, Test/A02alias.ztst: add implicit space after
|
||||
alias expansion of tokens that form words without spacing; fixes
|
||||
crash when using completion immediately following such an alias
|
||||
|
||||
2015-03-27 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 34788: Src/lex.c: refine errflag handling in cmd_or_math()
|
||||
|
|
10
Src/lex.c
10
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;
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
fc -l -2' 2>/dev/null
|
||||
0:Aliasing reserved tokens
|
||||
>begin
|
||||
>zsh: command not found: echoend
|
||||
>end
|
||||
*>*4*{ begin
|
||||
*>*5*{end
|
||||
|
||||
|
|
Loading…
Reference in a new issue