macos: passthrough right mouse down event to TabTitleEditor if needed

This commit is contained in:
Lukas
2026-03-03 17:24:40 +01:00
parent 205c05d59d
commit 661470897e
3 changed files with 17 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ class TerminalWindow: NSWindow {
private var tabMenuObserver: NSObjectProtocol?
/// Handles inline tab title editing for this host window.
private lazy var tabTitleEditor = TabTitleEditor(
private(set) lazy var tabTitleEditor = TabTitleEditor(
hostWindow: self,
delegate: self
)

View File

@@ -90,6 +90,10 @@ class TitlebarTabsTahoeTerminalWindow: TransparentTitlebarTerminalWindow, NSTool
return
}
guard !tabTitleEditor.handleRightMouseDown(event) else {
return
}
let locationInTabBar = tabBarView.convert(event.locationInWindow, from: nil)
guard tabBarView.bounds.contains(locationInTabBar) else {
super.sendEvent(event)

View File

@@ -92,6 +92,18 @@ final class TabTitleEditor: NSObject, NSTextFieldDelegate {
return true
}
/// Handles rightMouseDown events from the host window.
///
/// If this returns true then the event was handled by the coordinator.
func handleRightMouseDown(_ event: NSEvent) -> Bool {
if isMouseEventWithinEditor(event) {
inlineTitleEditor?.rightMouseDown(with: event)
return true
} else {
return false
}
}
/// Begins editing the given target tab window title. Returns true if we're able to start the
/// inline edit.
@discardableResult