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

Re: stty not working

On Mon, 01 Sep 2014 11:28:37 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> E.g., I might have expected that
> % ttyctl -u; stty -echo; ttyctl -f
> would "freeze" the terminal in no-echo mode, such that when accept-line
> is run and ZLE finishes, the terminal would be put into no-echo mode
> before the command is run.

It's very simple to add an option to ttyctl that saves the current state
of the terminal.  However, when we enter zle we call zsetterm() --- I
think typically in zrefresh() though the logic for setting up the
terminal seems a bit obscure --- which does...

    /* sanitize the tty */
    shttyinfo.tio.c_lflag |= ICANON | ECHO;

It's not entirely clear to me we should be doing that: the rest of
zsetterm() assigns shttyinfo to a local variable and then proceeds to
set up for line editing using operations on that, so they don't get
applied to the terminal settings used outside zle.  So maybe this ought
to do the same thing and we rely on the user knowing what they're doing
outside zle.

I haven't checked if this is the only gotcha.


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