-
-
Notifications
You must be signed in to change notification settings - Fork 805
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
fix: issue 3935 handle F13-F24 #3937
Conversation
Thanks for this! For the sake of completeness, since I don't have a device where I can test this, could you also take a look at the kitty keyboard encoding for these keys? There's some out-commented relevant code over here: wezterm/wezterm-input-types/src/lib.rs Lines 1307 to 1322 in 69bb69b
that may also require some plumbing for higher numbered F-keys over here: wezterm/wezterm-input-types/src/lib.rs Line 1009 in 69bb69b
and here: wezterm/wezterm-input-types/src/lib.rs Line 742 in 69bb69b
and here: wezterm/wezterm-input-types/src/lib.rs Lines 1856 to 1869 in 69bb69b
Testing methodology should be something like:
|
Sure, will do. My keyboard only has 24 Function keys labelled as such. Not sure if the extra 10 keys on the left are supposed to be the F25-F34 ones. |
I can make wezterm send the kitty codes for F13-F24 but neovim does not seem to enter CSI mode and does not react to them. Is there a way to diagnose the dialog establishing the mode between neovim and wezterm? |
You can use https://wezfurlong.org/wezterm/config/lua/config/debug_key_events.html to have wezterm show what it is sending to the program in the terminal, which may be helpful |
I think I found a problem in neovim, I found the place in the code where it ignores the F13 and higher kitty codes send by wezterm. Also collected a backtrace when wezterm crashed while doing this. |
I don't think the escape sequences produced in this PR are correct. https://sw.kovidgoyal.net/kitty/keyboard-protocol/ lists:
But the format used in this PR is |
This is still incorrect, as F1-F12 should end with I think it should be something like this: Function(n) if *n < 25 => {
// The spec says that kitty prefers an SS3 form for F1-F4,
// but then has some variance in the encoding and cites a
// compatibility issue with a cursor position report.
// Since it allows reporting these all unambiguously with
// the same general scheme, that is what we're using here.
let intro = match *n {
1 => "\x1b[11",
2 => "\x1b[12",
3 => "\x1b[13",
4 => "\x1b[14",
5 => "\x1b[15",
6 => "\x1b[17",
7 => "\x1b[18",
8 => "\x1b[19",
9 => "\x1b[20",
10 => "\x1b[21",
11 => "\x1b[23",
12 => "\x1b[24",
13 => "\x1b[57376",
14 => "\x1b[57377",
15 => "\x1b[57378",
16 => "\x1b[57379",
17 => "\x1b[57380",
18 => "\x1b[57381",
19 => "\x1b[57382",
20 => "\x1b[57383",
21 => "\x1b[57384",
22 => "\x1b[57385",
23 => "\x1b[57386",
24 => "\x1b[57387",
_ => unreachable!(),
};
let c = match *n {
1..=12 => '~',
_ => 'u',
};
format!("{intro};{modifiers}{event_type}{c}")
} |
You are right; I did actually figure that out myself before reading your comment and my fix is quite similar. |
@wez neovim seems to work Ok for me after the last commit. |
Thanks! |
Fixes: keys F13-F24 are not passed through on a PC122 keyboard issue 3935