macos: if alert is already showing, don't check if need confirm

This commit is contained in:
Mitchell Hashimoto
2023-10-31 09:41:40 -07:00
parent 6a024897a6
commit 60e1ca81f0

View File

@ -114,11 +114,13 @@ class TerminalController: NSWindowController, NSWindowDelegate, TerminalViewDele
// If we have no surfaces, close.
guard let node = self.surfaceTree else { 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 }
// We require confirmation, so show an alert as long as we aren't already.
if (alert == nil) {
let alert = NSAlert()
alert.messageText = "Close Terminal?"
alert.informativeText = "The terminal still has a running process. If you close the " +
@ -138,7 +140,6 @@ class TerminalController: NSWindowController, NSWindowDelegate, TerminalViewDele
})
self.alert = alert
}
return false
}