Commit 653b8f6
fix(cards): Shift+Enter inserts a line break instead of eating the text
The card promises "⏎ save · ⇧⏎ newline" in its own header and the second
half was not true. It returned `.ignored` for Shift+Return and trusted the
field to do it; a vertical TextField on macOS has no newline gesture, so
the key reached AppKit as an ordinary `insertNewline:`, which ends
editing.
Measured rather than reasoned about, and the failure is worse than the
report: typing "a", Shift+Return, "b" left the binding holding "b" — no
line break, and the text already typed was GONE. A field with no key
handler at all behaved identically, so the interception was never the
cause.
`insertNewlineIgnoringFieldEditor(_:)` sent to the field editor — the
NSTextView that actually holds the text while a SwiftUI TextField is
focused — is AppKit's action for "a line break, do NOT end editing", what
Option+Return does in any NSTextField. Going through the editor rather
than appending to the binding is what lands the break at the CARET, so
someone fixing the middle of a sentence gets it where they are typing.
Rejected TextEditor, which does honour Shift+Return: it would have meant
re-creating the rounded border, the 2-5 line growth and the placeholder
by hand — restyling the one control on both cards to fix a keystroke.
Probe phase 13 asserts it end to end, through the composer's real field:
type "a", Shift+Return, "b", Enter, and read what was FILED, since the
draft is @State in the view and there is no honest way to read it from
outside. Rides the same opt-in flag as the other real-input legs.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 92a83fd commit 653b8f6
3 files changed
Lines changed: 153 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
299 | 323 | | |
300 | 324 | | |
301 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
2 | 5 | | |
3 | 6 | | |
4 | 7 | | |
| |||
707 | 710 | | |
708 | 711 | | |
709 | 712 | | |
710 | | - | |
711 | | - | |
| 713 | + | |
| 714 | + | |
712 | 715 | | |
713 | | - | |
| 716 | + | |
714 | 717 | | |
715 | 718 | | |
716 | 719 | | |
| |||
750 | 753 | | |
751 | 754 | | |
752 | 755 | | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
753 | 788 | | |
754 | 789 | | |
755 | 790 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3057 | 3057 | | |
3058 | 3058 | | |
3059 | 3059 | | |
3060 | | - | |
| 3060 | + | |
3061 | 3061 | | |
3062 | 3062 | | |
3063 | 3063 | | |
3064 | | - | |
| 3064 | + | |
3065 | 3065 | | |
3066 | 3066 | | |
3067 | 3067 | | |
| |||
3075 | 3075 | | |
3076 | 3076 | | |
3077 | 3077 | | |
3078 | | - | |
| 3078 | + | |
3079 | 3079 | | |
3080 | 3080 | | |
3081 | 3081 | | |
| |||
3128 | 3128 | | |
3129 | 3129 | | |
3130 | 3130 | | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
| 3142 | + | |
| 3143 | + | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
3131 | 3217 | | |
3132 | 3218 | | |
3133 | 3219 | | |
| |||
3142 | 3228 | | |
3143 | 3229 | | |
3144 | 3230 | | |
| 3231 | + | |
3145 | 3232 | | |
3146 | | - | |
| 3233 | + | |
3147 | 3234 | | |
3148 | 3235 | | |
3149 | 3236 | | |
| |||
0 commit comments