terminal slow

This commit is contained in:
Ian Gulliver
2026-10-17 23:21:40 -07:00
parent 39ca42316f
commit 28c4549151
5 changed files with 14 additions and 26 deletions
+3 -11
View File
@@ -741,10 +741,6 @@ struct DetailsBox<Summary: View, Content: View>: View {
Text(open ? "▾" : "▸")
.foregroundStyle(Palette.muted)
summary
if working {
Spinner(color: accent)
.padding(.leading, 4)
}
Spacer(minLength: 0)
if let status {
Text(status.text)
@@ -1160,11 +1156,7 @@ private struct SnapshotRow: View {
.overlay(alignment: .topTrailing) {
if let review {
switch review.state {
case .running:
Spinner(color: accent).font(Fonts.font(10)).help("review in progress")
.fixedSize()
.offset(x: 13, y: -4)
case .failed:
case .running, .failed:
EmptyView()
case .skipped:
Text("●").font(Fonts.font(11, weight: 700)).foregroundStyle(Palette.muted).help("skipped: no changes")
@@ -1190,7 +1182,7 @@ private struct SnapshotRow: View {
}
}
}
.buttonStyle(SmallLinkButtonStyle(color: n > 0 ? Palette.warn : Palette.accent))
.help("Show the review of snapshot \(snap.n) in the Reviews tab")
.buttonStyle(SmallLinkButtonStyle(color: n > 0 ? Palette.warn : Palette.accent, border: review?.state == .running ? accent : Palette.border))
.help(review?.state == .running ? "Review in progress; show snapshot \(snap.n)'s review in the Reviews tab" : "Show the review of snapshot \(snap.n) in the Reviews tab")
}
}
+2 -1
View File
@@ -408,6 +408,7 @@ private struct WebButton: View {
struct SmallLinkButtonStyle: ButtonStyle {
var color = Palette.accent
var border = Palette.border
@Environment(\.isEnabled) private var enabled
func makeBody(configuration: ButtonStyleConfiguration) -> some View {
@@ -415,7 +416,7 @@ struct SmallLinkButtonStyle: ButtonStyle {
.font(Fonts.font(11))
.foregroundStyle(color)
.padding(.horizontal, 6)
.overlay(RoundedRectangle(cornerRadius: 4).stroke(Palette.border))
.overlay(RoundedRectangle(cornerRadius: 4).stroke(border))
.opacity(enabled ? 1 : 0.45)
.contentShape(Rectangle())
}
+1 -9
View File
@@ -5,12 +5,10 @@ import SwiftUI
enum TabBadge {
case none
case count(Int, String)
case spinner
}
struct TabBadgeView: View {
let badge: TabBadge
@Environment(\.paneAccent) private var accent
var body: some View {
switch badge {
@@ -19,9 +17,6 @@ struct TabBadgeView: View {
case .count(let n, let help):
Badge(count: n)
.help(help)
case .spinner:
Spinner(color: accent)
.help("review in progress")
}
}
}
@@ -376,10 +371,7 @@ private struct TabStrip: View {
}
func badge(_ t: TaskTab) -> TabBadge {
if t == .reviews && reviewing {
return .spinner
}
return count(t) > 0 ? .count(count(t), t == .inbox ? "inbox items" : "open findings in the latest review") : .none
count(t) > 0 ? .count(count(t), t == .inbox ? "inbox items" : "open findings in the latest review") : .none
}
}
+5 -2
View File
@@ -82,7 +82,6 @@ struct TerminalHost: NSViewRepresentable {
t.terminalDelegate = context.coordinator
context.coordinator.view = t
DispatchQueue.main.async {
colour(t)
unsafe t.window?.makeFirstResponder(t)
context.coordinator.connect()
}
@@ -90,7 +89,10 @@ struct TerminalHost: NSViewRepresentable {
}
func updateNSView(_ nsView: TerminalView, context: Context) {
_ = scheme
if context.coordinator.scheme == scheme {
return
}
context.coordinator.scheme = scheme
DispatchQueue.main.async {
colour(nsView)
}
@@ -123,6 +125,7 @@ final class TerminalSession: NSObject, TerminalViewDelegate, URLSessionWebSocket
let active: @MainActor () -> Bool
let show: @MainActor (String, Bool) -> Void
weak var view: TerminalView?
var scheme: ColorScheme?
private var ws: URLSessionWebSocketTask?
private var retry: Task<Void, Never>?
private var done = false