From 39a4d5ea7bcd7e432f45ab4eec800eaec727539c Mon Sep 17 00:00:00 2001 From: MacKinley Smith Date: Thu, 27 Aug 2026 11:35:27 -0600 Subject: [PATCH] fix(swift-ios): keep caret after command completion --- .../Features/Chat/FeatureComposerView.swift | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/swift-ios/Features/Chat/FeatureComposerView.swift b/apps/swift-ios/Features/Chat/FeatureComposerView.swift index 146485c38dab..6cd0bc0c36c7 100644 --- a/apps/swift-ios/Features/Chat/FeatureComposerView.swift +++ b/apps/swift-ios/Features/Chat/FeatureComposerView.swift @@ -483,18 +483,21 @@ struct FeatureComposerView: View { case let .path(entry): replacement = FeatureComposerFileLinkSerializer.markdownLink(for: entry.path) + " " } - textSelectionRequest = FeatureComposerTextSelectionRequest( - location: FeatureComposerTextSelectionPolicy.cursorLocation( - afterReplacing: trigger.range, - in: text, - with: replacement - ) + let nextCursorLocation = FeatureComposerTextSelectionPolicy.cursorLocation( + afterReplacing: trigger.range, + in: text, + with: replacement ) text = FeatureComposerTriggerParser.replacing( trigger.range, in: text, with: replacement ) + // Publish the text first so the representable cannot consume and clamp + // this request against the pre-replacement draft. + textSelectionRequest = FeatureComposerTextSelectionRequest( + location: nextCursorLocation + ) pathEntries = [] pathSearchError = nil Task { @MainActor in