Repository navigation
fix(ui): route text typed with Tab into the file filter - #1221
Open
ShryukGrandhi wants to merge 1 commit into
Open
ShryukGrandhi wants to merge 1 commit into
ShryukGrandhi wants to merge 1 commit into
Conversation
Tab opens the filter prompt synchronously, but keyboard routing only treated keys as filter text once a render observed the filter focus. Printable keys in the same input chunk as Tab therefore ran global shortcuts (`t` opened the theme selector) and never reached the filter. Ask the status-line store whether the filter prompt is open, and append printable keys to the prompt value until the input mounts with it. Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
Contributor
|
PR author is not in the allowed authors list. |
|
@ShryukGrandhi is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Summary
When Tab (focus the filter) and the next characters arrive in the same input chunk — a paste, a fast typist on a slow or remote terminal, or a coalesced PTY write — the characters ran as global shortcuts instead of going into the filter. Writing
"\tbeta"to the PTY opened the theme selector (t) and left the filter focused but empty.Tab opens the filter prompt in the status-line store synchronously, but
useAppKeyboardShortcutsonly treated keys as filter text once a render had refreshedfocusAreaRefto"filter". Until then, every key in the chunk fell through to command dispatch.Fixes #1082
Changes
AppexposesisFilterPromptOpen(), which reads the status-line store live (the same conditionfocusAreais derived from), andqueueFilterInput(text), which appends to the open filter prompt's value throughupdatePromptValue.handleFocusedInputShortcutdecides filter ownership with that live check instead of the last-rendered focus area. Until the input has rendered, printable keys are appended to the prompt value and consumed. The input then mounts already holding that text, the filter applies through the prompt's existingonChange, and later typing continues after it. Tab still toggles back out on the same named command path.This stays in core: it is host keyboard routing for the built-in filter prompt.
Testing
AppHost.interactions.test.tsxcase: types"\ttzz"in oneactand expectsfilter: tzz, the no-match message, and no theme selector; typingxafterwards givesfilter: tzzx. It fails without the fix (the theme selector opens) and passes with it.test/pty/chrome.test.ts:session.writeRaw("\tbeta")afterensureKeyboardIsLive, waiting forfilter: betawithalpha.tshidden and no theme selector. It fails without the fix and passes with it.bun run typecheck,bun run lint,bun run format:checkandbun run deps:checkall pass.AppHost.interactions(83 tests),AppHost.search,AppHost.keybindings,AppHost.keyboard-modes,AppHost.status-line,AppHost.responsive,AppHost.watch,AppHost.file-views, plusui/hooks,ui/libandui/statusLine(739 tests).bun run testas a whole was not usable on this machine. The sharded run, alongside a concurrent typecheck, produced hundreds of blank-frame failures from load; the affected files pass when run alone.maintoo. Every PTY test that touches the filter, and every chrome test that failed in a full-file run, passes when run on its own. The one exception isPTY pager > the file filter keeps focus when pager results remount, which fails the same way on unmodifiedmainon this machine (waitForData timed out ... no data received from PTY).test:tty-smokewas not run because rendering is unchanged.