Skip to content

Exit split zoom when jumping to unread - #1401

Merged
lawrencecchen merged 3 commits into
mainfrom
task-cmd-shift-u-exits-cmd-shift-enter-mode
Mar 14, 2026
Merged

lawrencecchen merged 3 commits into
mainfrom
task-cmd-shift-u-exits-cmd-shift-enter-mode

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Mar 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a regression test for jumping to an unread notification while split zoom is active
  • clear split zoom before notification focus moves to the unread target panel

Testing

  • xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux-unit -configuration Debug -destination 'platform=macOS' -derivedDataPath /tmp/cmux-cmd-shift-u-exit-zoom-unit build
  • ./scripts/reload.sh --tag cmd-shift-u-exit-zoom

Task

  • Plain-text request: "after cmd shift enter, behavior of cmd shift u is weird. ideally cmd shift u will exit out of cmd shift enter mode"

Summary by cubic

Cmd-Shift-U (jump to unread) now exits split zoom (Cmd-Shift-Enter) before focusing the target pane so the destination is visible. It also guards focus failures to avoid ending in a bad state.

  • Bug Fixes
    • Clear split zoom in TabManager.focusTabFromNotification, and make it return Bool; AppDelegate and TerminalController now guard and log focus failures.
    • Add regression tests for exiting split zoom and for missing panel returning false.

Written for commit 09a98c9. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes

    • Improved notification-driven tab focusing: lingering split/zoom display state is cleared so the correct panel is revealed, and failures to focus are detected and handled (caller shows an error or stops further processing; debug/test failures are recorded).
  • Tests

    • Added automated tests covering notification-triggered tab focus and missing-target-panel handling.

@vercel

vercel Bot commented Mar 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Mar 14, 2026 0:22am

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai

coderabbitai Bot commented Mar 13, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Notification-driven focus now returns success/failure: Tab resolution is eager, split-zoom is cleared before focus, and callers (AppDelegate, TerminalController) check the boolean result to handle failures (debug logging, test hooks, error reporting).

Changes

Cohort / File(s) Summary
TabManager method
Sources/TabManager.swift
focusTabFromNotification(_ tabId: UUID, surfaceId: UUID? = nil) -> Bool now returns Bool, resolves the target tab early, guards on missing tab/panel (debug logs + false), and calls tab.clearSplitZoom() before focusing the destination pane.
Callers that handle focus result
Sources/AppDelegate.swift, Sources/TerminalController.swift
Call sites now check the Bool return; on failure AppDelegate records multi-window notification open failures and optionally writes UI-test jump-unread data (DEBUG/test env), TerminalController surfaces an "ERROR: Focus failed" message instead of assuming success.
Tests
cmuxTests/CmuxWebViewKeyEquivalentTests.swift
Adds TabManagerNotificationFocusTests with tests verifying split-zoom is cleared before focusing a notified tab and that a missing panel surfaceId causes the method to return false. (Duplicate insertion appears in the diff.)

Sequence Diagram(s)

sequenceDiagram
    participant NotificationCenter
    participant AppDelegate
    participant TabManager
    participant Tab
    participant Panel
    Note over NotificationCenter,AppDelegate: Notification opened / user action
    NotificationCenter->>AppDelegate: deliverNotification(tabId, surfaceId?)
    AppDelegate->>TabManager: focusTabFromNotification(tabId, surfaceId)
    TabManager->>TabManager: resolve tab by id
    alt tab not found or panel missing
        TabManager-->>AppDelegate: return false
        AppDelegate->>AppDelegate: record failure (DEBUG) / write test data (if env)
    else tab found
        TabManager->>Tab: clearSplitZoom()
        TabManager->>Panel: focus(panelId)
        TabManager-->>AppDelegate: return true
        AppDelegate->>NotificationCenter: mark notification read / follow-up actions
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped to the tab when a bell gave a ring,
Cleared split-zoom first before doing the thing,
If no pane to find, I call out "no go",
Else I nudge the focus and let the panels show —
A tiny rabbit clap for the clean, steady flow!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main change: clearing split zoom when jumping to unread notifications.
Description check ✅ Passed The description covers the required template sections (Summary, Testing) with appropriate detail; however, missing Demo Video URL and incomplete checklist items.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task-cmd-shift-u-exits-cmd-shift-enter-mode
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Sources/TabManager.swift`:
- Line 2208: The guard in focusTabFromNotification is silently returning when it
can't find the tab, which lets callers like openNotificationInContext proceed to
mark notifications read incorrectly; change focusTabFromNotification to return a
Bool (true on success, false on failure), replace the silent guard (guard let
tab = ...) with a logged failure and return false, update the rest of the
function to return true on successful focus, and modify the caller
openNotificationInContext to check the Bool result and only mark notifications
as read when focusTabFromNotification returns true.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1a90d6ce-7fad-46b1-afd4-46914226c24f

📥 Commits

Reviewing files that changed from the base of the PR and between 6a92010 and 0285444.

📒 Files selected for processing (2)
  • Sources/TabManager.swift
  • cmuxTests/CmuxWebViewKeyEquivalentTests.swift

Comment thread Sources/TabManager.swift Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

@lawrencecchen
lawrencecchen merged commit 5dd93a8 into main Mar 14, 2026
8 of 12 checks passed
@lawrencecchen
lawrencecchen deleted the task-cmd-shift-u-exits-cmd-shift-enter-mode branch March 14, 2026 00:28
bn-l pushed a commit to bn-l/cmux that referenced this pull request Apr 3, 2026
…-exits-cmd-shift-enter-mode

Exit split zoom when jumping to unread

This branch was successfully deployed

1 active deployment
Preview — 09a98c91 Deployed Mar 14, 2026 by vercel[bot]
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.

1 participant