macos: more strict detection for tab context menu (#9888)

We were accidentally modifying the "View" menu.
pull/9891/head
Mitchell Hashimoto 2025-12-12 14:09:39 -08:00 committed by GitHub
commit 6dcf75126b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -708,8 +708,8 @@ extension TerminalWindow {
private func isTabContextMenu(_ menu: NSMenu) -> Bool {
guard NSApp.keyWindow === self else { return false }
// These are the target selectors, at least for macOS 26.
let tabContextSelectors: Set<String> = [
// These selectors must all exist for it to be a tab context menu.
let requiredSelectors: Set<String> = [
"performClose:",
"performCloseOtherTabs:",
"moveTabToNewWindow:",
@ -717,7 +717,7 @@ extension TerminalWindow {
]
let selectorNames = Set(menu.items.compactMap { $0.action }.map { NSStringFromSelector($0) })
return !selectorNames.isDisjoint(with: tabContextSelectors)
return requiredSelectors.isSubset(of: selectorNames)
}
private func appendTabModifierSection(to menu: NSMenu, target: TerminalController?) {