Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CodeEdit/Features/TabBar/Views/TabBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,16 @@ struct TabBarView: View {
// On first tab appeared, jump to the corresponding position.
scrollReader.scrollTo(workspace.selectionState.selectedId)
}
.onChange(of: workspace.selectionState.openedTabs) { _ in
DispatchQueue.main.asyncAfter(
deadline: .now() + .milliseconds(
prefs.preferences.general.tabBarStyle == .native ? 150 : 200
)
) {
guard let selectedID = workspace.selectionState.selectedId else { return }
scrollReader.scrollTo(selectedID)
}
}
// When selected tab is changed, scroll to it if possible.
.onChange(of: workspace.selectionState.selectedId) { targetId in
guard let selectedId = targetId else { return }
Expand Down