Skip to content

fix: separate key contexts for text entry and modals - #36

Merged
IAmJSD merged 1 commit into
Infrawrench:mainfrom
ProdigyRahul:fix/key-context-text-entry
Aug 27, 2026
Merged

IAmJSD merged 1 commit into
Infrawrench:mainfrom
ProdigyRahul:fix/key-context-text-entry

Conversation

@ProdigyRahul

Copy link
Copy Markdown
Contributor

fixes #35

replace the single captures_keys flag with three mutually exclusive states: Workspace editable, Workspace text_entry, Workspace modal. document commands bind against Workspace && !text_entry && !modal, so they simply do not match while typing or under a dialog and the keystroke reaches the text.

adding a token while leaving the commands on the broad Workspace predicate would have changed nothing, since that predicate matches in every state. the exclusion has to be in the binding.

escape moves to its own always-on context. it is the way out of both a text session and a dialog, so suppressing it would trap the user.

four tests evaluate the real predicates against each state, including the reported case. the first fails on main with ctrl+a must reach the text.

verified by hand in a running window: ctrl+a reaches the text instead of running the canvas select all, escape still leaves a text session and a dialog, and the single-letter tool shortcuts still switch tools.

before

after

@ProdigyRahul
ProdigyRahul force-pushed the fix/key-context-text-entry branch from 44387fa to 2e0a691 Compare August 26, 2026 12:27

@IAmJSD IAmJSD left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by Claude (Fable 5) on Astrid's behalf. Verified the three-state key-context model against the pinned gpui fork's dispatch order (bindings match before key listeners get the event), traced escape/enter/letter routing in all three states, and confirmed the tests exercise the real predicate eval path — the first genuinely fails against main's old context. I rebased the branch onto main to resolve a textual conflict with #44/#47's adjacent hunks (no semantic changes) and re-ran the app + type-tool tests. Two non-blocking follow-ups: the type tool's "let shortcuts through" comment is now misleading (ctrl-modified keys during a text session are silent no-ops — worth surfacing ctrl+s at least), and the three context strings are duplicated between workspace.rs and the keymap tests, so a rename would pass tests while breaking the app. Merging.

@IAmJSD
IAmJSD merged commit 08205d2 into Infrawrench:main Aug 27, 2026
3 checks passed
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.

ctrl+a and every other shortcut fire while editing text or with a dialog open

2 participants