macos: use surfaceTree2 needsConfirmQuit

pull/7523/head
Mitchell Hashimoto 2025-06-04 09:47:55 -07:00
parent aef61661a0
commit a389926ca7
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
3 changed files with 5 additions and 5 deletions

View File

@ -668,13 +668,13 @@ class BaseTerminalController: NSWindowController,
guard let window = self.window else { return true }
// If we have no surfaces, close.
guard let node = self.surfaceTree else { return true }
if surfaceTree2.isEmpty { return true }
// If we already have an alert, continue with it
guard alert == nil else { return false }
// If our surfaces don't require confirmation, close.
if (!node.needsConfirmQuit()) { return true }
if !surfaceTree2.contains(where: { $0.needsConfirmQuit }) { return true }
// We require confirmation, so show an alert as long as we aren't already.
confirmClose(

View File

@ -595,7 +595,7 @@ class TerminalController: BaseTerminalController {
return
}
if surfaceTree?.needsConfirmQuit() ?? false {
if surfaceTree2.contains(where: { $0.needsConfirmQuit }) {
confirmClose(
messageText: "Close Tab?",
informativeText: "The terminal still has a running process. If you close the tab the process will be killed."
@ -632,7 +632,7 @@ class TerminalController: BaseTerminalController {
guard let controller = tabWindow.windowController as? TerminalController else {
return false
}
return controller.surfaceTree?.needsConfirmQuit() ?? false
return controller.surfaceTree2.contains(where: { $0.needsConfirmQuit })
}
// If none need confirmation then we can just close all the windows.

View File

@ -269,7 +269,7 @@ class TerminalManager {
func closeAllWindows() {
var needsConfirm: Bool = false
for w in self.windows {
if (w.controller.surfaceTree?.needsConfirmQuit() ?? false) {
if w.controller.surfaceTree2.contains(where: { $0.needsConfirmQuit }) {
needsConfirm = true
break
}