help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Slow response?


From: Bob Proulx
Subject: Re: [Help-bash] Slow response?
Date: Sun, 17 Jun 2018 13:52:28 -0600
User-agent: Mutt/1.10.0 (2018-05-17)

Peng Yu wrote:
> I have the following line in my ~/.tmux.conf
> 
> bind-key -T root C-'[' next-window

Control-[ is ESC.  Basically you are pressing Escape when you C-[.

> When I type C-'[', it does not switch the window instantaneously.
> There is a slight delay of say less than .5 sec. Is there any set up
> in tmux that can make the switch instantaneously.

As you know escape sequences are used for terminal control.  An escape
sequences will look similar to "ESC [ 1 ; 31 m".  When a terminal
receives ESC it won't know if it is a standalone escape character or
if it the start of an escape sequence.  If the next character is
something like "ESC x" then it immediately knows it is not an escape
sequence (probably an emacs like M-x sequence) and can move to that
state machine state immediately.  But if it only sees the single ESC
and then no further characters then it doesn't know.  Then it waits a
short time for another character.  If no other character arrives
withing the escape sequence timeout limit then it assumes it was a
single solitary escape character.

The choice of the escape sequence ESC [ anything is a good choice
because that is an unlikely sequence to hit accidentally.  But not all
terminals use that escape pattern.  HP used ESC and then a letter such
as 'h' where "ESC h" was the same as keypad Home.  When I used HP
serial terminals and used vi I would quite often be in insert mode and
then hit ESC to exit insert mode and 'h' to move backward to go edit
something.  But if I were too quick then it would be ESC h which on HP
serial terminals and hpterms is the Home keypad escape sequence.  At
which point I would be abruptly flung back to the first position at
the top of the file!  One needed to hit ESC and then wait that half
second for it to be interpreted as a single character and then hit h,
h, h, to move left.

Using ESC for a single command key such as next-window is probably not
a great choice.  I recommend choosing a different key binding.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]