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: 1 addition & 1 deletion CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3738,7 +3738,7 @@
repositoryURL = "https://github.com/CodeEditApp/CodeEditTextView.git";
requirement = {
kind = exactVersion;
version = 0.3.3;
version = 0.3.4;
};
};
58F2EB18292FB91C004A9BDE /* XCRemoteSwiftPackageReference "Preferences" */ = {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ extension AppPreferences {
/// If true terminal appearance will always be `dark`. Otherwise it adapts to the system setting.
var darkAppearance: Bool = false

/// if true, the terminal uses the background color of the theme, otherwise it is clear
var useThemeBackground: Bool = true

/// If true, the terminal treats the `Option` key as the `Meta` key
var optionAsMeta: Bool = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct TerminalThemeView: View {
private var topToggles: some View {
VStack(alignment: .leading) {
Toggle("Always use dark terminal appearance", isOn: $prefs.preferences.terminal.darkAppearance)
Toggle("Use theme background ", isOn: $prefs.preferences.terminal.useThemeBackground)
}
}

Expand Down
20 changes: 18 additions & 2 deletions CodeEdit/Features/CodeFile/CodeFileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,26 @@ struct CodeFileView: View {
tabWidth: $prefs.preferences.textEditing.defaultTabWidth,
lineHeight: $prefs.preferences.textEditing.lineHeightMultiple,
wrapLines: $prefs.preferences.textEditing.wrapLinesToEditorWidth,
cursorPosition: codeFile.$cursorPosition
cursorPosition: codeFile.$cursorPosition,
useThemeBackground: prefs.preferences.theme.useThemeBackground
)
.id(codeFile.fileURL)
.background(selectedTheme.editor.background.swiftColor)
.background {
if colorScheme == .dark {
if prefs.preferences.theme.selectedTheme == prefs.preferences.theme.selectedLightTheme {
Color.white
} else {
EffectView(.underPageBackground)
}
} else {
if prefs.preferences.theme.selectedTheme == prefs.preferences.theme.selectedDarkTheme {
Color.black
} else {
EffectView(.contentBackground)
}

}
}
.disabled(!editable)
.frame(maxHeight: .infinity)
.onChange(of: ThemeModel.shared.selectedTheme) { newValue in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ struct StatusBarDrawer: View {
@EnvironmentObject
private var model: StatusBarViewModel

@ObservedObject
private var prefs: AppPreferencesModel = .shared

@Environment(\.colorScheme)
private var colorScheme

@State
private var searchText = ""

Expand All @@ -27,7 +33,24 @@ struct StatusBarDrawer: View {
var body: some View {
VStack(spacing: 0) {
switch model.selectedTab {
case 0: TerminalEmulatorView(url: model.workspaceURL)
case 0:
TerminalEmulatorView(url: model.workspaceURL)
.background {
if colorScheme == .dark {
if prefs.preferences.theme.selectedTheme == prefs.preferences.theme.selectedLightTheme {
Color.white
} else {
EffectView(.underPageBackground)
}
} else {
if prefs.preferences.theme.selectedTheme == prefs.preferences.theme.selectedDarkTheme {
Color.black
} else {
EffectView(.contentBackground)
}

}
}
default: Rectangle().foregroundColor(Color(nsColor: .textBackgroundColor))
}
HStack(alignment: .center, spacing: 10) {
Expand Down
6 changes: 4 additions & 2 deletions CodeEdit/Features/TerminalEmulator/TerminalEmulatorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ struct TerminalEmulatorView: NSViewRepresentable {
terminal.caretColor = cursorColor
terminal.selectedTextBackgroundColor = selectionColor
terminal.nativeForegroundColor = textColor
terminal.nativeBackgroundColor = backgroundColor
terminal.nativeBackgroundColor = prefs.preferences.terminal.useThemeBackground ? backgroundColor : .clear
terminal.layer?.backgroundColor = .clear
terminal.optionAsMetaKey = optionAsMeta
}
terminal.appearance = colorAppearance
Expand All @@ -201,7 +202,8 @@ struct TerminalEmulatorView: NSViewRepresentable {
view.caretColor = cursorColor
view.selectedTextBackgroundColor = selectionColor
view.nativeForegroundColor = textColor
view.nativeBackgroundColor = backgroundColor
view.nativeBackgroundColor = prefs.preferences.terminal.useThemeBackground ? backgroundColor : .clear
view.layer?.backgroundColor = .clear
view.optionAsMetaKey = optionAsMeta
view.appearance = colorAppearance
if TerminalEmulatorView.lastTerminal[url.path] != nil {
Expand Down