You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rxvt-unicode control-arrowkeys incompatible with mosh #161
For control-arrowkey, xterm and gnome-terminal (and I think Terminal.app) send ^[[1;5D
But rxvt-unicode sends ^[Od .
Unfortunately this confuses mosh (which puts the user in application-mode cursor keys and translates them to ANSI if necessary, which requires no lookahead). See terminaluserinput.cpp
Solution 1: More lookahead to correctly translate rxvt-unicode cursor keys (we have to see what the byte is AFTER ^[O, aka SS3, to know whether it needs to be translated to ANSI mode). I don't want to do more lookahead though, because it means delaying when a byte gets sent to the server in some cases, and it's easier to just never do this.
Solution 2: Stop translating cursor keys, and just propagate the application's choice of cursor key mode all the way to the outer terminal, and maintain it as part of the synchronized state. This has some appeal, but I'm not sure what the difficulties will be without trying it.
It's not clear how the lookahead required in ESC O d is any different to that in ESC [ 1 ; 5 D. If anything, SS3 sequences are easier to parse because they are fixed length.
The difficulty is in the opposite direction: with mosh, the user's terminal is always in application mode, so it's always going to send ESC O D. If the application has requested ANSI mode (the default), we need to translate that to ESC [ D (and we do that in terminaluserinput.cpp with very simple logic).
This can be done with no lookahead -- we just say that if the previous byte was ESC and the current byte is O and the virtual terminal is in ANSI mode, we translate the current byte to be [. This works fine with the xterm/gnome-terminal/Terminal.app syntax because SS3 is only used for application-mode cursor keys. The control-arrow sequences use CSI and are invariant -- they don't change based on cursor key mode.
urxvt screws this up by sending an "application-mode" sequence for control-arrowkey (SS3 d) that is also invariant based on cursor key mode. But of course we are interpreting the SS3 as signalling an application-mode cursor key that needs to be translated to ANSI mode. Hence the problem, which is hard to solve without looking ahead at the next byte after the SS3.
Activity
peterjeremy commentedon Apr 13, 2012
It's not clear how the lookahead required in
ESC O dis any different to that inESC [ 1 ; 5 D. If anything, SS3 sequences are easier to parse because they are fixed length.keithw commentedon Apr 13, 2012
The difficulty is in the opposite direction: with mosh, the user's terminal is always in application mode, so it's always going to send ESC O D. If the application has requested ANSI mode (the default), we need to translate that to ESC [ D (and we do that in terminaluserinput.cpp with very simple logic).
This can be done with no lookahead -- we just say that if the previous byte was ESC and the current byte is O and the virtual terminal is in ANSI mode, we translate the current byte to be [. This works fine with the xterm/gnome-terminal/Terminal.app syntax because SS3 is only used for application-mode cursor keys. The control-arrow sequences use CSI and are invariant -- they don't change based on cursor key mode.
urxvt screws this up by sending an "application-mode" sequence for control-arrowkey (SS3 d) that is also invariant based on cursor key mode. But of course we are interpreting the SS3 as signalling an application-mode cursor key that needs to be translated to ANSI mode. Hence the problem, which is hard to solve without looking ahead at the next byte after the SS3.
keithw commentedon Apr 16, 2012
We are going to have to fix this anyway, because xterm uses SS3 to signal F1-F4.
anarcat commentedon May 12, 2016
for the record, i do not believe this is fixed at all. but this seems to be tracked in #178...
tsmithe commentedon Sep 16, 2016
If this is indeed tracked in #178, then the work-around suggested there does not seem to work for me. I also do not believe that this is fixed.
Use "ANSI-mode" cursor keys only on actual cursor keys (A through D).
mux agent-forwarding observability: the posh#161 timeline, both halves
docs: server-introspection design (wire ident/state + mux-peer status…
docs: server-introspection implementation plan (10 TDD tasks)
agent: sessions reach the mux endpoint — stable-path export + bootstr…
agent: the mux rendezvous persists through outages — kept symlink, re…