On Sat, May 09, 2015 at 11:38:09AM +0200, Leonardo Brondani Schenkel wrote:
> On 07/05/2015 13:48, Nicholas Marriott wrote:
> > +tmux-users
> > 
> > 
> > On Thu, May 07, 2015 at 10:01:03AM +0100, Nicholas Marriott wrote:
> >> Hi
> >>
> >> Well that explains it, since you have kLFT3=\Eb tmux will send M-Left
> >> instead of M-b for \Eb (and Option+Left since your terminal sends \Eb
> >> for that too).
> 
> All right, so just to make sure that I understand the logic...
> 
> When TERM is 'xterm-256color':
> 1. tmux receives an \Eb from the terminal
> 2. tmux does not recognize the sequence (not in terminfo)
> 3. tmux forwards this sequence "as is" to the application

Almost. tmux recognises this as M-b:

keys are 2 (^[b)
complete key ^[b 0x2062
writing key 0x2062

0x2062 is 0x2000 (Meta) + 0x62 (b).

It isn't sent as-is (there is still a translate step), it just has that
effect.

> 
> When TERM is 'nsterm':
> 1. tmux receives an \Eb from the terminal
> 2. tmux notices that \Eb is kLFT3 (Alt+Left) in terminfo
> 3. tmux translates Alt+Left into KEYC_LEFT|KEYC_ESCAPE (tty-keys.c)
> 4. tmux KEYC_LEFT is ^[[D or ^[OD, depending on the mode
> 5. tmux sends KEYC_LEFT|KEYC_ESCAPE to the application

Yes this is right.

> Makes perfect sense. However, since I get ^[[D or ^[OD in cat, where did
> KEYC_ESCAPE go? Shouldn't I be getting ^[^[[D or ^[^[OD instead? What am
> I missing here? It looks to me that I'm pressing Alt/Option+Left in the
> terminal but the app is receiving just a Left, and the Alt went missing.

This doesn't seem to be the case, from your logs:

keys are 2 (^[b)
complete key ^[b 0x301f
writing key 0x301f
found key 0x301f: "^[[D"

This shows tmux found ^[[D for 0x1f (the key is looked for without the
modifiers).

Then:

input_parse: '^' ground
input_parse: '[' ground
input_parse: '^' ground
input_parse: '[' ground
input_parse: '[' ground
input_parse: 'D' ground

input_parse is logging what tmux receives from the terminal, in this
case it is "cat" printing "^[^[[D".

So the additional ^[ was sent to the terminal, and cat echoed it.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to