docs: note mid-string caret limitation for token-aware autocorrect

Callers that only pass text.count still autocorrect inside earlier
sigil tokens — track as a v1 limit until selection is available.

Signed-off-by: Taksh <takshkothari09@gmail.com>
This commit is contained in:
Taksh 2026-07-31 15:29:51 +03:00
parent d43440d79e
commit d1ce261d93

View File

@ -15,6 +15,10 @@ import Foundation
/// of those sigils; leave it on otherwise. The composer TextField only exposes
/// the text (not a live selection), so callers pass the caret typically the
/// end of the string, matching autocomplete.
///
/// Mid-string caret is a known v1 limitation: when callers only know
/// `text.count`, moving the caret back into an existing `/` `@` `#` token
/// still leaves autocorrect on. Plumb selection through when SwiftUI exposes it.
enum ComposerAutocorrect {
/// Sigils that mean "exact token, don't rewrite me".
static let specialPrefixes: Set<Character> = ["/", "@", "#"]