Repository navigation
fix: separate key contexts for text entry and modals - #36
Conversation
44387fa to
2e0a691
Compare
IAmJSD
left a comment
There was a problem hiding this comment.
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.
fixes #35
replace the single
captures_keysflag with three mutually exclusive states:Workspace editable,Workspace text_entry,Workspace modal. document commands bind againstWorkspace && !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
Workspacepredicate 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.