Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: interactivecomments and preexec



On Mon, 22 Jul 2013 10:53:32 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> On Sun, 21 Jul 2013 13:28:17 -0700
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > Comments are stripped before alias expansion.
> 
> I think you're slightly missing the issue (as I did, until I looked more
> closely): what preexec shows is inconsistent, giving you the unexpanded
> alias first, then a bit of the expanded alias, then the argument.  This
> can't be right.

Not just in preexec, either; if you use up-arrow, you get the extraneous
"#" in the middle of the line.

Try this.  Seems to work here but not extensively tested elsewhere.

diff --git a/Src/lex.c b/Src/lex.c
index ac87e5e..4a9b110 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -778,6 +778,7 @@ gettok(void)
 	    bptr = tokstr = (char *)hcalloc(bsiz = 32);
 	    add(c);
 	}
+	ihwend();
 	while ((c = ingetc()) != '\n' && !lexstop) {
 	    hwaddc(c);
 	    addtoline(c);

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author