Skip to content

Commit c4ecab0

Browse files
committed
up
1 parent 9c1e54d commit c4ecab0

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

aizen/Services/Agent/AgentSession.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,6 @@ class AgentSession: ObservableObject, ACPClientDelegate {
376376
if response.success {
377377
logger.info("Mode change succeeded: \(modeId)")
378378
currentModeId = modeId
379-
if let modeName = availableModes.first(where: { $0.id == modeId })?.name {
380-
addSystemMessage("Mode changed to \(modeName)")
381-
}
382379
} else {
383380
logger.warning("Mode change response indicated failure")
384381
}

aizen/Views/Chat/Components/InlineDiffView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ struct InlineDiffView: View {
4242
}
4343

4444
private var previewHeight: CGFloat {
45-
let lineHeight = max(fontSize + 4, 14)
46-
return CGFloat(previewLines.count) * lineHeight + 8
45+
let rowHeight = SelectableDiffView.calculateRowHeight(fontSize: fontSize, fontFamily: terminalFontName)
46+
return CGFloat(previewLines.count) * rowHeight
4747
}
4848

4949
var body: some View {

aizen/Views/Chat/Components/SelectableDiffView.swift

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66
import SwiftUI
77
import AppKit
88

9+
// MARK: - Non-Scrolling Scroll View
10+
11+
private class NonScrollingScrollView: NSScrollView {
12+
var scrollingEnabled: Bool = true
13+
14+
override func scrollWheel(with event: NSEvent) {
15+
if scrollingEnabled {
16+
super.scrollWheel(with: event)
17+
} else {
18+
nextResponder?.scrollWheel(with: event)
19+
}
20+
}
21+
}
22+
923
// MARK: - Custom Table View with Copy Support
1024

1125
private class ChatDiffTableView: NSTableView {
@@ -172,8 +186,15 @@ struct SelectableDiffView: NSViewRepresentable {
172186
let fontFamily: String
173187
var scrollable: Bool = true
174188

189+
static func calculateRowHeight(fontSize: Double, fontFamily: String) -> CGFloat {
190+
let font = NSFont(name: fontFamily, size: fontSize) ?? NSFont.monospacedSystemFont(ofSize: fontSize, weight: .regular)
191+
return ceil(font.ascender - font.descender + font.leading) + 4
192+
}
193+
175194
func makeNSView(context: Context) -> NSScrollView {
176-
let scrollView = NSScrollView()
195+
let scrollView = NonScrollingScrollView()
196+
scrollView.scrollingEnabled = scrollable
197+
177198
let tableView = ChatDiffTableView()
178199
tableView.coordinator = context.coordinator
179200

@@ -220,6 +241,9 @@ struct SelectableDiffView: NSViewRepresentable {
220241
}
221242

222243
func updateNSView(_ scrollView: NSScrollView, context: Context) {
244+
if let nonScrolling = scrollView as? NonScrollingScrollView {
245+
nonScrolling.scrollingEnabled = scrollable
246+
}
223247
context.coordinator.updateData(lines: lines, fontSize: fontSize, fontFamily: fontFamily)
224248
}
225249

0 commit comments

Comments
 (0)