zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Sebastian Gniazdowski <psprint3@fastmail.com>, zsh-users@zsh.org
Subject: Re: Problem with early key strokes at startup
Date: Tue, 28 Feb 2017 13:16:18 -0800	[thread overview]
Message-ID: <170228131618.ZM8208@torch.brasslantern.com> (raw)
In-Reply-To: <1488277394.2867401.895300784.0A2F382A@webmail.messagingengine.com>

On Feb 28,  2:23am, Sebastian Gniazdowski wrote:
}
} when I startup zsh to just run a tool with Ctrl-O Ctrl-P, I get "^P" or
} "^O^P" printed instead:
} 
} Maybe it's easy to fix?

Unfortunately not.  Typeahead (characters present on stdin before the
shell is ready to read them) is exceptionally difficult to deal with
in a portable way.  There are several lengthy comments about this in
the C code in shell startup and zle.

In this specific case, the problem is likely ctrl-O.  If you look at
output of "stty -a" you'll probably find ^O bound to something called
"flush" which is annoyingly undocumented but means to throw away all
previous input that has not already been read by whatever is connected
to the TTY device.  This is likely being seen and intepreted by the
terminal driver before zsh has a chance to change the state to "raw"
input, and there's absolutely nothing we can do about *that*.

If this is a new shell being spawned by an already-running zsh, you
can try playing around with the value of the STTY environment variable
to disable some of the special tty driver settings ahead of time (see
the zsh manual for how STTY works).  If it's not zsh you'll have to
figure out a different way to frob the driver -- and either way I do
not promise it'll work.


  reply	other threads:[~2017-02-28 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 10:23 Sebastian Gniazdowski
2017-02-28 21:16 ` Bart Schaefer [this message]
2017-03-01  6:28   ` Sebastian Gniazdowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170228131618.ZM8208@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=psprint3@fastmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).