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

Re: PATCH: 3.1.4: flushing input properly

"Bart Schaefer" wrote:
> This looks good.  Just one question ... why does discard_input() clear
> and then set errflag, and why doesn't herrflush() need to do the same?

I was careful to put herrflush() before calls to zerr() etc., and the
history mechanism shouldn't be active with errflag already set.  If
the code as written doesn't work, I'd rather know where and why
errflag was unexpectedly being set beforehand rather than blindly
unsetting it.  (Note it only affects adding the rest of the buffer onto
the history line; the input mechanism will happily return characters
already stored with errflag set, it just won't input a new line.)  As
for setting it after, you will see that every call to herrflush() is
followed immediately by a  call to an error function, whose task it
properly is.

As for why discard_input() did it... first of all, the existing code
didn't always call the error function after rather than before, and
secondly discard_input() was a bit out of place in parse.c rather than
hist.c so its interaction with the history code was a bit murkier.  I
think it was just one those bits that never got tidied up properly
till now.  (The other complexities in discard_input() were what were
dividing up the history line in a strange way, so I think they're well
out of it.)

Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy

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