macos: undo new window

pull/7535/head
Mitchell Hashimoto 2025-06-06 15:50:30 -07:00
parent 33d128bcff
commit 797c10af37
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 21 additions and 0 deletions

View File

@ -205,6 +205,27 @@ class TerminalController: BaseTerminalController {
c.showWindow(self)
}
// Setup our undo
if let undoManager = c.undoManager {
undoManager.setActionName("New Window")
undoManager.registerUndo(
withTarget: c,
expiresAfter: c.undoExpiration) { target in
// Close the window when undoing
target.closeWindow(nil)
// Register redo action
undoManager.registerUndo(
withTarget: ghostty,
expiresAfter: target.undoExpiration) { ghostty in
_ = TerminalController.newWindow(
ghostty,
withBaseConfig: baseConfig,
withParent: explicitParent)
}
}
}
return c
}