Skip to content

Commit 399f471

Browse files
Adapts CSIu input protocol to match how recent fish shell implementation transmits it.
However, I cannot really read that behaviour from https://sw.kovidgoyal.net/kitty/keyboard-protocol/ There was no example showing `CSI = u` nor `CSI = 5 u` without first entering CSIu mode. It seems like fish shell is tweaking CSIu mode by setting/resetting without entering/leaving. The given spec however also does not mention flags to default to 0 neither. Signed-off-by: Christian Parpart <christian@parpart.family>
1 parent 698c64e commit 399f471

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

metainfo.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<li>Fixes empty history jump (#1781)</li>
120120
<li>Fixes double line box drawing characters</li>
121121
<li>Fixes DECRQM (DEC Request Mode) response (#1797)</li>
122+
<li>Fixes fish-shell keyboard input protocol behaviour; acting as if it would be broken on e.g. control keys (weird handling of CSIu input protocol)</li>
122123
<li>Enables customizing predefined color palette (#1763)</li>
123124
<li>Ensure inserting new tabs happens right next to the currently active tab (#1695)</li>
124125
<li>Allow glyphs to underflow if they are not bigger than the cell size (#1603)</li>

src/vtbackend/Functions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ constexpr inline auto CHA = detail::CSI(std::nullopt, 0, 1, std::nullopt
517517
constexpr inline auto CHT = detail::CSI(std::nullopt, 0, 1, std::nullopt, 'I', VTType::VT100, documentation::CHT);
518518
constexpr inline auto CNL = detail::CSI(std::nullopt, 0, 1, std::nullopt, 'E', VTType::VT100, documentation::CNL);
519519
constexpr inline auto CPL = detail::CSI(std::nullopt, 0, 1, std::nullopt, 'F', VTType::VT100, documentation::CPL);
520-
constexpr inline auto CSIUENHCE = detail::CSI('=', 1, 2, std::nullopt, 'u', VTExtension::Unknown, documentation::CSIUENHCE);
520+
constexpr inline auto CSIUENHCE = detail::CSI('=', 0, 2, std::nullopt, 'u', VTExtension::Unknown, documentation::CSIUENHCE);
521521
constexpr inline auto CSIUENTER = detail::CSI('>', 0, 1, std::nullopt, 'u', VTExtension::Unknown, documentation::CSIUENTER);
522522
constexpr inline auto CSIULEAVE = detail::CSI('<', 0, 1, std::nullopt, 'u', VTExtension::Unknown, documentation::CSIULEAVE);
523523
constexpr inline auto CSIUQUERY = detail::CSI('?', 0, 0, std::nullopt, 'u', VTExtension::Unknown, documentation::CSIUQUERY);

src/vtbackend/Screen.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,10 +3638,9 @@ ApplyResult Screen<Cell>::apply(Function const& function, Sequence const& seq)
36383638
return ApplyResult::Ok;
36393639
}
36403640
case CSIUENHCE: {
3641-
auto const flags = KeyboardEventFlags::from_value(seq.param_or(0, 1));
3641+
// Defaulting flags to 0. (Seems not to be documented by the spec, but Fish shell is doing that!)
3642+
auto const flags = KeyboardEventFlags::from_value(seq.param_or(0, 0));
36423643
auto const mode = seq.param_or(1, 1);
3643-
if (_terminal->keyboardProtocol().stackDepth() <= 1)
3644-
return ApplyResult::Invalid;
36453644
switch (mode)
36463645
{
36473646
case 1: _terminal->keyboardProtocol().flags() = flags; return ApplyResult::Ok;

0 commit comments

Comments
 (0)