Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ struct EditorTabView: View {
}
}
)
// This padding is to avoid background color overlapping with top divider.
.padding(.top, 1)
.zIndex(isActive ? 2 : (isDragging ? 3 : (isPressing ? 1 : 0)))
.id(item.id)
.tabBarContextMenu(item: item, isTemporary: isTemporary)
Expand Down
6 changes: 5 additions & 1 deletion CodeEdit/Features/Editor/TabBar/Views/EditorTabBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,24 @@
import SwiftUI

struct EditorTabBarView: View {
let hasTopInsets: Bool
/// The height of tab bar.
/// I am not making it a private variable because it may need to be used in outside views.
static let height = 28.0

var body: some View {
HStack(alignment: .center, spacing: 0) {
EditorTabBarLeadingAccessories()
.padding(.top, hasTopInsets ? -1 : 0)
EditorTabs()
.accessibilityElement(children: .contain)
.accessibilityLabel("Tab Bar")
.accessibilityIdentifier("TabBar")
EditorTabBarTrailingAccessories()
.padding(.top, hasTopInsets ? -1 : 0)
}
.frame(height: EditorTabBarView.height)
.frame(height: EditorTabBarView.height - (hasTopInsets ? 1 : 0))
.clipped()
.padding(.leading, -1)
}
}
47 changes: 28 additions & 19 deletions CodeEdit/Features/Editor/Views/EditorAreaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,38 @@ struct EditorAreaView: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
.ignoresSafeArea(.all)
.safeAreaInset(edge: .top, spacing: 0) {
VStack(spacing: 0) {
if shouldShowTabBar {
EditorTabBarView()
.id("TabBarView" + editor.id.uuidString)
.environmentObject(editor)
Divider()
}
if showEditorJumpBar {
EditorJumpBarView(
file: editor.selectedTab?.file,
shouldShowTabBar: shouldShowTabBar
) { [weak editor] newFile in
if let file = editor?.selectedTab, let index = editor?.tabs.firstIndex(of: file) {
editor?.openTab(file: newFile, at: index)
GeometryReader { geometry in
let topSafeArea = geometry.safeAreaInsets.top
VStack(spacing: 0) {
if topSafeArea > 0 {
Rectangle()
.fill(.clear)
.frame(height: 1)
.background(.clear)
}
if shouldShowTabBar {
EditorTabBarView(hasTopInsets: topSafeArea > 0)
.id("TabBarView" + editor.id.uuidString)
.environmentObject(editor)
Divider()
}
if showEditorJumpBar {
EditorJumpBarView(
file: editor.selectedTab?.file,
shouldShowTabBar: shouldShowTabBar
) { [weak editor] newFile in
if let file = editor?.selectedTab, let index = editor?.tabs.firstIndex(of: file) {
editor?.openTab(file: newFile, at: index)
}
}
.environmentObject(editor)
.padding(.top, shouldShowTabBar ? -1 : 0)
Divider()
}
.environmentObject(editor)
.padding(.top, shouldShowTabBar ? -1 : 0)
Divider()
}
.environment(\.isActiveEditor, editor == editorManager.activeEditor)
.background(EffectView(.headerView))
}
.environment(\.isActiveEditor, editor == editorManager.activeEditor)
.background(EffectView(.headerView))
}
.focused($focus, equals: editor)
// Fixing this is causing a malloc exception when a file is edited & closed. See #1886
Expand Down