-
Notifications
You must be signed in to change notification settings - Fork 9k
Implement the Kitty Keyboard Protocol #19817
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
base: main
Are you sure you want to change the base?
Conversation
| uint32_t TerminalInput::_codepointToLower(uint32_t cp) noexcept | ||
| { | ||
| auto cb = _codepointToBuffer(cp); | ||
| // NOTE: MSDN states that `lpSrcStr == lpDestStr` is valid for LCMAP_LOWERCASE. |
Check failure
Code scanning / check-spelling
Unrecognized Spelling
| { | ||
| auto cb = _codepointToBuffer(cp); | ||
| // NOTE: MSDN states that `lpSrcStr == lpDestStr` is valid for LCMAP_LOWERCASE. | ||
| const auto len = LCMapStringW(LOCALE_INVARIANT, LCMAP_LOWERCASE, cb.buf, cb.len, cb.buf, gsl::narrow_cast<int>(std::size(cb.buf))); |
Check failure
Code scanning / check-spelling
Unrecognized Spelling
| case CsiActionCodes::ANSISYSRC_CursorRestore: | ||
| _dispatch->CursorRestoreState(); | ||
| break; | ||
| case CsiActionCodes::KKP_KittyKeyboardSet: |
Check failure
Code scanning / check-spelling
Unrecognized Spelling
| case CsiActionCodes::KKP_KittyKeyboardSet: | ||
| _dispatch->SetKittyKeyboardProtocol(parameters.at(0), parameters.at(1)); | ||
| break; | ||
| case CsiActionCodes::KKP_KittyKeyboardQuery: |
Check failure
Code scanning / check-spelling
Unrecognized Spelling
| case CsiActionCodes::KKP_KittyKeyboardQuery: | ||
| _dispatch->QueryKittyKeyboardProtocol(); | ||
| break; | ||
| case CsiActionCodes::KKP_KittyKeyboardPush: |
Check failure
Code scanning / check-spelling
Unrecognized Spelling
| case CsiActionCodes::KKP_KittyKeyboardPush: | ||
| _dispatch->PushKittyKeyboardProtocol(parameters.at(0)); | ||
| break; | ||
| case CsiActionCodes::KKP_KittyKeyboardPop: |
Check failure
Code scanning / check-spelling
Unrecognized Spelling
| DECSLRM_SetLeftRightMargins = VTID("s"), | ||
| DTTERM_WindowManipulation = VTID("t"), // NOTE: Overlaps with DECSLPP. Fix when/if implemented. | ||
| ANSISYSRC_CursorRestore = VTID("u"), | ||
| KKP_KittyKeyboardSet = VTID("=u"), |
Check failure
Code scanning / check-spelling
Unrecognized Spelling
| } | ||
|
|
||
| _getTerminalInput().ForceDisableWin32InputMode(settings.ForceVTInput()); | ||
| _getTerminalInput().ForceDisableKittyKeyboardProtocol(!settings.AllowKittyKeyboardMode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work because OpenConsole still turns the Win32 events into Kitty ones. I don't understand why that happens and don't like that it happens.
| <!-- For ALL build types--> | ||
| <PropertyGroup Label="Configuration"> | ||
| <PlatformToolset>v143</PlatformToolset> | ||
| <PlatformToolset>v145</PlatformToolset> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't have done the git add -A, eh? 🫠
DHowett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are unfortunately going to need some tests. or something. of the weird corner cases.
| #include <windows.h> | ||
| #include "terminalInput.hpp" | ||
|
|
||
| using namespace Microsoft::Console::VirtualTerminal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol a 30 line file to maintain ... one boolean
| <comment>Header for a control to toggle legacy input encoding for the terminal.</comment> | ||
| </data> | ||
| <data name="Profile_AllowKittyKeyboardMode.Header" xml:space="preserve"> | ||
| <value>Kitty keyboard protocol mode</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably want to lock this term
| <comment>Header for a control to set the kitty keyboard protocol mode.</comment> | ||
| </data> | ||
| <data name="Profile_AllowKittyKeyboardMode.HelpText" xml:space="preserve"> | ||
| <value>Sets the baseline flags for the kitty keyboard protocol. Value is a sum of: 1=Disambiguate, 2=Report event types, 4=Report alternate keys, 8=Report all keys, 16=Report text.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also it's a boolean right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks forgot about that one.
| </local:SettingContainer> | ||
|
|
||
| <!-- Kitty Keyboard Mode --> | ||
| <local:SettingContainer x:Uid="Profile_AllowKittyKeyboardMode" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <local:SettingContainer x:Uid="Profile_AllowKittyKeyboardMode" | |
| <local:SettingContainer x:Name="AllowKittyKeyboardMode" | |
| x:Uid="Profile_AllowKittyKeyboardMode" |
(when settings search merges) if you add a name here, it'll automatically get added to the search index 😉
DHowett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost all the way done. Can you explain the conhost win32im thing? Should we actually use Kitty as our internal protocol?
| // Pop the requested number of entries, restoring flags from last popped | ||
| for (size_t i = 0; i < count; ++i) | ||
| { | ||
| _kittyFlags = stack.back(); | ||
| stack.pop_back(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just, like, _kittyFlags = stack.at(count + 1); and erase the first count entries?
|
|
||
| // Generates kitty keyboard protocol output for a key event. | ||
| // https://sw.kovidgoyal.net/kitty/keyboard-protocol/ | ||
| TerminalInput::OutputType TerminalInput::_makeKittyOutput(const KEY_EVENT_RECORD& key, const DWORD controlKeyState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lord, it's 400 lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, even my upcoming, more readable version, won't make it any shorter...
|
I'm working on a version that's a lot easier to read. The problem is that it also doesn't quite work. 😄 Still working on that. |
TBD
Closes #11509
Validation Steps Performed
kitten show-key -m kitty✅