Repository navigation
win32: confirm tab-strip closes and support middle-click - #20
Open
alihandroid wants to merge 1 commit into
Open
alihandroid wants to merge 1 commit into
alihandroid wants to merge 1 commit into
Conversation
Close tabs from the strip with a middle-button press without selecting an inactive tab first. Route both middle-click and the existing X button through the split-aware confirmation path used by the overview. Rename the shared request method to reflect its wider use, preserving stable surface identity across modal confirmation. Cover confirmation, split processes, inactive-tab identity, and modal-time exits with native HWND-scoped integration checks.
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
Add middle-click tab closing to Windows, matching the interaction already available in Ghostty's native macOS tabs and GTK tab bar. This lets users close a tab without selecting it or targeting its smaller X button.
The new gesture and the existing X button use the same split-aware confirmation path as Tab Overview. Previously, the strip's X button called
closeTabByIndexdirectly and bypassed that protection. This PR adds the missing gesture and makes both strip close actions honorconfirm-close-surface.Behavior
confirm-close-surface. If any split requires confirmation, show one dialog for the whole tab; Cancel preserves all its sessions.Implementation
Ghostty's macOS and GTK frontends get the gesture from their native tab widgets; the custom Win32 strip needs an explicit mouse handler. The overview and both strip gestures now share
requestCloseTab, renamed fromrequestCloseOverviewTab. After confirmation, it re-resolves the target by surface ID so a process exit during the dialog cannot close a different tab.Middle-click closes on button-down; release and double-click messages do not close another tab. Tab removal and active-tab selection retain their existing behavior.
Verification
test_tab_bar.ps1 -Case all: 67 checks passed across 29 app runs, covering the existing opaque, transparent, and light cases plus the new closing scenarios.test_tab_overview.ps1: 12 checks passed.tab overviewpassed; Zig formatting passed.Regression coverage includes an idle focused split with a running non-focused split, process exits during confirmation, final-tab shutdown, and double-click sequencing. Tests use PID-validated HWNDs without desktop-global input.