fix(attach): re-arm the left-arrow quick detach when the draft is deleted#26
Merged
Conversation
…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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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
0x7fsatisfied theb >= 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:
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 +
-racegreen.