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

Wrong ESC-sequences for F-keys F1-F4 #3586

Closed
dimitrik-fr opened this issue May 6, 2021 · 6 comments
Closed

Wrong ESC-sequences for F-keys F1-F4 #3586

dimitrik-fr opened this issue May 6, 2021 · 6 comments
Labels

Comments

@dimitrik-fr
Copy link

dimitrik-fr commented May 6, 2021

Describe the bug
Both xtrerm-kettyand xterm-256color terminfo are having F1-F4 keys as :

  • F1: kf1=\EOP
  • F2: kf2=\EOQ
  • F3: kf3=\EOR
  • F4: kf4=\EOS

while kitty is returning on these keys pressing the following :

  • F1 : \EP
  • F2 : \EQ
  • F3 : \ER
  • F4 : \ES

e.g. there was somewhere missed "O" in output sequences..
and, curiously, this is happening only with F1-F4 keys, any other F-keys are working just fine.

To Reproduce

you can observe the problem with any Terminal app which is able to report pressed keys, and for me the most simple is to use "micro" for this :

  1. start "micro" in kitty
  2. type Ctrl-e
  3. type raw in command line
  4. now type any F-key and observe the received ESC-sequence
  5. check F1-F4 keys, etc.
  6. type Ctrl-q to leave "raw" mode
  7. type Ctrl-q to leave "micro"

Expected behavior
the expected behavior is to see the sequences matching terminfo.

Environment details
OS: OSX Catalina (but I don't think OS plays any role here)

@dimitrik-fr dimitrik-fr added the bug label May 6, 2021
@kovidgoyal
Copy link
Owner

kovidgoyal commented May 6, 2021

I cannot replicate this with kitty 0.20.3, running:

kitty --config=NONE kitty +kitten show_key -m application

and pressing F1 correctly displays

^[OP

as expected.

@kovidgoyal
Copy link
Owner

Oh and just for completeness, same without using the showkey kitten

printf '\x1b[?1h'; cat -v

also prints ^[OP as expected for F1

@dimitrik-fr
Copy link
Author

Hmm.. -- seems like you're right (and probably there are some issues in "micro" then)..

also, to have "third party" test check, I've also tried "vi", and it was printing when F2, F3, F4 are pressed, so I'll open a bug report for "micro", let's see..

thank you for prompt support !

Rgds, -Dimitri

@trygveaa
Copy link
Contributor

trygveaa commented May 7, 2021

If you don't set the terminal in Application Cursor Keys mode (don't print \x1b[?1h), kitty will send ^[[P instead of ^[OP and so on, so I assume micro doesn't set it in this mode.

@kovidgoyal: Why does Application Cursor Keys mode change the function keys, not just the arrow keys in kitty? E.g. xterm sends ^[OP for F1 regardless of this mode.

@kovidgoyal
Copy link
Owner

Ah, that is indeed a regression, although note that cursor key mode
affects the cursor keys, home, end and the KP_BEGIN key. Just not F1-F4 :)

@trygveaa
Copy link
Contributor

trygveaa commented May 7, 2021

note that cursor key mode affects the cursor keys, home, end and the KP_BEGIN key

Right, "just the arrow keys" wasn't completely accurate.

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

No branches or pull requests

3 participants