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

Different key map behavior compare to laptop terminal #4643

Open
ziwangj opened this issue Aug 4, 2023 · 4 comments
Open

Different key map behavior compare to laptop terminal #4643

ziwangj opened this issue Aug 4, 2023 · 4 comments

Comments

@ziwangj
Copy link

ziwangj commented Aug 4, 2023

Details

  • Browser and browser version: Chrome
  • OS version:
  • xterm.js version: Latest

Facing different output from xterm terminal for function keys (F1->F12) compared to laptop terminal.

Steps to reproduce

  1. Open xterm console
  2. run script
    while true; do
    read -s -n 1 key
    echo "You typed [$key]."
    [[ $key == 'q' ]] && break
    done

echo "Quitting."

  1. Type key F1, F2
    Laptop output: (macOS 13, zsh shell):
    (12:40:54) tmp $ ./reader.sh
    You typed [a].

You typed [
ou typed [[].
You typed [1].
You typed [9].
You typed [~].

You typed [
ou typed [[].
You typed [2].
You typed [9].
You typed [~].

You typed [q].
Quitting.

Xterm terminal output: will hanging in the middle for a long time without any result

@Tyriar
Copy link
Member

Tyriar commented Aug 4, 2023

If laptop differs it's probably due to the keyboard layout or browser? We pass keys through pretty consistently so not sure how this could be a problem on our end.

@ziwangj
Copy link
Author

ziwangj commented Aug 4, 2023

It is print key map behavior, somehow different than direct key press. We use standard keyboard layout. I think the root cause is https://github.com/xtermjs/xterm.js/blob/master/src/common/input/Keyboard.ts#L249C1-L249C9 print C0.ESC will cause terminal hanging

@Tyriar
Copy link
Member

Tyriar commented Aug 4, 2023

C0.ESC is how you start an escape sequence which is what the F keys are meant to do, so not sure what you mean? I haven't used the function keys much though and they're mostly inaccessible in vscode so there could be a bug here.

@jerch
Copy link
Member

jerch commented Aug 6, 2023

@ziwangj
C0.ESC just outputs the ESC char '\x1b' - if that creates hangs on your backend logic, something else is off there.

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

No branches or pull requests

3 participants