terminal slow
This commit is contained in:
+3
-3
File diff suppressed because one or more lines are too long
@@ -741,10 +741,6 @@ struct DetailsBox<Summary: View, Content: View>: View {
|
|||||||
Text(open ? "▾" : "▸")
|
Text(open ? "▾" : "▸")
|
||||||
.foregroundStyle(Palette.muted)
|
.foregroundStyle(Palette.muted)
|
||||||
summary
|
summary
|
||||||
if working {
|
|
||||||
Spinner(color: accent)
|
|
||||||
.padding(.leading, 4)
|
|
||||||
}
|
|
||||||
Spacer(minLength: 0)
|
Spacer(minLength: 0)
|
||||||
if let status {
|
if let status {
|
||||||
Text(status.text)
|
Text(status.text)
|
||||||
@@ -1160,11 +1156,7 @@ private struct SnapshotRow: View {
|
|||||||
.overlay(alignment: .topTrailing) {
|
.overlay(alignment: .topTrailing) {
|
||||||
if let review {
|
if let review {
|
||||||
switch review.state {
|
switch review.state {
|
||||||
case .running:
|
case .running, .failed:
|
||||||
Spinner(color: accent).font(Fonts.font(10)).help("review in progress")
|
|
||||||
.fixedSize()
|
|
||||||
.offset(x: 13, y: -4)
|
|
||||||
case .failed:
|
|
||||||
EmptyView()
|
EmptyView()
|
||||||
case .skipped:
|
case .skipped:
|
||||||
Text("●").font(Fonts.font(11, weight: 700)).foregroundStyle(Palette.muted).help("skipped: no changes")
|
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))
|
.buttonStyle(SmallLinkButtonStyle(color: n > 0 ? Palette.warn : Palette.accent, border: review?.state == .running ? accent : Palette.border))
|
||||||
.help("Show the review of snapshot \(snap.n) in the Reviews tab")
|
.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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -408,6 +408,7 @@ private struct WebButton: View {
|
|||||||
|
|
||||||
struct SmallLinkButtonStyle: ButtonStyle {
|
struct SmallLinkButtonStyle: ButtonStyle {
|
||||||
var color = Palette.accent
|
var color = Palette.accent
|
||||||
|
var border = Palette.border
|
||||||
@Environment(\.isEnabled) private var enabled
|
@Environment(\.isEnabled) private var enabled
|
||||||
|
|
||||||
func makeBody(configuration: ButtonStyleConfiguration) -> some View {
|
func makeBody(configuration: ButtonStyleConfiguration) -> some View {
|
||||||
@@ -415,7 +416,7 @@ struct SmallLinkButtonStyle: ButtonStyle {
|
|||||||
.font(Fonts.font(11))
|
.font(Fonts.font(11))
|
||||||
.foregroundStyle(color)
|
.foregroundStyle(color)
|
||||||
.padding(.horizontal, 6)
|
.padding(.horizontal, 6)
|
||||||
.overlay(RoundedRectangle(cornerRadius: 4).stroke(Palette.border))
|
.overlay(RoundedRectangle(cornerRadius: 4).stroke(border))
|
||||||
.opacity(enabled ? 1 : 0.45)
|
.opacity(enabled ? 1 : 0.45)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,10 @@ import SwiftUI
|
|||||||
enum TabBadge {
|
enum TabBadge {
|
||||||
case none
|
case none
|
||||||
case count(Int, String)
|
case count(Int, String)
|
||||||
case spinner
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TabBadgeView: View {
|
struct TabBadgeView: View {
|
||||||
let badge: TabBadge
|
let badge: TabBadge
|
||||||
@Environment(\.paneAccent) private var accent
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
switch badge {
|
switch badge {
|
||||||
@@ -19,9 +17,6 @@ struct TabBadgeView: View {
|
|||||||
case .count(let n, let help):
|
case .count(let n, let help):
|
||||||
Badge(count: n)
|
Badge(count: n)
|
||||||
.help(help)
|
.help(help)
|
||||||
case .spinner:
|
|
||||||
Spinner(color: accent)
|
|
||||||
.help("review in progress")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -376,10 +371,7 @@ private struct TabStrip: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func badge(_ t: TaskTab) -> TabBadge {
|
func badge(_ t: TaskTab) -> TabBadge {
|
||||||
if t == .reviews && reviewing {
|
count(t) > 0 ? .count(count(t), t == .inbox ? "inbox items" : "open findings in the latest review") : .none
|
||||||
return .spinner
|
|
||||||
}
|
|
||||||
return count(t) > 0 ? .count(count(t), t == .inbox ? "inbox items" : "open findings in the latest review") : .none
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ struct TerminalHost: NSViewRepresentable {
|
|||||||
t.terminalDelegate = context.coordinator
|
t.terminalDelegate = context.coordinator
|
||||||
context.coordinator.view = t
|
context.coordinator.view = t
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
colour(t)
|
|
||||||
unsafe t.window?.makeFirstResponder(t)
|
unsafe t.window?.makeFirstResponder(t)
|
||||||
context.coordinator.connect()
|
context.coordinator.connect()
|
||||||
}
|
}
|
||||||
@@ -90,7 +89,10 @@ struct TerminalHost: NSViewRepresentable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateNSView(_ nsView: TerminalView, context: Context) {
|
func updateNSView(_ nsView: TerminalView, context: Context) {
|
||||||
_ = scheme
|
if context.coordinator.scheme == scheme {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
context.coordinator.scheme = scheme
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
colour(nsView)
|
colour(nsView)
|
||||||
}
|
}
|
||||||
@@ -123,6 +125,7 @@ final class TerminalSession: NSObject, TerminalViewDelegate, URLSessionWebSocket
|
|||||||
let active: @MainActor () -> Bool
|
let active: @MainActor () -> Bool
|
||||||
let show: @MainActor (String, Bool) -> Void
|
let show: @MainActor (String, Bool) -> Void
|
||||||
weak var view: TerminalView?
|
weak var view: TerminalView?
|
||||||
|
var scheme: ColorScheme?
|
||||||
private var ws: URLSessionWebSocketTask?
|
private var ws: URLSessionWebSocketTask?
|
||||||
private var retry: Task<Void, Never>?
|
private var retry: Task<Void, Never>?
|
||||||
private var done = false
|
private var done = false
|
||||||
|
|||||||
Reference in New Issue
Block a user