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 } guard let window = self.window else { return true }
// If we have no surfaces, close. // 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 // If we already have an alert, continue with it
guard alert == nil else { return false } guard alert == nil else { return false }
// If our surfaces don't require confirmation, close. // 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. // We require confirmation, so show an alert as long as we aren't already.
confirmClose( confirmClose(

View File

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

View File

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