Skip to content

Commit 944a1c0

Browse files
authored
feat: add message pining to macOS (#48)
1 parent 3936219 commit 944a1c0

6 files changed

Lines changed: 277 additions & 26 deletions

File tree

Packages/Sources/RxCodeChatKit/ChatBridge.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public final class ChatBridge {
3030
public var appVersion: String = ""
3131
public var claudeVersion: String?
3232
public var codexVersion: String?
33+
/// Changes when the local composer begins a new send. Message containers
34+
/// use this to clear any active-turn scroll state before AppState appends
35+
/// the next user row, matching the mobile send flow.
36+
public var sendRequestID: UUID?
3337

3438
/// User decision summaries for `ExitPlanMode` tool calls in the current session,
3539
/// keyed by `toolCallId`. Pushed by AppState from per-session state and persisted
@@ -64,6 +68,10 @@ public final class ChatBridge {
6468
await sendHandler?()
6569
}
6670

71+
public func markUserSendRequested() {
72+
sendRequestID = UUID()
73+
}
74+
6775
public func cancelStreaming() async {
6876
await cancelStreamingHandler?()
6977
}

Packages/Sources/RxCodeChatKit/ChatMessageListView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,16 @@ public struct ChatMessageListView: View {
6969

7070
extension View {
7171
func chatMessageListRowStyle() -> some View {
72+
#if os(macOS)
73+
padding(EdgeInsets(top: 8, leading: 20, bottom: 24, trailing: 20))
74+
.listRowInsets(EdgeInsets(top: 8, leading: 20, bottom: 24, trailing: 20))
75+
.listRowSeparator(.hidden)
76+
.listRowBackground(Color.clear)
77+
#else
7278
listRowInsets(EdgeInsets(top: 8, leading: 20, bottom: 24, trailing: 20))
7379
.listRowSeparator(.hidden)
7480
.listRowBackground(Color.clear)
81+
#endif
7582
}
7683
}
7784

Packages/Sources/RxCodeChatKit/InputBarView+Queue.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ extension InputBarView {
111111
}
112112

113113
func sendQueuedNow(_ id: UUID) {
114+
chatBridge.markUserSendRequested()
114115
Task { await chatBridge.sendQueuedNow(id: id) }
115116
}
116117

117118
func sendAllQueuedAsOne() {
119+
chatBridge.markUserSendRequested()
118120
Task { await chatBridge.sendAllQueuedAsOne() }
119121
}
120122

Packages/Sources/RxCodeChatKit/InputBarView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ struct InputBarView<Accessory: View, TopAccessory: View>: View {
642642
windowState.inputText = cmd.command + " "
643643
} else {
644644
windowState.inputText = ""
645+
chatBridge.markUserSendRequested()
645646
Task { await chatBridge.sendSlashCommand(cmd.command) }
646647
}
647648
}
@@ -750,6 +751,7 @@ struct InputBarView<Accessory: View, TopAccessory: View>: View {
750751
return
751752
}
752753

754+
chatBridge.markUserSendRequested()
753755
Task { await chatBridge.send() }
754756
resetIMEState()
755757
}

0 commit comments

Comments
 (0)