Skip to content

Handle empty tab bar double clicks#31

Merged
lawrencecchen merged 3 commits intomainfrom
task-empty-tab-bar-double-click-new-tab
Mar 17, 2026
Merged

Handle empty tab bar double clicks#31
lawrencecchen merged 3 commits intomainfrom
task-empty-tab-bar-double-click-new-tab

Conversation

@lawrencecchen
Copy link

@lawrencecchen lawrencecchen commented Mar 17, 2026

Summary

  • add a regression test for double-clicking empty trailing tab-bar space
  • request a new terminal tab when the empty Bonsplit tab bar is double-clicked

Testing

  • swift test

Summary by cubic

Double-clicking empty space in the tab bar now opens a new Terminal tab, without consuming unrelated double-clicks. Adds a regression test to lock this behavior in.

  • New Features
    • Detects double-clicks on empty trailing tab-bar space and triggers requestNewTab(kind: "terminal", inPane:) when interactive; unhandled events pass through.
    • Adds EmptyTabBarDoubleClickMonitorView using a local event monitor.

Written for commit f6d6ab7. Summary will update on new commits.

Summary by CodeRabbit

  • New Features
    • Double-click in empty areas of the tab bar (trailing empty space and end drop zone) to quickly create a new terminal tab.
  • Tests
    • Added automated test coverage verifying double-clicking empty tab-bar areas requests a new terminal tab.

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Copy link

@greptile-apps greptile-apps bot left a comment

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
Copy link

coderabbitai bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: be7345b0-6c79-4861-8ec4-3aad05b40c84

📥 Commits

Reviewing files that changed from the base of the PR and between 5822853 and f6d6ab7.

📒 Files selected for processing (1)
  • Sources/Bonsplit/Internal/Views/TabBarView.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • Sources/Bonsplit/Internal/Views/TabBarView.swift

📝 Walkthrough

Walkthrough

Adds double-click detection to empty trailing/tab-end areas of the tab bar using a new NSViewRepresentable, which invokes the controller to request a new terminal tab when those areas are double-clicked; includes unit test coverage that simulates the double-click and verifies the request.

Changes

Cohort / File(s) Summary
Tab bar view & double-click monitor
Sources/Bonsplit/Internal/Views/TabBarView.swift
Adds EmptyTabBarDoubleClickMonitorView NSViewRepresentable and integrates it into trailing empty-tab regions and end drop-zone to invoke controller.requestNewTab(kind: "terminal", inPane: pane.id) on double-click; preserves existing drop/tab-drop handling.
Tests — double-click behavior
Tests/BonsplitTests/BonsplitTests.swift
Adds NewTabRequestDelegateSpy, a test testDoubleClickingEmptyTrailingTabBarSpaceRequestsNewTerminalTab, and makeLeftMouseDownEvent helper to synthesize mouse events and assert the new-tab request with correct kind and pane id.

Sequence Diagram(s)

sequenceDiagram
  participant User as "User (double-click)"
  participant View as "EmptyTabBarDoubleClickMonitorView"
  participant Controller as "BonsplitController"
  participant Pane as "Pane (target)"

  User->>View: double-click in trailing empty area
  View->>Controller: requestNewTab(kind: "terminal", inPane: pane.id)
  Controller->>Pane: create new terminal tab
  Controller-->>View: confirm/new tab created
  View-->>User: UI updates show new tab
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I tapped the empty space twice,
A terminal sprung — oh so nice.
From silence, tabs begin to play,
New shells hop in without delay.
Quick paws, quick clicks, a bunny's praise.

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Handle empty tab bar double clicks' is directly aligned with the main change: adding detection and handling of double-clicks in empty tab bar areas to request new terminal tabs.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task-empty-tab-bar-double-click-new-tab
📝 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.

Copy link

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

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

Copy link

@coderabbitai coderabbitai bot left a comment

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/Bonsplit/Internal/Views/TabBarView.swift`:
- Around line 607-617: The monitor currently always returns nil after calling
coordinator.onDoubleClick, consuming the event even when the handler can't
decline; change the onDoubleClick callback to return a Bool (e.g.,
onDoubleClick: () -> Bool) and update the monitor in coordinator.monitor to call
coordinator.onDoubleClick?() and only return nil (consume) when that call
returns true, otherwise return the original event; also update all places that
set/implement coordinator.onDoubleClick to return a Bool so non-interactive
monitors don't swallow double-clicks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 19a63581-4adb-4ad6-8988-80fdc2e29088

📥 Commits

Reviewing files that changed from the base of the PR and between d696f82 and 5822853.

📒 Files selected for processing (2)
  • Sources/Bonsplit/Internal/Views/TabBarView.swift
  • Tests/BonsplitTests/BonsplitTests.swift

@lawrencecchen lawrencecchen merged commit efa23f4 into main Mar 17, 2026
3 checks passed
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