Skip to content

Commit e5fe4bf

Browse files
authored
Merge pull request #260 from lukepistrol/terminal-color-fix
fixed colors in terminal emulator
2 parents f09046c + 8afd332 commit e5fe4bf

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

CodeEditModules/Modules/TerminalEmulator/src/TerminalEmulatorView.swift

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public struct TerminalEmulatorView: NSViewRepresentable {
2424

2525
@StateObject private var ansiColors: AnsiColors = .shared
2626

27-
// TODO: Persist this to not get a new terminal each time you switch file
2827
internal static var lastTerminal: LocalProcessTerminalView?
2928
@State internal var terminal: LocalProcessTerminalView
3029

@@ -86,16 +85,6 @@ public struct TerminalEmulatorView: NSViewRepresentable {
8685
return String(cString: pwd.pw_shell)
8786
}
8887

89-
/// Returns a reorderd array of ANSI colors depending on the app's color scheme (light/drak)
90-
private var appearanceColors: [SwiftTerm.Color] {
91-
if colorScheme == .dark {
92-
return colors
93-
}
94-
var col = colors
95-
col.move(fromOffsets: .init(integersIn: 0...7), toOffset: 16)
96-
return col
97-
}
98-
9988
/// Returns the mapped array of `SwiftTerm.Color` objects of ANSI Colors
10089
private var colors: [SwiftTerm.Color] {
10190
return ansiColors.mappedColors.map { SwiftTerm.Color(hex: $0) }
@@ -122,7 +111,7 @@ public struct TerminalEmulatorView: NSViewRepresentable {
122111
terminal.startProcess(executable: shell, execName: shellIdiom)
123112
terminal.font = font
124113
terminal.configureNativeColors()
125-
terminal.installColors(self.appearanceColors)
114+
terminal.installColors(self.colors)
126115
}
127116
TerminalEmulatorView.lastTerminal = terminal
128117
}
@@ -132,7 +121,7 @@ public struct TerminalEmulatorView: NSViewRepresentable {
132121
view.font = font
133122
}
134123
view.configureNativeColors()
135-
view.installColors(self.appearanceColors)
124+
view.installColors(self.colors)
136125
if TerminalEmulatorView.lastTerminal != nil {
137126
TerminalEmulatorView.lastTerminal = view
138127
}

0 commit comments

Comments
 (0)