Commit 4340227
authored
fix: Off-by-one symbol range for headings ending with supplementary Unicode characters (#455)
Use Char.IsHighSurrogate instead of Char.IsSurrogate when computing the
end offset in sourceSpanToRange. When a span ends on a low surrogate
(the second code unit of a surrogate pair), adding 2 produces an
out-of-bounds position. Adding 1 is correct since the position already
points to the last code unit.
Fixes #4531 parent 8249efa commit 4340227
2 files changed
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
469 | 484 | | |
470 | 485 | | |
471 | 486 | | |
472 | | - | |
| 487 | + | |
| 488 | + | |
473 | 489 | | |
474 | 490 | | |
475 | 491 | | |
476 | 492 | | |
| 493 | + | |
477 | 494 | | |
478 | 495 | | |
479 | 496 | | |
| |||
487 | 504 | | |
488 | 505 | | |
489 | 506 | | |
490 | | - | |
| 507 | + | |
| 508 | + | |
491 | 509 | | |
492 | 510 | | |
493 | 511 | | |
494 | 512 | | |
| 513 | + | |
495 | 514 | | |
496 | 515 | | |
497 | 516 | | |
| |||
0 commit comments