mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-05 19:08:17 +00:00
macos: undo new tab
This commit is contained in:
@@ -309,6 +309,27 @@ class TerminalController: BaseTerminalController {
|
||||
controller.relabelTabs()
|
||||
}
|
||||
|
||||
// Setup our undo
|
||||
if let undoManager = parentController.undoManager {
|
||||
undoManager.setActionName("New Tab")
|
||||
undoManager.registerUndo(
|
||||
withTarget: controller,
|
||||
expiresAfter: controller.undoExpiration) { target in
|
||||
// Close the tab when undoing
|
||||
target.closeTab(nil)
|
||||
|
||||
// Register redo action
|
||||
undoManager.registerUndo(
|
||||
withTarget: ghostty,
|
||||
expiresAfter: target.undoExpiration) { ghostty in
|
||||
_ = TerminalController.newTab(
|
||||
ghostty,
|
||||
from: parent,
|
||||
withBaseConfig: baseConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return controller
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user