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

Re: pws-18: Multiline cut'n'paste - second go.



"Andrej Borsenkow" wrote:
> Now Zsh correctly handles multiline input in *single* command (that is, with
> PS2) - but not, when every line is a separate command.

I understand the problem (tell me I'm wrong, go on), but I don't really see
what can be done about it. The TCSETSW comes from settyinfo(), probably via
tcsetattr(SHTTY, TCSADRAIN, ...), which is equivalent.  When zle is being
used, the terminal has to be set back to it's ordinary mode for ordinary
commands to run, because there's no way it can know what's being run, which
will cause this; the OSes with this problem simply don't seem to allow
`change the terminal modes without screwing up typeahead' --- if we could
find a way of doing that we're home and dry.  With the previous patch, we
delayed changing the modes till the end of parsing for one complete set of
input because nothing got executed in that time, but now we've got a
complete set of input, time's up.

The only half way out I can see would be to remember the terminal setting
and not change it until an external command, or an internal command doing
I/O, is started.  That's a big and bug-prone thing to do, and if the pasted
commands call something external then you're out of luck anyway.  Maybe
someone can think of a way round.

There are workarounds, although you've probably thought of those: type
{<RETURN> before the paste, and }<RETURN> afterwards, then it's all done
inside PS2; or temporarily turning off zle during pasting.  Even that last
can't be automated, because if zle is running when the, er, paste hits the
fan, then you will at some point need to switch the terminal modes for
running the commands.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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