mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-12-31 18:52:12 +00:00
macos: fix bugs
This commit is contained in:
@@ -734,7 +734,9 @@ class BaseTerminalController: NSWindowController,
|
||||
// it is already a single split.
|
||||
guard surfaceTree.isSplit else { return }
|
||||
|
||||
// If we are removing our focused surface then we move it.
|
||||
// If we are removing our focused surface then we move it. We need to
|
||||
// keep track of our old one so undo sends focus back to the right place.
|
||||
let oldFocusedSurface = focusedSurface
|
||||
if focusedSurface == target {
|
||||
focusedSurface = findNextFocusTargetAfterClosing(node: targetNode)
|
||||
}
|
||||
@@ -752,11 +754,12 @@ class BaseTerminalController: NSWindowController,
|
||||
undoManager?.endUndoGrouping()
|
||||
}
|
||||
|
||||
replaceSurfaceTree(removedTree, moveFocusFrom: focusedSurface)
|
||||
replaceSurfaceTree(removedTree, moveFocusFrom: oldFocusedSurface)
|
||||
_ = TerminalController.newWindow(
|
||||
ghostty,
|
||||
tree: newTree,
|
||||
position: notification.userInfo?[Notification.Name.ghosttySurfaceDragEndedNoTargetPointKey] as? NSPoint)
|
||||
position: notification.userInfo?[Notification.Name.ghosttySurfaceDragEndedNoTargetPointKey] as? NSPoint,
|
||||
confirmUndo: false)
|
||||
}
|
||||
|
||||
// MARK: Local Events
|
||||
|
||||
@@ -285,7 +285,8 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr
|
||||
static func newWindow(
|
||||
_ ghostty: Ghostty.App,
|
||||
tree: SplitTree<Ghostty.SurfaceView>,
|
||||
position: NSPoint? = nil
|
||||
position: NSPoint? = nil,
|
||||
confirmUndo: Bool = true,
|
||||
) -> TerminalController {
|
||||
let c = TerminalController.init(ghostty, withSurfaceTree: tree)
|
||||
|
||||
@@ -321,7 +322,11 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr
|
||||
expiresAfter: c.undoExpiration
|
||||
) { target in
|
||||
undoManager.disableUndoRegistration {
|
||||
target.closeWindow(nil)
|
||||
if confirmUndo {
|
||||
target.closeWindow(nil)
|
||||
} else {
|
||||
target.closeWindowImmediately()
|
||||
}
|
||||
}
|
||||
|
||||
undoManager.registerUndo(
|
||||
|
||||
Reference in New Issue
Block a user