Skip to content

fix: parse SS3 cursor key sequences in read_key#283

Open
lovesegfault wants to merge 1 commit intoconsole-rs:mainfrom
lovesegfault:fix-decckm
Open

fix: parse SS3 cursor key sequences in read_key#283
lovesegfault wants to merge 1 commit intoconsole-rs:mainfrom
lovesegfault:fix-decckm

Conversation

@lovesegfault
Copy link
Copy Markdown

Terminals in application cursor key mode (DECCKM) send SS3 sequences
(ESC O A..F) instead of CSI (ESC [ A..F) for arrow/Home/End keys.
zsh's line editor enables this mode via smkx and doesn't always reset
it before running external commands, so programs using read_key() see
arrows as UnknownEscSeq(['O']) with the trailing letter left unread.

Add an ESC O branch mirroring the ESC [ branch for A/B/C/D/H/F.

c.f.

Terminals in application cursor key mode (DECCKM) send SS3 sequences
(ESC O A..F) instead of CSI (ESC [ A..F) for arrow/Home/End keys.
zsh's line editor enables this mode via smkx and doesn't always reset
it before running external commands, so programs using read_key() see
arrows as UnknownEscSeq(['O']) with the trailing letter left unread.

Add an ESC O branch mirroring the ESC [ branch for A/B/C/D/H/F.

c.f.
- https://vt100.net/docs/vt510-rm/DECCKM.html
- https://www.zsh.org/mla/users/2016/msg00133.html
- cli/cli#3071
- PowerShell/PowerShell#12268
- gui-cs/Terminal.Gui#418
lovesegfault added a commit to lovesegfault/rio-build that referenced this pull request Mar 26, 2026
Replaces the hand-rolled ui::confirm with inquire and adds interactive
fallbacks when required args are missing on a TTY. Scripts/CI keep the
same errors — prompts only fire when stdin is a terminal.

- Theme: ▸/✓/✗ glyphs, cyan/green/red matching indicatif, set once
  globally via set_global_render_config in ui::init
- Prompt helpers: confirm, confirm_destroy (red ⚠), select, text —
  all suspend()-wrapped, TTY-gated, ESC→cancel/false
- Fallbacks wired: k8s provider select, fuzz target picker,
  new-migration name (snake_case validator), k8s rollback picker
  (helm history -o json enriched with chart+image tag+friendly age)
- k8s destroy: own ⚠ confirm with cluster name, tofu -auto-approve
- DECCKM workaround: emit rmkx before prompts so arrows send CSI
  instead of SS3 — inquire's console backend can't parse SS3.
  Remove once console-rs/console#283 lands.
- Deps: +inquire 0.9 (console backend), +jiff direct (friendly
  SpanPrinter for rollback ages), +bytesize (available for sizes)
@djc
Copy link
Copy Markdown
Member

djc commented Mar 30, 2026

Thanks!

I'm going to merge

first, not sure if that has impact on the changes here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants