Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home/End keys not working on a urxvt terminal under mosh #1310

Open
randomizedthinking opened this issue Feb 21, 2024 · 5 comments
Open

Home/End keys not working on a urxvt terminal under mosh #1310

randomizedthinking opened this issue Feb 21, 2024 · 5 comments

Comments

@randomizedthinking
Copy link

randomizedthinking commented Feb 21, 2024

I noticed that both Home/End keys are not working on shell command line under mosh. After fiddling around, the root cause per my investigation is due to the keycode translation between another term and mosh (xterm): Home key is defined as ^[[7 under urxvt. Yet internally, mosh uses xterm, so Home key is expected to be ^[[H.

My speculation is that mosh does not do the correct job of translating Home keycode from rxvt-unicode-256color term to xterm correctly. I did the same test under tmux -- note tmux is running inside xterm. Again, the keycode translation is also incorrect from tmux-256color to xterm.

How to reproduce the issue:

  1. start a urxvt terminal.
  2. mosh into another remote box.
  3. type 'pwd' or whatever under the command-line: do not press Enter, but press 'Home' to see what happens.

mosh version: 1.4.0.

@achernya
Copy link
Collaborator

I don't think mosh does any keycode translations at all. From my read of https://github.com/mobile-shell/mosh/blob/1105d481bb9143dad43adf768f58da7b029fd39c/src/terminal/terminaldisplayinit.cc the capability inspection doesn't do anything with keycode translations.

@randomizedthinking
Copy link
Author

You are right that mosh does not do any keycode translation. I can use showkey -a to verify that the keycodes of Home are identical on both local and remote boxes.

It confused me. Since mosh now uses TERM=xterm internally, how can it handle different term setups without any such translation?

@achernya
Copy link
Collaborator

how can it handle different term setups without any such translation?

I believe the answer is "it doesn't". I'm actually a bit unsure why we haven't run into this before, because I use mosh regularly from rxvt-unicode-256color myself, and have never noticed an issue.

@randomizedthinking
Copy link
Author

Also, there is something interesting about this issue. Home/End keys won't work under the shell command line, but they work in both vim and emacs. Not sure why both vim and emacs can process them properly.

@bionade24
Copy link

The 2 keys also work fine in tmux sessions, but not outside of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants