You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
capital letters and punctuation not typed in vibe CLI since post-0.7.5 #2020
I confirm this is a reproducible bug, not a feature request, idea, question, contribution proposal, or direction check.
I reproduced this bug on the version and environment reported below using the exact steps provided.
Current behavior
Just from the top, this wasn't an issue on 0.7.5, but somewhere since, inputs have broken.
When using the mistral vibe cli inside herdr, I am unable to insert capital letters or punctuation (such as : etc.) I can only insert lower case letters and numbers. Seems like shift and some other keys are getting lost.
This is reproducible on e16d7d8c07a20f5ee0b4111808680bbcfd7df9ac, which was the latest commit on master at the time of writing.
I've had claude code investigate and fix the issue, and I have compiled and tested the fix myself and can confirm it works. However, I don't want to submit a PR that I don't fully understand. I'll share those details in a comment below, as this issue template doesn't really work for that.
Expected behavior
I would expect to be able to use vibe cli inside herdr. (There is no official integration or anything like that, just basic usage)
Reproduction
Run vibe cli inside herdr. (You can use a free account for testing)
Try to insert capital letters or punctuation into the prompt field. They won't appear.
I've had claude prepare an explanation for the fix and a diff, so that someone who does know what they're doing can take a proper look. I have tested the proposed fix, and it does work.
I'm alright with rust, but terminal protocols etc. aren't my strength. Happy to keep researching and will submit the PR myself if I'm confident I understand it.
Please keep in mind, everything below this is generated by claude code.
Summary
Typing capital letters (e.g. A) and punctuation requiring Shift (e.g. !) does
not work when using the Mistral vibe CLI inside Herdr on any version after 0.7.5.
The same inputs work correctly in other agent CLIs such as OpenCode.
Environment
herdr: post-0.7.5 (regression not present in 0.7.5)
vibe: 2.22.0 (Python, uses the Textual TUI framework)
OS: Linux
Root cause
Commit e7fc85bf ("fix: preserve kitty printable key releases") changed the
encoding priority in try_encode_csi_u / encode_terminal_key. For panes that
push REPORT_ALL_KEYS (Kitty flag bit 3), the new code tries Kitty CSI u
encoding before plain text encoding (kitty_first = true).
The vibe CLI is built on Textual, which pushes this Kitty stack on startup:
\x1b[>25u
That is flags 1 | 8 | 16:
Bit
Flag
Set?
1
DISAMBIGUATE_ESCAPE_CODES
yes
2
REPORT_EVENT_TYPES
no
4
REPORT_ALTERNATE_KEYS
no
8
REPORT_ALL_KEYS
yes
16
REPORT_ASSOCIATED_TEXT
yes
Because REPORT_ALTERNATE_KEYS is absent, Herdr's alternate_shifted_codepoint
returns None for every key. Because REPORT_ASSOCIATED_TEXT is not currently
handled, the CSI u sequence has no third field.
So Shift+A is encoded as:
\x1b[97;2u (base=97='a', modifier=2=Shift, no text field)
Textual's _parse_extended_key sees codepoint 97 and no associated text. Its
shift-reporting logic only adds a "shift" token when text is None or text.isspace(), so it yields:
character=None means Textual's input widget inserts nothing. The same problem
applies to punctuation: Shift+1 becomes \x1b[49;2u, parsed as Key('shift+1', character=None) instead of Key('exclamation_mark', character='!').
Before e7fc85bf, the old code tried encode_text_input first, which returned
the plain byte A or !. Textual parsed those as printable characters directly.
OpenCode works because it pushes all five Kitty flags including REPORT_ALTERNATE_KEYS (4). That causes the host terminal to include the
alternate/shifted codepoint in its own sequences (e.g. \x1b[97:65;2:1u).
Herdr re-encodes that with the alternate field, which OpenCode's full Kitty-aware
TUI can decode correctly.
Proposed fix
Populate the associated text field (third ; section in the CSI u sequence)
in try_encode_csi_u when the pane has REPORT_ASSOCIATED_TEXT set and the
event is a press or repeat. The field carries the Unicode scalar value of the
character that would actually be inserted.
The change is purely additive: panes that did not request REPORT_ASSOCIATED_TEXT
see no change to their sequences.
Diff
diff --git a/src/input/encode.rs b/src/input/encode.rs
index 0ea011ed..1820e1d9 100644
--- a/src/input/encode.rs+++ b/src/input/encode.rs@@ -5,6 +5,7 @@ use super::{KeyboardProtocol, MouseProtocolEncoding, TerminalKey};
const KITTY_FLAG_REPORT_EVENT_TYPES: u16 = 0b0000_0010;
const KITTY_FLAG_REPORT_ALTERNATE_KEYS: u16 = 0b0000_0100;
+const KITTY_FLAG_REPORT_ASSOCIATED_TEXT: u16 = 0b0001_0000;
/// Encode a key event for a PTY child using the pane's negotiated keyboard protocol.
#[allow(dead_code)] // exercised in input unit tests; production uses TerminalRuntime helpers
@@ -238,16 +239,48 @@ fn try_encode_csi_u(key: &TerminalKey, flags: u16) -> Option<Vec<u8>> {
let modifier = kitty_modifier(mods);
- let sequence = match (alternate_shifted, event_suffix) {- (Some(shifted), Some(event)) => format!("\x1b[{codepoint}:{shifted};{modifier}:{event}u"),- (Some(shifted), None) => format!("\x1b[{codepoint}:{shifted};{modifier}u"),- (None, Some(event)) => format!("\x1b[{codepoint};{modifier}:{event}u"),- (None, None) => format!("\x1b[{codepoint};{modifier}u"),+ // When REPORT_ASSOCIATED_TEXT is set and the key is a press or repeat event,+ // include the typed text codepoint as the third field. This lets applications+ // that request REPORT_ALL_KEYS (but not REPORT_ALTERNATE_KEYS) recover the+ // actual character without having to infer it from key+modifiers. Textual-based+ // TUI apps (such as the Mistral vibe CLI) rely on this field to insert text.+ let associated_text = if flags & KITTY_FLAG_REPORT_ASSOCIATED_TEXT != 0+ && key.kind != crossterm::event::KeyEventKind::Release+ {+ text_codepoint_for_key(key)+ } else {+ None+ };++ let sequence = match (alternate_shifted, event_suffix, associated_text) {+ (Some(alt), Some(ev), Some(text)) => {+ format!("\x1b[{codepoint}:{alt};{modifier}:{ev};{text}u")+ }+ (Some(alt), Some(ev), None) => format!("\x1b[{codepoint}:{alt};{modifier}:{ev}u"),+ (Some(alt), None, Some(text)) => format!("\x1b[{codepoint}:{alt};{modifier};{text}u"),+ (Some(alt), None, None) => format!("\x1b[{codepoint}:{alt};{modifier}u"),+ (None, Some(ev), Some(text)) => format!("\x1b[{codepoint};{modifier}:{ev};{text}u"),+ (None, Some(ev), None) => format!("\x1b[{codepoint};{modifier}:{ev}u"),+ (None, None, Some(text)) => format!("\x1b[{codepoint};{modifier};{text}u"),+ (None, None, None) => format!("\x1b[{codepoint};{modifier}u"),
};
Some(sequence.into_bytes())
}
+/// Compute the associated text codepoint for a key event — the Unicode scalar+/// value of the character that would actually be inserted when the key is typed.+/// Returns None for non-printable keys or keys whose text cannot be determined.+fn text_codepoint_for_key(key: &TerminalKey) -> Option<u32> {+ let bytes = encode_text_input(key)?;+ if bytes.is_empty() {+ return None;+ }+ let text = std::str::from_utf8(&bytes).ok()?;+ let ch = text.chars().next()?;+ Some(ch as u32)+}+
/// Legacy terminal encoding (standard escape sequences).
fn encode_legacy(key: TerminalKey) -> Vec<u8> {
Activity
jakenvac commentedon Jul 29, 2026
I've had claude prepare an explanation for the fix and a diff, so that someone who does know what they're doing can take a proper look. I have tested the proposed fix, and it does work.
I'm alright with rust, but terminal protocols etc. aren't my strength. Happy to keep researching and will submit the PR myself if I'm confident I understand it.
Please keep in mind, everything below this is generated by claude code.
Summary
Typing capital letters (e.g.
A) and punctuation requiring Shift (e.g.!) doesnot work when using the Mistral vibe CLI inside Herdr on any version after 0.7.5.
The same inputs work correctly in other agent CLIs such as OpenCode.
Environment
Root cause
Commit
e7fc85bf("fix: preserve kitty printable key releases") changed theencoding priority in
try_encode_csi_u/encode_terminal_key. For panes thatpush
REPORT_ALL_KEYS(Kitty flag bit 3), the new code tries Kitty CSI uencoding before plain text encoding (
kitty_first = true).The vibe CLI is built on Textual, which pushes this Kitty stack on startup:
That is flags
1 | 8 | 16:Because
REPORT_ALTERNATE_KEYSis absent, Herdr'salternate_shifted_codepointreturns
Nonefor every key. BecauseREPORT_ASSOCIATED_TEXTis not currentlyhandled, the CSI u sequence has no third field.
So
Shift+Ais encoded as:Textual's
_parse_extended_keysees codepoint 97 and no associated text. Itsshift-reporting logic only adds a "shift" token when
text is None or text.isspace(), so it yields:character=Nonemeans Textual's input widget inserts nothing. The same problemapplies to punctuation:
Shift+1becomes\x1b[49;2u, parsed asKey('shift+1', character=None)instead ofKey('exclamation_mark', character='!').Before
e7fc85bf, the old code triedencode_text_inputfirst, which returnedthe plain byte
Aor!. Textual parsed those as printable characters directly.OpenCode works because it pushes all five Kitty flags including
REPORT_ALTERNATE_KEYS(4). That causes the host terminal to include thealternate/shifted codepoint in its own sequences (e.g.
\x1b[97:65;2:1u).Herdr re-encodes that with the alternate field, which OpenCode's full Kitty-aware
TUI can decode correctly.
Proposed fix
Populate the associated text field (third
;section in the CSI u sequence)in
try_encode_csi_uwhen the pane hasREPORT_ASSOCIATED_TEXTset and theevent is a press or repeat. The field carries the Unicode scalar value of the
character that would actually be inserted.
With the fix,
Shift+Abecomes:Textual then produces:
And
Shift+1(withshifted_codepoint=Some('!')) becomes:The change is purely additive: panes that did not request
REPORT_ASSOCIATED_TEXTsee no change to their sequences.
Diff
fix: preserve kitty associated text (#2051)
kangal-bot commentedon Jul 30, 2026
Implemented on master and queued for the next release. This is not available in a published Herdr release yet.
fix: preserve kitty associated text (herdrdev#2051)
kangal-bot commentedon Aug 3, 2026
Released in v0.8.0.
feat: adopt upstream herdr v0.8.0 and reconcile fork sidebar rendering (
fix: preserve kitty associated text (herdrdev#2051)
chore: sync upstream herdrdev/herdr 3825c0c (#32)
Integrate/upstream v0.8.0 (#1)
docs: document stacked panes wherever splitting is documented
fix: make the pane menu's stack action work, and stop calling it a split
refactor: delete the cfg(test) context menu dispatch mirror
rename: keys.split_stacked becomes keys.stack_pane
fix: preserve kitty associated text (herdrdev#2051)