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

Re: read -s doesn't work with -t?



(I've moved this to zsh-workers since this is involved enough
even for developers.)

On Sat, 16 Feb 2008 09:37:53 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> It also seems to me that canonical input mode should be set and the
> prompt should be printed before the read-timeout poll is done, so -d
> should come before -t as well.  However, I'm not really sure what's
> going on with shttyinfo versus saveti, so I'm not going to commit the
> following until somebody else checks it over.

It's not obvious to me quite what the difference is, and I suspect that
if bin_read() hadn't grown quite so organically (this is not a term of
approbation) it would me more obvious that they could be combined.

I suspect it's just the fact that the -s and -d code has been written
differently from the -k code.  The latter assumes it's a good idea to
keep the normal shell state (shttyinfo) in sync; this is complicated by
the fact that in non-interactive usage we have to set up shttyinfo if it
wasn't already.  The former assumes it should just alter the current
settings and restore them to what they were afterwards.  The whole thing
is further complicated by the fact that we (I've certainly mucked
around with it, too) do different things depending on additional options
to -k.  This is just a hypothesis.

To be honest, I can't really follow all the ins and outs and if your
patch works (checking -k in combination with other options is probably
the key) it's probably good enough and we can see if problems turn up as
time passes.

It would be nice to have tests but they're particularly difficult to
write for this.

> And of course there may be some kind of bad interaction between changing
> the tty state and reading typeahead that I'm not aware of that makes all
> this impossible, in which case it should just be documented that you
> can't use a prompt or -s or -d in combination with -t.

With a bit of luck, weird interactions of this kind may be just a bad
memory now... I've a vague memory Ultrix came into it.  I don't think we
ever deliberately attempted to handle this outside zle, in any case, but
I could be wrong.  Certainly the word "typeahead", with or without
a hyphen, only seems to occur in Zle (and input.c where we're about
to call Zle.)

> That thread just sort of died without resolution because PWS can't
> reproduce the problem.

I suspect that was more to do with the fact that the xterm stuff wasn't
doing the right thing for me rather than that the shell *was* doing the
right thing, but I never really got to the bottom of it.

-- 
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