Skip to content

fix(attach): re-arm the left-arrow quick detach when the draft is deleted#26

Merged
aksOps merged 1 commit into
mainfrom
fix/attach-back-detach-rearm
Jun 11, 2026
Merged

fix(attach): re-arm the left-arrow quick detach when the draft is deleted#26
aksOps merged 1 commit into
mainfrom
fix/attach-back-detach-rearm

Conversation

@aksOps

@aksOps aksOps commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Problem

The bare-left-arrow quick detach worked only if you had typed nothing at all: the input-box heuristic was a one-way boolean — any printable set "non-empty", and backspace never unset it (worse: DEL 0x7f satisfied the b >= 0x20 "printable" check and itself counted as typing). Only Enter/Esc/Ctrl+C/Ctrl+U re-armed, so type-then-delete left ← moving the cursor instead of detaching.

Fix

Track the box with a rune counter + unknown latch:

  • Printables increment one per rune (UTF-8 continuation bytes don't count); backspace (DEL and Ctrl+H) decrements with a floor at zero; zero re-arms — deleting your whole draft behaves like never having typed.
  • Untrackable input (tab completion, history/menu navigation, literal Ctrl+B) latches unknown, where only submit/clear re-arms — the old conservatism kept exactly where the box may genuinely hold unseen text, so ← can never falsely detach out of a non-empty draft.

Test plan

6 new filter tests (type+delete re-arms, partial delete stays disarmed, over-delete floor, multibyte rune = one backspace, Ctrl+H, tab poisons until clear); all 20 filter tests green; full suite + -race green.

…eted

The quick-detach heuristic tracked the agent's input box with a one-way
boolean: any printable marked it non-empty and only Enter/Esc/Ctrl+C/
Ctrl+U reset it - backspace never did (worse, DEL is 0x7f, which the
b >= 0x20 check itself counted as typing). Typing something and deleting
it left the bare left arrow moving the cursor instead of detaching.

Track the box with a rune counter plus an unknown latch: printables
increment (one per rune - UTF-8 continuation bytes don't count),
backspace (DEL and Ctrl+H) decrements with a floor at zero, and a count
of zero re-arms the quick detach. Input whose effect can't be counted -
tab completion, history/menu navigation, a literal prefix byte - latches
unknown, where only a submit/clear re-arms, preserving the old
conservatism exactly where the box really may hold unseen text.
@sonarqubecloud

Copy link
Copy Markdown

@aksOps aksOps merged commit adf21ad into main Jun 11, 2026
13 checks passed
@aksOps aksOps deleted the fix/attach-back-detach-rearm branch June 11, 2026 08:03
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.

1 participant