summaryrefslogtreecommitdiff
path: root/Hutch/Views/Repositories
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-03-19 01:17:49 -0500
committerChristian Cleberg <[email protected]>2026-03-19 01:17:49 -0500
commit441b69afae30ee6b662be38004fd7b5de1e47302 (patch)
tree610827d41c7e7157290727b69b320f8dce95f08f /Hutch/Views/Repositories
parentffc0ef0988b5e7d01951c23af85a1cf026b3da9f (diff)
downloadhutch-441b69afae30ee6b662be38004fd7b5de1e47302.tar.gz
hutch-441b69afae30ee6b662be38004fd7b5de1e47302.tar.bz2
hutch-441b69afae30ee6b662be38004fd7b5de1e47302.zip
feat: add support for reading inbox messages (emails) and replying in-app
Diffstat (limited to 'Hutch/Views/Repositories')
-rw-r--r--Hutch/Views/Repositories/DiffView.swift22
1 files changed, 15 insertions, 7 deletions
diff --git a/Hutch/Views/Repositories/DiffView.swift b/Hutch/Views/Repositories/DiffView.swift
index b1db464..4380e22 100644
--- a/Hutch/Views/Repositories/DiffView.swift
+++ b/Hutch/Views/Repositories/DiffView.swift
@@ -9,14 +9,23 @@ struct DiffView: View {
let diff: String
var body: some View {
- let lines = diff.components(separatedBy: "\n")
+ let lines = normalizedDiff.components(separatedBy: "\n")
- LazyVStack(alignment: .leading, spacing: 0) {
+ VStack(alignment: .leading, spacing: 0) {
ForEach(Array(lines.enumerated()), id: \.offset) { _, line in
DiffLineView(line: line)
}
}
- .font(.caption.monospaced())
+ .font(.system(.caption, design: .monospaced))
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(Color(.secondarySystemBackground))
+ .clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))
+ }
+
+ private var normalizedDiff: String {
+ diff
+ .replacingOccurrences(of: "\r\n", with: "\n")
+ .replacingOccurrences(of: "\r", with: "\n")
}
}
@@ -27,7 +36,6 @@ private struct DiffLineView: View {
Text(line.isEmpty ? " " : line)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 8)
- .padding(.vertical, 1)
.background(backgroundColor)
.foregroundStyle(foregroundColor)
.fontWeight(isHeader ? .semibold : .regular)
@@ -47,9 +55,9 @@ private struct DiffLineView: View {
switch kind {
case .added: .green.opacity(0.15)
case .removed: .red.opacity(0.15)
- case .hunk: .gray.opacity(0.12)
- case .fileHeader: .gray.opacity(0.08)
- case .meta: .gray.opacity(0.05)
+ case .hunk: .clear
+ case .fileHeader: .clear
+ case .meta: .clear
case .context: .clear
}
}