The kitty terminal emulator sends CSI u keys with the meta modifier and keys in the Unicode Private Use Area by default (encoded it it's own keyboard protocol which is similar, but not identical to modifyOtherKeys) and doesn't support modifyOtherKeys, so don't set seenModifyOtherKeys for those. Setting seenModifyOtherKeys means that vim don't use mappings for control characters, which kitty still use for Ctrl-key presses, so those would stop working.
Since the Meta modifier is not present on standard keyboards anymore, I think it's very rarely used, so therefore I don't see a problem with not setting seenModifyOtherKeys for it. It's very likely that Shift, Control or Alt would be used before Meta, so then seenModifyOtherKeys would be set by those.
Keys in the Unicode Private Use Area is not used by modifyOtherKeys as far as I can see, so not setting seenModifyOtherKeys for those should not affect terminals supporting modifyOtherKeys, only terminals supporting the kitty keyboard protocol.
Fixes #11403 in kitty. That issue still persists in the foot terminal emulator though, but that's caused by a different problem so it needs a different solution.
https://github.com/vim/vim/pull/11413
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Merging #11413 (9a5a5fb) into master (d5337ef) will decrease coverage by
61.66%.
The diff coverage is0.00%.
@@ Coverage Diff @@ ## master #11413 +/- ## =========================================== - Coverage 61.96% 0.29% -61.67% =========================================== Files 162 152 -10 Lines 186329 175376 -10953 Branches 42878 40345 -2533 =========================================== - Hits 115456 520 -114936 - Misses 58905 174799 +115894 + Partials 11968 57 -11911
| Flag | Coverage Δ | |
|---|---|---|
| huge-gcc-unittests | 0.29% <0.00%> (ø) |
|
| linux | 0.29% <0.00%> (ø) |
|
| mingw-x64-HUGE | ? |
|
| mingw-x86-HUGE | ? |
|
| windows | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/term.c | 0.00% <0.00%> (-31.49%) |
⬇️ |
| src/float.c | 0.00% <0.00%> (-95.64%) |
⬇️ |
| src/sha256.c | 0.00% <0.00%> (-91.88%) |
⬇️ |
| src/crypt_zip.c | 0.00% <0.00%> (-85.30%) |
⬇️ |
| src/testing.c | 0.00% <0.00%> (-84.58%) |
⬇️ |
| src/typval.c | 0.00% <0.00%> (-82.24%) |
⬇️ |
| src/if_lua.c | 0.00% <0.00%> (-80.94%) |
⬇️ |
| src/eval.c | 0.00% <0.00%> (-79.91%) |
⬇️ |
| src/digraph.c | 0.00% <0.00%> (-79.67%) |
⬇️ |
| src/vim9script.c | 0.00% <0.00%> (-79.33%) |
⬇️ |
| ... and 134 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@trygveaa pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Hmm, this looks a bit arbitrary. The Meta modifier may be used by some terminal emulators (e.g. to represent the Cmd key on Mac), just to get it to change what a key does. I have no idea who would use the Unicode Private Use area, this looks a bit too much like guessing. How about checking $TERM for containinng "kitty"? Since kitty doesn't support modifyOtherKeys (and it's very unlikely it will), that is a more direct way. It appears the default value for $TERM is "xterm-kitty", thus that should work.
I see your point. I hadn't thought about Mac using Meta to represent Cmd for instance. Usually I don't like checking TERM because it won't help if other terminals does the same, but I agree that in this case it makes sense since the issue is very specific.
I have updated the commit to check TERM against xterm-kitty. I also added a check for if the control sequence to enable modifyOtherKeys or the kitty keyboard protocol has been sent and only set seenModifyOtherKeys if it has. By doing this, the issue is also fixed in foot. I have updated the commit message with a description of this new behavior. I will also update the PR description with this message.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
If you mean the response to the secondary device attributes query kitty will always send
1; 4000 + primary kitty version number ; secondary kitty version number
so if the kitty version number is 1.23.45 you will get 1;4001;23
For the current kitty release you will get
1;4000;26 since the kitty version number is 0.26.4
Incidentally the adding of 4000 was put in there precisely because of vim turning on SGR_MOUSE mode only if the number was high enough.
And just touching briefly on our last discussion, in order to get this response, you have to send the terminal the bytes ESC[>c . To query for the kitty keyboard protocol you need to send ESC[?u. Since you are not worried about the former "leaking" on terminals that do not handle it, its a bit, umm extreme, to be worrying about the latter leaking. Both are very simple CSI escape codes. If there is indeed a terminal out there that parses the former and not the latter I would be amazed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
As @dnkl has been involved in issue #9014 and foot development I think it is appropriate to tag him, as GitHub PRs do not notify users subscribed to the linked issues
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Checking the contents of t_TI is not reliable. The code may be there to enable the protocol, but that doesn't mean it works.
Well, yes, it's not perfect. However, when I submitted this patch seenModifyOtherKeys was set unconditionally, which is even less reliable. I think only setting seenModifyOtherKeys when we have at least tried to enable the protocol is a lot better than unconditionally setting it.
I see that you've changed it to not be set for kitty now, but the problem with foot remains without this patch.
It would of course be better to know for sure if modifyOtherKeys 2 is enabled, but from what I've seen in the issue comments, there isn't any way to do this? If there was, we could just use that and we wouldn't need to set seenModifyOtherKeys when a key with a modifier is seen at all as far as I understand.
Even if this is not the perfect solution, I don't think the idea of a perfect solution should get in the way of a partial solution which improves the current situation. Issue #9014 has been open for a year, and this patch addresses it. There is a possibility that there exist a terminal with this problem and that it isn't fixed by this patch. However, this patch fixes it for the two problems we know about, which is with kitty and foot, and it doesn't make the situation worse for any other terminal.
By the way, it would be better to set seenModifyOtherKeys for kitty when the kitty keyboard protocol is enabled, like this patch does, because it would make it possible to bind Ctrl-i and Tab as separate keys if the user has set t_TI to enable the kitty keyboard protocol.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I have just submitted patch 9.0.0930 which adds the 'keyprotocol' option.
It's not fully implemented yet, but goes a long way in the right direction.
I have tried to find other ways to detect that the terminal has modifyOtherKeys level 2 enabled,
but it appears there is no such way. The trick in this PR to inspect the t_TI termcap entry for
an escape sequence is unreliable, the terminal may have modifyOtherKeys enabled in another
way, and this check would break things, without providing the user with any way to work around it.
For those terminals that support the kitty keyboard protocol and enable it there should not be
a problem, because requesting the state will trigger a response that they kitty keyboard protocol
is enabled, which would then reset seenModifyOtherKeys (not implemented yet though).
Another change that might help is to set seenModifyOtherKeys only for a sequence that the kitty
protocol does not send: {lead}27;{modifier};{key}~. With xterm it is possible to change to the
other form {lead}{key};{modifier}u, but I doubt it is actually used in practice. And we can tell
users to simply not do that.
I'll await comments on patch 9.0.0930 and make the other changes mentioned. After that please
check if you still see a problem. If so then open a new issue or PR. I'm closing this one now,
since it is outdated.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #11413.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()