mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Improve split and tab navigation behavior
This commit is contained in:
@ -773,8 +773,20 @@ extension Ghostty {
|
|||||||
return
|
return
|
||||||
|
|
||||||
case GHOSTTY_TARGET_SURFACE:
|
case GHOSTTY_TARGET_SURFACE:
|
||||||
guard let surface = target.target.surface else { return }
|
guard let surface = target.target.surface,
|
||||||
guard let surfaceView = self.surfaceView(from: surface) else { return }
|
let surfaceView = self.surfaceView(from: surface),
|
||||||
|
let window = surfaceView.window,
|
||||||
|
let controller = window.windowController as? TerminalController,
|
||||||
|
let surfaceTree = controller.surfaceTree else { return }
|
||||||
|
|
||||||
|
if !surfaceTree.isViewInSplit(surfaceView) &&
|
||||||
|
(direction == GHOSTTY_GOTO_SPLIT_NEXT || direction == GHOSTTY_GOTO_SPLIT_PREVIOUS) {
|
||||||
|
let tabDirection: ghostty_action_goto_tab_e = direction == GHOSTTY_GOTO_SPLIT_NEXT ?
|
||||||
|
GHOSTTY_GOTO_TAB_NEXT : GHOSTTY_GOTO_TAB_PREVIOUS
|
||||||
|
gotoTab(app, target: target, tab: tabDirection)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
NotificationCenter.default.post(
|
NotificationCenter.default.post(
|
||||||
name: Notification.ghosttyFocusSplit,
|
name: Notification.ghosttyFocusSplit,
|
||||||
object: surfaceView,
|
object: surfaceView,
|
||||||
|
@ -130,6 +130,15 @@ extension Ghostty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if the view is in a split (not a single leaf)
|
||||||
|
func isViewInSplit(_ view: SurfaceView) -> Bool {
|
||||||
|
if case .split = self {
|
||||||
|
return contains(view: view)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Find a surface view by UUID.
|
/// Find a surface view by UUID.
|
||||||
func findUUID(uuid: UUID) -> SurfaceView? {
|
func findUUID(uuid: UUID) -> SurfaceView? {
|
||||||
switch (self) {
|
switch (self) {
|
||||||
|
Reference in New Issue
Block a user