Repository navigation
fix(shortcuts): let a draft in the message box give the pane shortcut back - #2034
Conversation
… back A pane switch focuses the next pane's message box. When that box held text, keepsKeyForText gave Mod+Shift+Up/Down to the field for as long as the text stayed, so the shortcut stopped on that pane in both directions. The field now keeps an arrow, Home or End only while the selection's moving end can still go that way. At the start (Up, Left, Home) or the end (Down, Right, End) the binding runs. The chord still selects text in a draft, and a switch from a draft costs at most one extra press. Fixes devswha#2033 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AvoYu8q8KdoRWFTNe7tq6B
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Selection-boundary shortcut handling src/lib/shortcuts.ts |
KeyTargetLike now includes selection positions and direction. keepsKeyForText checks whether navigation can still move or extend the selection. |
Draft shortcut regression coverage src/lib/shortcuts.test.ts, scripts/ui-regression.ts, changelog.d/pane-shortcut-draft.md |
Unit and UI regression checks cover draft selection and pane switching at a text boundary. The changelog describes the behavior. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: devswha
Merge Risk: 
Minimal · up to e56eb
-
The draft-aware pane shortcut change appears ready to merge after normal checks; no actionable issue is established.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Check name Status Explanation Title check The title clearly and concisely describes the primary change: allowing a draft in the message box to release the pane-switch shortcut. Linked Issues check Issue #2033asks that ⌘⇧↑/↓ (Ctrl+Shift elsewhere) not stay stuck on a pane whose message box holds text. The proposed fix keeps the text-field rule but lets the binding run when the selection's movin…Out of Scope Changes check The whole-PR diff (merge base 484dd25 to head e56eb3e) touches four files. src/lib/shortcuts.ts contains the requirement fix: the KeyTargetLike selection fields and the boundary logic in keepsKeyFor… Description check The description follows the template with both required sections, Change and Validation. The Change section states the problem, the resulting behavior, and the linked issue ( #2033). The Validation sec…Full details: Linked Issues check
-
Explanation
Issue
#2033asks that ⌘⇧↑/↓ (Ctrl+Shift elsewhere) not stay stuck on a pane whose message box holds text. The proposed fix keeps the text-field rule but lets the binding run when the selection's moving end is at the boundary for that key. The change to keepsKeyForText in src/lib/shortcuts.ts implements this. For ↑, ←, Home it keeps the key only when the moving end is > 0. For ↓, →, End it keeps the key only when the moving end is < value.length. The moving end is selectionStart for a backward selection and selectionEnd otherwise. Fields without numeric selection positions (email, number, contenteditable) keep the prior rule, as the issue's 'empty field' extension requires. The unit tests in src/lib/shortcuts.test.ts cover caret at the end (↓ false, ↑ true), a backward selection from 0 (↑ false, ↓ true), a forward selection from 0 (↑ true, ↓ false) and a caret inside the text (both true). I checked these expectations against the implementation and they match. The PR's headless Playwright run reports the runtime pane switch. I did not inspect the caller in src/App.tsx; the runtime claim rests on the PR's reported run. The two related findings (zoomed tab, Agents-list ordering) are listed in the issue as not changed by this PR, so they are not requirements here.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR diff (merge base 484dd25 to head e56eb3e) touches four files. src/lib/shortcuts.ts contains the requirement fix: the KeyTargetLike selection fields and the boundary logic in keepsKeyForText. src/lib/shortcuts.test.ts holds unit tests for that logic. scripts/ui-regression.ts changes the pane-shortcut regression to cover the draft step, which is a supporting test. changelog.d/pane-shortcut-draft.md adds a changelog entry, which is documentation. All four connect directly to issue
#2033. The PR does not change the zoomed-tab redirect or the Agents-list pane order, as the issue requests. The reported unit-test failures and the 'explicit Send now' timeout occur on unchanged main per the PR, so they are not caused by these changes. I could not read the full diff of the test file through the diff operation (changed blobs unavailable), but read the head file directly and checked its new cases against the code.
Full details: Description check
-
Explanation
The description follows the template with both required sections, Change and Validation. The Change section states the problem, the resulting behavior, and the linked issue (
#2033). The Validation section lists the tests run and their results, including failures the author says also occur on unchanged main. The template does not require a contract-test note, and this PR does not touch HTTP or WS code, so none is needed. Minor gap: the description does not restate the scope of the test-failure list in a way that a reviewer can verify without rerunning the checks, but that does not make the description incomplete.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Verified at e56eb3e, rebased locally onto current main without conflicts.
No findings. Thanks, @jpcarranza94. |
|
Thanks @jpcarranza94. The merge-pass gate confirmed the default draft navigation works and the unit suite passes on top of main (7424/0), and the new test fails without the change. One behaviour change goes beyond the intent:
(No changelog credit is needed in the fragment. A maintainer adds it at release.) |
A binding other than Previous/Next pane on an arrow, Home or End (for example the command palette on Mod+Shift+Home) kept main's rule again: it stays with a message box that has text, at the edge too. The exact-modifiers regression puts the caret at the start for its End check, because Next pane on End now runs at the end of a draft. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AvoYu8q8KdoRWFTNe7tq6B
|
Thanks. Fixed in c439927: only Previous/Next pane let go at a draft's edge now. Any other binding on an arrow, Home or End keeps main's rule and stays with a field that has text.
|
|
Merge pass review report. Overall: PASSED. This outside contribution from @jpcarranza94 lets a draft in the message box give the pane-step shortcuts back at the draft's edge. The maintainer approved the merge, and the gate (omo-native-gate-reviewer, gpt-6-astra) passed it. First gate round (REJECT): the edge release also applied to customised non-navigation shortcuts. With the palette bound to Mod+Shift+Home, the chord opened the palette at the start of a non-empty draft. Fix c439927, re-reviewed on that range only (APPROVE):
A maintainer adds the changelog credit when the release folds the fragments (changelog.d/README.md). |
## Release 0.4.19 The release PR, made by the steps in [docs/development.md#releasing](docs/development.md#releasing), on main 9d76cca (#2078): - **Version:** `version` is 0.4.19 in `package.json` and `herdr-plugin.toml`. - **Changelog:** `bun scripts/changelog-fold.ts 0.4.19` moved the `changelog.d` fragments of 54 PRs into CHANGELOG.md, with PR links, and deleted them. - Outside contributors are credited: #1955 @YuuuXie, #1957 @Noobear, #1984 @bonecool999, #2003 @philipprass-prog, #2016 @kyop21, #2024 @YuuuXie, #2025 @YuuuXie, #2027 @jpcarranza94, #2030 @phlips5437, #2031 @yaaayaaa, #2034 @jpcarranza94, #2035 @nahwan-kim, #2041 @odfalik, #2045 @mattmarcin, #2052 @jpcarranza94, #2057 @kyop21, #2061 @YuuuXie. - **Release summaries:** `release-summaries.json` has the 0.4.19 entry in en, ko, ja and zh, with the same lists in each: 5 new, 5 improved, 5 fixed. Every English line is at most 70 characters. - **Remote bundle:** `REMOTE_BUNDLE_VERSION` goes from 37 to 38 in `shared/machines.ts`, because the remote bundle's inputs changed since `remote-v37`. Once this merges, `remote-v38` is pushed on the merge commit, and the Remote PC bundles workflow has to finish before the Release run. `bun scripts/release-guards.ts` reports: "Release 0.4.19: remote bundle, telemetry Worker and release metadata are in order." No telemetry Worker deploy is needed. `bun run check fast` passes locally. **Not checked on a real Windows PC:** #1989 (Git for Windows' OpenSSH for remote PCs) and #2016 (Antigravity chat on Windows through the Restart Manager) ship without their real-device Windows checks, because the maintainer's Windows test PC is off. The owner accepted releasing without them. Both will be checked on the real PC when it is back. The owner approved this release.
Change
Fixes #2033.
A pane switch focuses the next pane's message box. When that box held text (an unsent draft, or the send Claude puts back in its input box),
keepsKeyForTextgave ⌘⇧↑/↓ (Ctrl+Shift on Windows and Linux) to the field for as long as the text stayed. The pane shortcut then stopped on that pane in both directions.keepsKeyForTextnow lets a text field keep a Previous/Next pane chord on an arrow, Home or End only while the selection's moving end can still go that way. At the start (↑, ←, Home) or at the end (↓, →, End), the key has nothing left to do in the field, and the pane step runs. This extends the existing rule that an empty field lets the chord go. Any other binding on those keys (for example the command palette on Mod+Shift+Home) keeps main's rule: it stays with a field that has text. The chord still selects text in a draft:A field without a text selection API (email, number, contenteditable) keeps the old rule.
Design: Warp and Zed move between tabs with chords that select no text (⌘⇧[ / ⌘⇧]), so they never meet this conflict. Ovis's default chord does select text, so this keeps Ovis's own rule and only ends it where the key cannot select more.
The issue also lists two related findings that this PR does not change: a zoomed tab that sends the step back to its zoomed pane, and the shortcut that walks panes the Agents list does not show.
Validation
bun test src/lib/shortcuts.test.ts: 33 pass. A new case covers the caret at each edge, a backward and a forward selection, and the caret inside the text. Another case binds the command palette to Mod+Shift+Home and checks that it stays with a draft whose caret is at the start, where Previous pane goes.scripts/shortcut-exact-modifiers-demo-regression.ts:PASS exact shortcuts: .... Its End check puts the caret at the start of the draft, because Next pane on End now runs at the end of a draft.scripts/ui-regression.ts: the draft step now presses ⌘⇧↑ once (the pane stays and the draft is selected,[0, 5]), then again (the pane switches). Run withbun run check run --build bun scripts/ui-regression.tson macOS:PASS pane shortcut from the empty message box; a draft keeps text selection until none is left that way. Later in the same script,explicit Send now delivered one itemtimes out. It times out the same way on unchangedorigin/mainon this Mac.holatyped in the message box: before, every ⌘⇧↓ left the same pane selected. After, ⌘⇧↓ switches at once, and ⌘⇧↑ selects the draft and then switches.bun run check fast: generated types, generated themes, typecheck and build pass. The unit test step fails only in files that also fail on unchangedmainon this headless Mac:scripts/check,scripts/ci-browser,scripts/install-star,scripts/self-hosted-runner,server/claude-store,server/session-history,server/remote-entry,server/agy,server/core/composer-framing,server/portalandserver/bridge(a loopback relay timeout, also onorigin/main).🤖 Generated with Claude Code
https://claude.ai/code/session_01AvoYu8q8KdoRWFTNe7tq6B