From d1ce261d935e3256e3a5d1cb20db3fe82751ef86 Mon Sep 17 00:00:00 2001 From: Taksh Date: Fri, 31 Jul 2026 15:29:51 +0300 Subject: [PATCH] docs: note mid-string caret limitation for token-aware autocorrect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- bitchat/Utils/ComposerAutocorrect.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bitchat/Utils/ComposerAutocorrect.swift b/bitchat/Utils/ComposerAutocorrect.swift index 8a20d0b7..51d2a90c 100644 --- a/bitchat/Utils/ComposerAutocorrect.swift +++ b/bitchat/Utils/ComposerAutocorrect.swift @@ -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 = ["/", "@", "#"]