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

Re: Problem with early key strokes at startup



On Tue, Feb 28, 2017, at 01:16 PM, Bart Schaefer wrote:
> 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.

I'm thinking about some minimum effort try. Looked for some
initialization via "ack stty\|STTY" but didn't find it. Would move/copy
it earlier to main, that's all. Maybe it's even the case that needed
initialization is in zle module, it would fire little late then
probably.

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

I have:
cchars: discard = <undef>; dsusp = <undef>; eof = ^D; eol = <undef>;
	eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U;
	lnext = <undef>; min = 1; quit = <undef>; reprint = ^R;
	start = ^Q; status = ^T; stop = ^S; susp = <undef>; time = 0;
	werase = ^W;

-- 
  Sebastian Gniazdowski
  psprint3@xxxxxxxxxxxx



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