Skip to content

fix(shortcuts): let a draft in the message box give the pane shortcut back - #2034

Merged
devswha merged 2 commits into
devswha:mainfrom
jpcarranza94:fix/pane-shortcut-stuck
Oct 27, 2026
Merged

devswha merged 2 commits into
devswha:mainfrom
jpcarranza94:fix/pane-shortcut-stuck

Conversation

@jpcarranza94

@jpcarranza94 jpcarranza94 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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), keepsKeyForText gave ⌘⇧↑/↓ (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.

keepsKeyForText now 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:

  • caret at the end of a draft: ⌘⇧↓ switches panes at once; ⌘⇧↑ selects the draft, and the next ⌘⇧↑ switches panes;
  • caret inside the text: the first press selects to that edge, the next press switches panes.

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 with bun run check run --build bun scripts/ui-regression.ts on 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 item times out. It times out the same way on unchanged origin/main on this Mac.
  • Headless Playwright run on the demo app, with hola typed 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 unchanged main on 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/portal and server/bridge (a loopback relay timeout, also on origin/main).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AvoYu8q8KdoRWFTNe7tq6B

… 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
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: devswha/ovis
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 2ad63df
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0807214c-231e-406c-9021-ae2aee418579
Commits

Reviewing files that changed from the base of the PR and between 2ad63df and e56eb3e.

Files selected for processing: 4
  • changelog.d/pane-shortcut-draft.md
  • scripts/ui-regression.ts
  • src/lib/shortcuts.test.ts
  • src/lib/shortcuts.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Draft text can now be selected with arrow shortcuts before those shortcuts switch panes. Once the selection reaches the start or end of the text, the shortcuts switch panes as expected.

Pane-switch shortcuts now remain with a text field only while arrow, Home, or End can move or extend its selection. Unit and UI regression checks cover draft selection and switching after the selection reaches a boundary.

Changes: Draft-aware pane shortcuts

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: Normal

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed 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 Passed Issue #2033 asks 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 Passed 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 Passed 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 #2033 asks 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Verified at e56eb3e, rebased locally onto current main without conflicts.

  • bun test src/lib/shortcuts.test.ts: 32/32. Putting main's keepsKeyForText back makes the new caret-at-the-end case fail.
  • bun run check fast: exit 0, 7,430 pass / 0 fail / 24 skip.
  • scripts/ui-regression.ts: the new "pane shortcut from the empty message box; a draft keeps text selection until none is left that way" step passes. The script stops later at "Start uses the folder Browse is showing" because of a ~ vs absolute path on this host; unchanged main stops at the same assertion, so it is not from this PR.

No findings. Thanks, @jpcarranza94.

@devswha

devswha commented Oct 26, 2026

Copy link
Copy Markdown
Owner

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:

  • Other customised shortcuts change too (src/lib/shortcuts.ts:205-215). With the command palette bound to Mod+Shift+Home, that chord now opens the palette when the caret is at the start of a non-empty draft, whereas main keeps it in the field. Please limit the edge release to the pane navigation shortcuts, and add a test with a customised non-navigation chord at the draft edge.

(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
@jpcarranza94

Copy link
Copy Markdown
Contributor Author

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.

  • New unit case: the command palette bound to Mod+Shift+Home, caret at the start of a draft. matchShortcut returns palette, and keepsKeyForText keeps the key in the field. With previous-pane at the same edge, it lets the key go.
  • The second CI attempt failed in scripts/shortcut-exact-modifiers-demo-regression.ts: Next pane on End now runs at the end of a draft, and fill("draft") leaves the caret there. The check now puts the caret at the start first. It passes locally.

@devswha

devswha commented Oct 27, 2026

Copy link
Copy Markdown
Owner

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):

  • The edge release now applies only to the pane steps. A customised palette chord stays in the draft, as it does on main. Default pane navigation at the draft edge still works.
  • The new regression passes with the fix. It fails at shortcuts.test.ts:91 when only shortcuts.ts is reverted.
  • The changed browser demo and an independent native-textarea check also pass.
  • Merged locally with origin/main: typecheck passes, the 33 shortcut tests pass, and the unit suite passes with 7469 tests and 0 failures.

A maintainer adds the changelog credit when the release folds the fragments (changelog.d/README.md).

@devswha
devswha merged commit a8b02ab into devswha:main Oct 27, 2026
12 of 13 checks passed
@jpcarranza94
jpcarranza94 deleted the fix/pane-shortcut-stuck branch October 27, 2026 02:14
@devswha devswha mentioned this pull request Oct 27, 2026
devswha added a commit that referenced this pull request Oct 27, 2026
## 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.
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.

Pane shortcut (Mod+Shift+Up/Down) stops on a pane whose message box holds text

2 participants