fix(swift-ios): keep caret after command completion - #8428
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped Swift iOS bug fix that reorders two existing state updates so command completion places the caret after the inserted text. It changes no schemas, integrations, infrastructure, or sensitive code and has a limited component-level impact. You can add or adjust custom eligibility rules. Learn more. |
What Changed
Selecting a skill or slash command in the SwiftUI composer could leave the caret at the old trigger endpoint. Continuing to type then inserted text inside the completed command.
The composer now computes the target offset from the original draft, publishes the replaced text, and only then sends the one-shot selection request.
Why
SwiftUI can update the UIKit representable between the two state writes. Publishing the selection request first allowed it to be applied and clamped against the shorter pre-replacement text, then marked as consumed.
UI Changes
No visual styling changed.
Before, completing
$fileas$file-prcould leave the caret after$file. After, the caret lands after the completed token and its trailing space.Verified on a physical iPhone 14 Pro with
T3 Swift Dev.Verification
T3CodeTests/FeatureComposerPowerTests: 25 passedChecklist
Built with
gpt-5.6-solat xhigh reasoning effort in the T3 Code Codex harness.Note
Cursor Bugbot is generating a summary for commit 39a4d5e. Configure here.
Note
Fix caret placement after command completion in
FeatureComposerViewReorders the trigger insertion handler in FeatureComposerView.swift to publish
textSelectionRequestafter updating the text. This prevents the cursor from being clamped against the pre-replacement draft content.Macroscope summarized 39a4d5e.