diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | Src/lex.c | 10 | ||||
-rw-r--r-- | Test/D04parameter.ztst | 6 |
3 files changed, 22 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 492ee37b4..05179c468 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-12-13 Peter Stephenson <pws@csr.com> + + * 28526: Src/lex.c, Test/D04parameter.ztst: zplitting + 'line # with comment' when stripping comments shouldn't generate + a newline at the end (unless there is one). + 2010-12-12 Peter Stephenson <p.w.stephenson@ntlworld.com> * 28510: Doc/Zsh/expn.yo, Src/hist.c, Src/lex.c, Src/subst.c, @@ -13936,5 +13942,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5147 $ +* $Revision: 1.5148 $ ***************************************************** diff --git a/Src/lex.c b/Src/lex.c index 44cfa17ca..20511f54e 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -800,7 +800,15 @@ gettok(void) hwbegin(0); hwaddc('\n'); addtoline('\n'); - peek = NEWLIN; + /* + * If splitting a line and removing comments, + * we don't want a newline token since it's + * treated specially. + */ + if (zleparse == 3 && lexstop) + peek = ENDINPUT; + else + peek = NEWLIN; } } return peek; diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index e2772afe5..8791f570a 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -456,6 +456,12 @@ >another >one + line='with comment # at the end' + print -l ${(z+C+)line} +0:Test we don't get an additional newline token +>with +>comment + psvar=(dog) setopt promptsubst foo='It shouldn'\''t $(happen) to a %1v.' |