@@ -2073,6 +2073,13 @@ void AdaptDispatch::SetAnsiMode(const bool ansiMode)
20732073// CSI = flags ; mode u - Sets kitty keyboard protocol flags
20742074void AdaptDispatch::SetKittyKeyboardProtocol (const VTParameter flags, const VTParameter mode) noexcept
20752075{
2076+ // Avoid setting KKP flags in `_terminalInput` when we're ConPTY. Otherwise, we'd be translating
2077+ // W32IM to KKP, even when KKP is not supported by the hosting terminal (possibly intentionally).
2078+ if (_api.IsConPTY ())
2079+ {
2080+ return ;
2081+ }
2082+
20762083 const auto kittyFlags = gsl::narrow_cast<uint8_t >(flags.value_or (0 ));
20772084 const auto KittyKeyboardProtocol = static_cast <TerminalInput::KittyKeyboardProtocolMode>(mode.value_or (1 ));
20782085 _terminalInput.SetKittyKeyboardProtocol (kittyFlags, KittyKeyboardProtocol);
@@ -2081,20 +2088,35 @@ void AdaptDispatch::SetKittyKeyboardProtocol(const VTParameter flags, const VTPa
20812088// CSI ? u - Queries current kitty keyboard protocol flags
20822089void AdaptDispatch::QueryKittyKeyboardProtocol ()
20832090{
2091+ if (_api.IsConPTY ())
2092+ {
2093+ return ;
2094+ }
2095+
20842096 const auto flags = static_cast <VTInt>(_terminalInput.GetKittyFlags ());
20852097 _ReturnCsiResponse (fmt::format (FMT_COMPILE (L" ?{}u" ), flags));
20862098}
20872099
20882100// CSI > flags u - Pushes current kitty keyboard flags onto the stack and sets new flags
20892101void AdaptDispatch::PushKittyKeyboardProtocol (const VTParameter flags)
20902102{
2103+ if (_api.IsConPTY ())
2104+ {
2105+ return ;
2106+ }
2107+
20912108 const auto kittyFlags = gsl::narrow_cast<uint8_t >(flags.value_or (0 ));
20922109 _terminalInput.PushKittyFlags (kittyFlags);
20932110}
20942111
20952112// CSI < count u - Pops one or more entries from the kitty keyboard stack
20962113void AdaptDispatch::PopKittyKeyboardProtocol (const VTParameter count)
20972114{
2115+ if (_api.IsConPTY ())
2116+ {
2117+ return ;
2118+ }
2119+
20982120 const auto popCount = static_cast <size_t >(count.value_or (1 ));
20992121 _terminalInput.PopKittyFlags (popCount);
21002122}
0 commit comments