Skip to content

Commit 91dbd65

Browse files
committed
PRE-MERGE #19817 Implement the Kitty Keyboard Protocol
2 parents 248ffa1 + 5d0e8c2 commit 91dbd65

File tree

24 files changed

+863
-54
lines changed

24 files changed

+863
-54
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ KILLACTIVE
866866
KILLFOCUS
867867
kinda
868868
KIYEOK
869+
KKP
869870
KLF
870871
KLMNO
871872
KOK
@@ -885,6 +886,7 @@ LBUTTONDOWN
885886
LBUTTONUP
886887
lcb
887888
lci
889+
LCMAP
888890
LCONTROL
889891
LCTRL
890892
lcx

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: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,14 @@
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>Kitty keyboard protocol mode</value>
551+
<comment>Header for a control to set the kitty keyboard protocol mode.</comment>
552+
</data>
553+
<data name="Profile_AllowKittyKeyboardMode.HelpText" xml:space="preserve">
554+
<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>
555+
<comment>Additional description for what the "kitty keyboard mode" setting does.</comment>
556+
</data>
549557
<data name="Profile_AllowVtChecksumReport.Header" xml:space="preserve">
550558
<value>Allow DECRQCRA (Request Checksum of Rectangular Area)</value>
551559
<comment>{Locked="DECRQCRA"}{Locked="Request Checksum of Rectangular Area"}Header for a control to toggle support for the DECRQCRA control sequence.</comment>
@@ -2583,19 +2591,19 @@
25832591
<comment>An option to choose from for the "path translation" setting.</comment>
25842592
</data>
25852593
<data name="Profile_PathTranslationStyleWsl.Content" xml:space="preserve">
2586-
<value>WSL (C:\ -> /mnt/c)</value>
2594+
<value>WSL (C:\ -&gt; /mnt/c)</value>
25872595
<comment>{Locked="WSL","C:\","/mnt/c"} An option to choose from for the "path translation" setting.</comment>
25882596
</data>
25892597
<data name="Profile_PathTranslationStyleCygwin.Content" xml:space="preserve">
2590-
<value>Cygwin (C:\ -> /cygdrive/c)</value>
2598+
<value>Cygwin (C:\ -&gt; /cygdrive/c)</value>
25912599
<comment>{Locked="Cygwin","C:\","/cygdrive/c"} An option to choose from for the "path translation" setting.</comment>
25922600
</data>
25932601
<data name="Profile_PathTranslationStyleMsys2.Content" xml:space="preserve">
2594-
<value>MSYS2 (C:\ -> /c)</value>
2602+
<value>MSYS2 (C:\ -&gt; /c)</value>
25952603
<comment>{Locked="MSYS2","C:\","/c"} An option to choose from for the "path translation" setting.</comment>
25962604
</data>
25972605
<data name="Profile_PathTranslationStyleMinGW.Content" xml:space="preserve">
2598-
<value>MinGW (C:\ -> C:/)</value>
2606+
<value>MinGW (C:\ -&gt; C:/)</value>
25992607
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
26002608
</data>
26012609
<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) \

src/cascadia/TerminalSettingsModel/Profile.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ namespace Microsoft.Terminal.Settings.Model
8888
INHERITABLE_PROFILE_SETTING(Boolean, ReloadEnvironmentVariables);
8989
INHERITABLE_PROFILE_SETTING(Boolean, RainbowSuggestions);
9090
INHERITABLE_PROFILE_SETTING(Boolean, ForceVTInput);
91+
INHERITABLE_PROFILE_SETTING(Boolean, AllowKittyKeyboardMode);
9192
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtChecksumReport);
9293
INHERITABLE_PROFILE_SETTING(Boolean, AllowKeypadMode);
9394
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtClipboardWrite);

0 commit comments

Comments
 (0)