Skip to content

Conversation

@lhecker
Copy link
Member

@lhecker lhecker commented Jan 29, 2026

TBD

Closes #11509

Validation Steps Performed

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

[LCMAP](#security-tab) is not a recognized word. \(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

[LCMAP](#security-tab) is not a recognized word. \(unrecognized-spelling\)
case CsiActionCodes::ANSISYSRC_CursorRestore:
_dispatch->CursorRestoreState();
break;
case CsiActionCodes::KKP_KittyKeyboardSet:

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[KKP](#security-tab) is not a recognized word. \(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

[KKP](#security-tab) is not a recognized word. \(unrecognized-spelling\)
case CsiActionCodes::KKP_KittyKeyboardQuery:
_dispatch->QueryKittyKeyboardProtocol();
break;
case CsiActionCodes::KKP_KittyKeyboardPush:

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[KKP](#security-tab) is not a recognized word. \(unrecognized-spelling\)
case CsiActionCodes::KKP_KittyKeyboardPush:
_dispatch->PushKittyKeyboardProtocol(parameters.at(0));
break;
case CsiActionCodes::KKP_KittyKeyboardPop:

Check failure

Code scanning / check-spelling

Unrecognized Spelling

[KKP](#security-tab) is not a recognized word. \(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

[KKP](#security-tab) is not a recognized word. \(unrecognized-spelling\)
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-Input Related to input processing (key presses, mouse, etc.) Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal. labels Jan 29, 2026
}

_getTerminalInput().ForceDisableWin32InputMode(settings.ForceVTInput());
_getTerminalInput().ForceDisableKittyKeyboardProtocol(!settings.AllowKittyKeyboardMode());
Copy link
Member Author

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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad!

Copy link
Member Author

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? 🫠

Copy link
Member

@DHowett DHowett left a 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;
Copy link
Member

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>
Copy link
Member

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>
Copy link
Member

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

Copy link
Member Author

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.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jan 29, 2026
</local:SettingContainer>

<!-- Kitty Keyboard Mode -->
<local:SettingContainer x:Uid="Profile_AllowKittyKeyboardMode"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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 😉

Copy link
Member

@DHowett DHowett left a 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?

Comment on lines +155 to +159
// 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();
Copy link
Member

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)
Copy link
Member

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

Copy link
Member Author

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...

@lhecker lhecker marked this pull request as draft January 30, 2026 14:38
@lhecker
Copy link
Member Author

lhecker commented Jan 30, 2026

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.

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

Labels

Area-Input Related to input processing (key presses, mouse, etc.) Issue-Task It's a feature request, but it doesn't really need a major design. Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add keyboard protocol support (the kitty one)

4 participants