diff options
| author | Bryan Lee <38807139+liby@users.noreply.github.com> | 2025-02-13 13:26:24 +0800 |
|---|---|---|
| committer | Bryan Lee <38807139+liby@users.noreply.github.com> | 2025-02-13 14:59:14 +0800 |
| commit | f72fd32bf0a72cc0a8ebf9d05f2e02fa728a3048 (patch) | |
| tree | 95955682a85120b68f5ba72cefd3864928b4ac48 | |
| parent | 432beac3151d84c78dfe7ab860c1c3f7957f4775 (diff) | |
Eliminate tab content flickering during tab movement on macOS
| -rw-r--r-- | macos/Sources/Features/Terminal/TerminalController.swift | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 8507cf620..8118103d6 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -709,13 +709,21 @@ class TerminalController: BaseTerminalController { // If our index is the same we do nothing guard finalIndex != selectedIndex else { return } - // Get our parent - let parent = tabbedWindows[finalIndex] + // Get our target window + let targetWindow = tabbedWindows[finalIndex] + + // Begin a group of window operations to minimize visual updates + NSAnimationContext.beginGrouping() + NSAnimationContext.current.duration = 0 - // Move our current selected window to the proper index + // Remove and re-add the window in the correct position tabGroup.removeWindow(selectedWindow) - parent.addTabbedWindow(selectedWindow, ordered: action.amount < 0 ? .below : .above) - selectedWindow.makeKeyAndOrderFront(nil) + targetWindow.addTabbedWindow(selectedWindow, ordered: action.amount < 0 ? .below : .above) + + // Ensure our window remains selected + selectedWindow.makeKey() + + NSAnimationContext.endGrouping() } @objc private func onGotoTab(notification: SwiftUI.Notification) { |
