Skip to content

Commit 425a403

Browse files
committed
PRE-MERGE #19817 Implement the Kitty Keyboard Protocol
2 parents 408b232 + efcc5f9 commit 425a403

File tree

31 files changed

+1892
-676
lines changed

31 files changed

+1892
-676
lines changed

.github/actions/spelling/expect/expect.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ conterm
256256
contsf
257257
contypes
258258
conwinuserrefs
259-
coordnew
260259
COPYCOLOR
261260
COPYDATA
262261
COPYDATASTRUCT
@@ -622,7 +621,6 @@ fuzzmap
622621
fuzzwrapper
623622
fwdecl
624623
fwe
625-
fwlink
626624
fzf
627625
gci
628626
gcx
@@ -866,6 +864,7 @@ KILLACTIVE
866864
KILLFOCUS
867865
kinda
868866
KIYEOK
867+
KKP
869868
KLF
870869
KLMNO
871870
KOK
@@ -885,6 +884,7 @@ LBUTTONDOWN
885884
LBUTTONUP
886885
lcb
887886
lci
887+
LCMAP
888888
LCONTROL
889889
LCTRL
890890
lcx

src/buffer/out/ut_textbuffer/ReflowTests.cpp

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -600,90 +600,6 @@ namespace
600600
},
601601
},
602602
};
603-
604-
#pragma region TAEF hookup for the test case array above
605-
struct ArrayIndexTaefAdapterRow : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom | Microsoft::WRL::InhibitFtmBase>, IDataRow>
606-
{
607-
HRESULT RuntimeClassInitialize(const size_t index)
608-
{
609-
_index = index;
610-
return S_OK;
611-
}
612-
613-
STDMETHODIMP GetTestData(BSTR /*pszName*/, SAFEARRAY** ppData) override
614-
{
615-
const auto indexString{ wil::str_printf<std::wstring>(L"%zu", _index) };
616-
auto safeArray{ SafeArrayCreateVector(VT_BSTR, 0, 1) };
617-
LONG index{ 0 };
618-
auto indexBstr{ wil::make_bstr(indexString.c_str()) };
619-
(void)SafeArrayPutElement(safeArray, &index, indexBstr.release());
620-
*ppData = safeArray;
621-
return S_OK;
622-
}
623-
624-
STDMETHODIMP GetMetadataNames(SAFEARRAY** ppMetadataNames) override
625-
{
626-
*ppMetadataNames = nullptr;
627-
return S_FALSE;
628-
}
629-
630-
STDMETHODIMP GetMetadata(BSTR /*pszName*/, SAFEARRAY** ppData) override
631-
{
632-
*ppData = nullptr;
633-
return S_FALSE;
634-
}
635-
636-
STDMETHODIMP GetName(BSTR* ppszRowName) override
637-
{
638-
*ppszRowName = nullptr;
639-
return S_FALSE;
640-
}
641-
642-
private:
643-
size_t _index;
644-
};
645-
646-
struct ArrayIndexTaefAdapterSource : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom | Microsoft::WRL::InhibitFtmBase>, IDataSource>
647-
{
648-
STDMETHODIMP Advance(IDataRow** ppDataRow) override
649-
{
650-
if (_index < std::extent_v<decltype(testCases)>)
651-
{
652-
Microsoft::WRL::MakeAndInitialize<ArrayIndexTaefAdapterRow>(ppDataRow, _index++);
653-
}
654-
else
655-
{
656-
*ppDataRow = nullptr;
657-
}
658-
return S_OK;
659-
}
660-
661-
STDMETHODIMP Reset() override
662-
{
663-
_index = 0;
664-
return S_OK;
665-
}
666-
667-
STDMETHODIMP GetTestDataNames(SAFEARRAY** names) override
668-
{
669-
auto safeArray{ SafeArrayCreateVector(VT_BSTR, 0, 1) };
670-
LONG index{ 0 };
671-
auto dataNameBstr{ wil::make_bstr(L"index") };
672-
(void)SafeArrayPutElement(safeArray, &index, dataNameBstr.release());
673-
*names = safeArray;
674-
return S_OK;
675-
}
676-
677-
STDMETHODIMP GetTestDataType(BSTR /*name*/, BSTR* type) override
678-
{
679-
*type = nullptr;
680-
return S_OK;
681-
}
682-
683-
private:
684-
size_t _index{ 0 };
685-
};
686-
#pragma endregion
687603
}
688604

689605
extern "C" HRESULT __declspec(dllexport) __cdecl ReflowTestDataSource(IDataSource** ppDataSource, void*)

src/cascadia/TerminalCore/ICoreSettings.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ namespace Microsoft.Terminal.Core
121121
String WordDelimiters { get; };
122122

123123
Boolean ForceVTInput { get; };
124+
Boolean AllowKittyKeyboardMode { get; };
124125
Boolean AllowVtChecksumReport { get; };
125126
Boolean AllowVtClipboardWrite { get; };
126127
Boolean TrimBlockSelection { get; };

src/cascadia/TerminalCore/Terminal.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ void Terminal::UpdateSettings(ICoreSettings settings)
9898
}
9999

100100
_getTerminalInput().ForceDisableWin32InputMode(settings.ForceVTInput());
101+
_getTerminalInput().ForceDisableKittyKeyboardProtocol(!settings.AllowKittyKeyboardMode());
101102

102103
if (settings.TabColor() == nullptr)
103104
{

src/cascadia/TerminalSettingsAppAdapterLib/TerminalSettings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ namespace winrt::Microsoft::Terminal::Settings
349349
_ReloadEnvironmentVariables = profile.ReloadEnvironmentVariables();
350350
_RainbowSuggestions = profile.RainbowSuggestions();
351351
_ForceVTInput = profile.ForceVTInput();
352+
_AllowKittyKeyboardMode = profile.AllowKittyKeyboardMode();
352353
_AllowVtChecksumReport = profile.AllowVtChecksumReport();
353354
_AllowVtClipboardWrite = profile.AllowVtClipboardWrite();
354355
_PathTranslationStyle = profile.PathTranslationStyle();

src/cascadia/TerminalSettingsEditor/ProfileViewModel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
145145
OBSERVABLE_PROJECTED_SETTING(_profile, AutoMarkPrompts);
146146
OBSERVABLE_PROJECTED_SETTING(_profile, RepositionCursorWithMouse);
147147
OBSERVABLE_PROJECTED_SETTING(_profile, ForceVTInput);
148+
OBSERVABLE_PROJECTED_SETTING(_profile, AllowKittyKeyboardMode);
148149
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtChecksumReport);
149150
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtClipboardWrite);
150151
OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage);

src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ namespace Microsoft.Terminal.Settings.Editor
134134
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AutoMarkPrompts);
135135
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RepositionCursorWithMouse);
136136
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, ForceVTInput);
137+
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowKittyKeyboardMode);
137138
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowVtChecksumReport);
138139
OBSERVABLE_PROJECTED_PROFILE_SETTING(String, AnswerbackMessage);
139140
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RainbowSuggestions);

src/cascadia/TerminalSettingsEditor/Profiles_Terminal.xaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@
5151
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
5252
</local:SettingContainer>
5353

54+
<!-- Kitty Keyboard Mode -->
55+
<local:SettingContainer x:Name="AllowKittyKeyboardMode"
56+
x:Uid="Profile_AllowKittyKeyboardMode"
57+
ClearSettingValue="{x:Bind Profile.ClearAllowKittyKeyboardMode}"
58+
HasSettingValue="{x:Bind Profile.HasAllowKittyKeyboardMode, Mode=OneWay}"
59+
SettingOverrideSource="{x:Bind Profile.AllowKittyKeyboardModeOverrideSource, Mode=OneWay}">
60+
<ToggleSwitch IsOn="{x:Bind Profile.AllowKittyKeyboardMode, Mode=TwoWay}"
61+
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
62+
</local:SettingContainer>
63+
5464
<!-- Allow VT Checksum Report -->
5565
<local:SettingContainer x:Name="AllowVtChecksumReport"
5666
x:Uid="Profile_AllowVtChecksumReport"

src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@
546546
<value>Use the legacy input encoding</value>
547547
<comment>Header for a control to toggle legacy input encoding for the terminal.</comment>
548548
</data>
549+
<data name="Profile_AllowKittyKeyboardMode.Header" xml:space="preserve">
550+
<value>Allow Kitty Keyboard Protocol</value>
551+
<comment>{Locked="Kitty"}Kitty is a moniker and its Keyboard Protocol is a protocol specification.</comment>
552+
</data>
549553
<data name="Profile_AllowVtChecksumReport.Header" xml:space="preserve">
550554
<value>Allow DECRQCRA (Request Checksum of Rectangular Area)</value>
551555
<comment>{Locked="DECRQCRA"}{Locked="Request Checksum of Rectangular Area"}Header for a control to toggle support for the DECRQCRA control sequence.</comment>
@@ -2583,19 +2587,19 @@
25832587
<comment>An option to choose from for the "path translation" setting.</comment>
25842588
</data>
25852589
<data name="Profile_PathTranslationStyleWsl.Content" xml:space="preserve">
2586-
<value>WSL (C:\ -> /mnt/c)</value>
2590+
<value>WSL (C:\ -&gt; /mnt/c)</value>
25872591
<comment>{Locked="WSL","C:\","/mnt/c"} An option to choose from for the "path translation" setting.</comment>
25882592
</data>
25892593
<data name="Profile_PathTranslationStyleCygwin.Content" xml:space="preserve">
2590-
<value>Cygwin (C:\ -> /cygdrive/c)</value>
2594+
<value>Cygwin (C:\ -&gt; /cygdrive/c)</value>
25912595
<comment>{Locked="Cygwin","C:\","/cygdrive/c"} An option to choose from for the "path translation" setting.</comment>
25922596
</data>
25932597
<data name="Profile_PathTranslationStyleMsys2.Content" xml:space="preserve">
2594-
<value>MSYS2 (C:\ -> /c)</value>
2598+
<value>MSYS2 (C:\ -&gt; /c)</value>
25952599
<comment>{Locked="MSYS2","C:\","/c"} An option to choose from for the "path translation" setting.</comment>
25962600
</data>
25972601
<data name="Profile_PathTranslationStyleMinGW.Content" xml:space="preserve">
2598-
<value>MinGW (C:\ -> C:/)</value>
2602+
<value>MinGW (C:\ -&gt; C:/)</value>
25992603
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
26002604
</data>
26012605
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">

src/cascadia/TerminalSettingsModel/MTSMSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Author(s):
103103
X(bool, ReloadEnvironmentVariables, "compatibility.reloadEnvironmentVariables", true) \
104104
X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \
105105
X(bool, ForceVTInput, "compatibility.input.forceVT", false) \
106+
X(bool, AllowKittyKeyboardMode, "compatibility.kittyKeyboardMode", true) \
106107
X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \
107108
X(bool, AllowVtClipboardWrite, "compatibility.allowOSC52", true) \
108109
X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \

0 commit comments

Comments
 (0)