Repository navigation
Commit a92937d
feat(composer): style typed inline Markdown on the closing delimiter
Typing **bold**, __bold__, _italic_, *italic*, ~~strike~~ or `code` in
the message composer now converts the span to its mark as the closing
delimiter is typed, matching the previous Buzz client. The rule lives in
the new composer-inline-input.ts as applyComposerInlineInput(tr, typed),
which generalises and replaces composer-code-input.ts. It reparses the
masked document text with fromMarkdown plus gfmStrikethrough, the same
parser family the serialiser and timeline use, finds the strong,
emphasis, delete or inlineCode node ending at the caret on a single
line, and refuses anything reachable only through a link, image, HTML
or fenced code. Nested spans such as ***x*** add one mark per node and
delete their delimiters from the end so positions stay valid. The
unmatched-opener guard from the code rule now applies to every
delimiter, so **a* waits for the second asterisk instead of italicising
midway. Spans carrying code, link or literal marks, or lying in a code
block, stay literal, and every delimiter must sit at an editable
boundary rather than inside an atom. Emphasis marks apply across mention
and emoji atoms so chips and recipients survive; only the code path
still expands tokens into literal text, as before. Single-tilde ~x~ is
deliberately excluded (singleTilde: false): the serialiser emits ~~x~~
and a lone ~ in prose must not strike while typing.
EditableInput dispatches the conversion as a second transaction with
closeHistory before and separateHistory after. One undo therefore
restores the literal source including the closing character, where the
old code rule left `abc without its closing backtick, and the next
keystroke never merges into the conversion. Near the length limit the
typed character can be filtered out, in which case nothing converts.
After a conversion the new marks are dropped from stored marks so
continued typing is plain; code still clears them all.
mentionDraft now treats *, ~ and ` as mention boundaries, like the
timeline's raw binder, which continues a name only through letters,
digits and underscore. Without this the first closing delimiter typed
after a chip revoked its recipient before the second one arrived, and
the two-transaction flow would have dropped provenance for `@Honey`
too. An underscore remains a name suffix.
markdownRanges drops its unused bold output. docs/channels.md gains a
sentence on the typed inline conversion beside the fence behaviour.
Tests cover **Hello** conversion, plain continuation, single-step undo
and persistence, the closing backtick surviving undo, canonical wire
forms for __x__, *x*, _x_ and ~~x~~, both marks for ***x***, ~y~ left
literal, **a* waiting for **a**, snake_case staying literal while 5*3*2
italicises 3 as the renderer would, no conversion inside inline code, a
code block, a linked or literal label or for pasted delimiters, the
mention chip and recipient surviving **@honey**, the new mention
boundaries, and a Chromium journey typing **Hello** through undo, redo
and send.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Matt Toohey <[email protected]>1 parent 1ce9b34 commit a92937d
9 files changed
Lines changed: 467 additions & 122 deletions
File tree
- docs
- src/features/messages
- tests/browser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
531 | 534 | | |
532 | 535 | | |
533 | 536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
153 | 298 | | |
154 | 299 | | |
155 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
906 | 909 | | |
907 | 910 | | |
908 | 911 | | |
909 | | - | |
910 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
911 | 919 | | |
| 920 | + | |
912 | 921 | | |
913 | 922 | | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
918 | 931 | | |
919 | 932 | | |
920 | 933 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | | - | |
164 | | - | |
165 | | - | |
| 165 | + | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
186 | | - | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
0 commit comments