nandi/frqpublic Fork 0
e04bb83
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

The caret goes after the word, not around it

Tab completion came back highlighted: `nandi.uk: ` arrived selected, and the
next character typed would have replaced the name it had just finished.

`controller-for` was assigning `.text`, which leaves the selection at offset
-1 — and Flutter draws that as the whole field selected. The whole
`TextEditingValue` goes in now, with the caret collapsed after the last
character.

Every programmatic write to an entry gets it, not only Tab: a nick restored
from a saved session, a handle landing after sign-in. None of them wanted the
field selected either; the completion is just the one that made it obvious.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-17T19:49:40-07:00 Browse files
e04bb83 parent: 8c38fb8
modified flutter/src/frq/hiccup.cljd +13 -4
@@ -155,11 +155,20 @@
155155 (let [c (m/TextEditingController .text (or text ""))]
156156 (swap! controllers assoc k c)
157157 c))]
158- ;; Only when it differs, and never while it would move the caret: the cell
159- ;; is the authority for what the entry says, but the person typing is the
160- ;; authority for where they are in it.
158+ ;; Only when it differs: the cell is the authority for what the entry
159+ ;; says, but the person typing is the authority for where they are in it,
160+ ;; and every keystroke would otherwise be written back over itself.
161+ ;;
162+ ;; The whole value and not just `.text`, which is the bug Tab completion
163+ ;; found. Assigning `.text` leaves the selection at offset -1, and Flutter
164+ ;; draws that as the entire field selected — so completing a nick handed
165+ ;; back `nandi.uk: ` highlighted, and the next character typed would have
166+ ;; replaced it. The caret belongs after what was just put there.
161167 (when (and text (not= text (.-text c)))
162- (set! (.-text c) text))
168+ (set! (.-value c)
169+ (m/TextEditingValue
170+ .text text
171+ .selection (m/TextSelection.collapsed .offset (count text)))))
163172 c))
164173
165174 ;; ------------------------------------------------------------------ props
@@ -155,11 +155,20 @@
155 (let [c (m/TextEditingController .text (or text ""))]155 (let [c (m/TextEditingController .text (or text ""))]
156 (swap! controllers assoc k c)156 (swap! controllers assoc k c)
157 c))]157 c))]
158- ;; Only when it differs, and never while it would move the caret: the cell158+ ;; Only when it differs: the cell is the authority for what the entry
159- ;; is the authority for what the entry says, but the person typing is the159+ ;; says, but the person typing is the authority for where they are in it,
160- ;; authority for where they are in it.160+ ;; and every keystroke would otherwise be written back over itself.
161+ ;;
162+ ;; The whole value and not just `.text`, which is the bug Tab completion
163+ ;; found. Assigning `.text` leaves the selection at offset -1, and Flutter
164+ ;; draws that as the entire field selected — so completing a nick handed
165+ ;; back `nandi.uk: ` highlighted, and the next character typed would have
166+ ;; replaced it. The caret belongs after what was just put there.
161 (when (and text (not= text (.-text c)))167 (when (and text (not= text (.-text c)))
162- (set! (.-text c) text))168+ (set! (.-value c)
169+ (m/TextEditingValue
170+ .text text
171+ .selection (m/TextSelection.collapsed .offset (count text)))))
163 c))172 c))
164 173
165 ;; ------------------------------------------------------------------ props174 ;; ------------------------------------------------------------------ props