diff --git a/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatComposer.swift b/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatComposer.swift index 41b1d792b..bc6b08db4 100644 --- a/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatComposer.swift +++ b/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatComposer.swift @@ -412,7 +412,11 @@ private struct ChatComposerTextView: NSViewRepresentable { } let isEditing = scrollView.window?.firstResponder == textView - if isEditing { return } + + // Always allow clearing the text (e.g. after send), even while editing. + // Only skip other updates while editing to avoid cursor jumps. + let shouldClear = self.text.isEmpty && !textView.string.isEmpty + if isEditing && !shouldClear { return } if textView.string != self.text { context.coordinator.isProgrammaticUpdate = true diff --git a/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatViewModel.swift b/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatViewModel.swift index 087ef912c..14ce2091a 100644 --- a/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatViewModel.swift +++ b/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatViewModel.swift @@ -243,6 +243,10 @@ public final class ClawdisChatViewModel { content: userContent, timestamp: Date().timeIntervalSince1970 * 1000)) + // Clear input immediately for responsive UX (before network await) + self.input = "" + self.attachments = [] + do { let response = try await self.transport.sendMessage( sessionKey: self.sessionKey, @@ -261,8 +265,6 @@ public final class ClawdisChatViewModel { chatUILogger.error("chat.send failed \(error.localizedDescription, privacy: .public)") } - self.input = "" - self.attachments = [] self.isSending = false }