Repository navigation
Commit 0d083be
fix(composer): carry list parity and fence state across split paragraphs, write intraword emphasis with asterisks
Addresses the three review threads on PR #455 (kalvinnchau, 2026-09-30).
blocksMarkdown reset the marker parity on every non-list block while it
kept the last list kind across whitespace-only output, so a third list
separated from the second by an empty paragraph repeated the second
marker: `- a`, Shift+Enter twice, `- b`, Shift+Enter three times, `- c`
sent `- a\n\n* b\n\n\n\n* c`, which remark reads as two lists with one and
two items where the composer shows three. The parity now changes only
when a list is written and resets, with the list kind, only after a block
with visible output, so both values carry across empty paragraphs
together and the same input sends `- a\n\n* b\n\n\n\n- c`; the ordered
form sends `1. a\n\n1) b\n\n\n\n1. c`. Every existing expected string is
byte-for-byte unchanged.
Emphasis was written with _ unless the span held a recipient, and _
cannot open or close intraword, so the stock handler encoded both
neighbours as character references: typed foo*bar*baz sent
foo_bar_baz and 2*3*4 sent 2_3_4,
readable on the timeline but not to agents or the CLI reading the raw
event. The emphasis handler now also chooses * when the span touches a
word character, read from the wire neighbours the serializer hands it in
info.before and info.after rather than from the paragraph text, so a
delimiter another span writes beside the emphasis still counts as
punctuation: **_a_**_b_ and _a_**b** keep their underscores while
foo*bar*baz, 2*3*4, a*b* and **a*b*c** are sent as typed. The peek keeps
its recipient-only rule, since it only tells the preceding node which
character follows and both markers are punctuation to every rule that
reads it. The recipient case is unchanged.
composerCodeFence and composerBlockPrefix scanned fence state within the
caret's paragraph only, although sibling paragraphs serialise joined by
single newlines and the timeline reads them as one source. Typing ```,
undoing, Shift+Enter, `code`, Shift+Enter, then toggling the quote on and
off to split the empty line into its own paragraph and typing ``` turned
the closing fence into a second code block and sent an empty block after
the first. A new paragraphRun helper walks the caret's siblings in both
directions while they are paragraphs and maps the run's bounds to draft
offsets; the fence rule reads the earlier lines of the whole run for an
open block and the later lines for a closing fence, and the prefix rule
reads the earlier lines, so a marker typed under an open fence in a
previous paragraph stays literal too. A fence typed in a paragraph below
a closed block still opens a new one. No document change: docs/channels.md
already says only an opening fence converts and that lists separated by
empty lines alternate their markers.
Tests: the serializer case adds bullet and ordered three-list documents
with empty paragraphs between them, parsed as three single-item lists,
and a new case asserts foo*bar*baz, 2*3*4, a*b*, *b*c, a _b_ c, (_b_),
_b_, _a_**b** and **a*b*c** with the parsed emphasis. EditableInput adds
the exact wire snake_case_more 5*3*2 to the intraword case, types both
three-list sequences and asserts three lists on the wire and in the
parse, replays the reviewer's paragraph-split fence sequence and then
opens a block from a fence typed below the closed one, types the third
backtick of an opening fence whose closing line sits in a later split
paragraph, and types `- ` under a fence left open in an earlier paragraph.
All eight new or changed cases fail at cb486cfd and pass with the fix.
The messages folder passes (58 files, 1040 tests), tsc --noEmit is clean
and biome check --error-on-warnings passes for src/features/messages.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Matt Toohey <[email protected]>1 parent 721189f commit 0d083be
4 files changed
Lines changed: 264 additions & 23 deletions
File tree
- src/features/messages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
| |||
652 | 654 | | |
653 | 655 | | |
654 | 656 | | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
655 | 715 | | |
656 | 716 | | |
657 | 717 | | |
| |||
1099 | 1159 | | |
1100 | 1160 | | |
1101 | 1161 | | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
1102 | 1185 | | |
1103 | 1186 | | |
1104 | 1187 | | |
| |||
1147 | 1230 | | |
1148 | 1231 | | |
1149 | 1232 | | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1150 | 1243 | | |
1151 | 1244 | | |
1152 | 1245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
292 | 319 | | |
293 | 320 | | |
294 | 321 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
300 | 329 | | |
301 | 330 | | |
302 | 331 | | |
| |||
318 | 347 | | |
319 | 348 | | |
320 | 349 | | |
321 | | - | |
322 | | - | |
323 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
324 | 355 | | |
325 | 356 | | |
326 | 357 | | |
| |||
419 | 450 | | |
420 | 451 | | |
421 | 452 | | |
422 | | - | |
423 | | - | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
424 | 461 | | |
425 | 462 | | |
426 | 463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 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 | + | |
188 | 212 | | |
189 | 213 | | |
190 | 214 | | |
| |||
217 | 241 | | |
218 | 242 | | |
219 | 243 | | |
| 244 | + | |
| 245 | + | |
220 | 246 | | |
221 | 247 | | |
222 | 248 | | |
| |||
248 | 274 | | |
249 | 275 | | |
250 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 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 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
251 | 340 | | |
252 | 341 | | |
253 | 342 | | |
| |||
0 commit comments