Commit e2eeed0
renderer: emit conceal replacement when concealed token is Space/Newline/Break
The renderer's `apply_conceal_ranges` had two code paths for tokens
that overlap a conceal range:
- Text tokens emit the conceal range's `replacement` text via
`emitted_replacements`.
- Space / Newline / Break tokens silently dropped the token
*without* emitting the replacement.
Fresh tokenizes whitespace separately from word characters, so
matching a word that ends right before a space (e.g. typing `PID`
in a buffer that contains `PID file lockup`) hits the second path.
Result: the space cell disappears AND the conceal's replacement
(flash plugin's label letter) never renders. Surrounding text
shifts left by one cell. User saw `PIDfile lockup` instead of
`PIDafile lockup` — a real layout-shifting bug.
Fix: have the Space/Newline/Break branch run the same replacement-
emission logic as the Text branch. `null` replacement still hides
the byte range with no output (existing behaviour preserved); a
non-empty `replacement` now emits its first char with the source
offset (so cursor/click positioning still works) plus the rest as
a continuation.
Reproducer test (CONTRIBUTING #1):
flash_label_does_not_eat_space_after_match — opens a buffer with
`PID file lockup` and typed `PID`, then asserts the rendered
screen does NOT contain `PIDfile`/`PIDfor`/`PIDline` (the buggy
collapse) AND that at least one match shows `PID<pool-letter><word>`
(the expected substituted-cell layout).
Verified the test FAILS without the renderer fix and PASSES with
it via a transient `git stash` cycle on the editor change.
Tests: 7 flash + 41 markdown_compose e2e tests all pass. Markdown
compose was the only other plugin using conceal — its substitutions
target Text tokens, so the Space/Newline/Break path never fired
for it and the fix is non-disruptive.1 parent 851e4b7 commit e2eeed0
2 files changed
Lines changed: 119 additions & 2 deletions
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
690 | | - | |
691 | | - | |
| 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 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
692 | 727 | | |
693 | 728 | | |
694 | 729 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 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 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
302 | 384 | | |
303 | 385 | | |
304 | 386 | | |
| |||
0 commit comments