Skip to content

pin panmirror to release/rstudio-parrot-balsam-01 - #19599

Draft
kevinushey wants to merge 2 commits into
mainfrom
bugfix/19588-visual-rangeerror
Draft

kevinushey wants to merge 2 commits into
mainfrom
bugfix/19588-visual-rangeerror

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Intent

Switching a document from Source to Visual mode fails with an error dialog, RangeError: Position N out of range, when the document contains an image wrapped in a link ([![alt](img.png)](https://...)) and ends with a link. The reporter's attachment reproduces it every time the document goes back to Visual after the first load.

Fixes #19588.

Approach

The cause is in panmirror, the visual editor, so the fix is quarto-dev/quarto#1228. During a setMarkdown reload, the figure-convert append handler turns each linked image back into a figure, which lengthens the document. The sync-heading-links handler then runs in the same transaction, scans link positions from the already-changed document, and shifts them by those same steps a second time. A link near the end of the document lands past the end, and resolve() throws. That PR maps each scanned position only through the steps added after its scan; its description has the details.

This PR moves PANMIRROR_BRANCH from release/rstudio-parrot-balsam to a new release/rstudio-parrot-balsam-01 in dependencies/common/install-panmirror and dependencies/windows/install-panmirror/clone-panmirror-repo.cmd. The pinned branch is treated as immutable, so the fix ships on a new numbered branch: release/rstudio-parrot-balsam plus a cherry-pick -x of the quarto-dev/quarto#1228 merge commit.

Draft until quarto-dev/quarto#1228 merges and release/rstudio-parrot-balsam-01 exists on quarto-dev/quarto; until then the install scripts' branch check fails CI.

Automated Tests

The regression tests are in quarto-dev/quarto#1228 (packages/editor/test/link-headings.test.ts). All three fail before that fix: two with the reported RangeError, and the third with a stale link.

End to end, with panmirror built from the fix and served by a dev server, a scratch Playwright spec (not checked in) toggles the reporter's document (CRLF and LF copies) Source -> Visual -> Source -> Visual twice with no error dialog. With the currently pinned panmirror, it fails on the first switch back to Visual.

QA Notes

  1. Open the visual_editor_rangeerror_repro.qmd attachment from Visual editor: "RangeError: Position N out of range" when toggling from Source, when document ends with a link and contains an image wrapped in a link #19588 (drop the .txt extension). It has editor: visual, so it opens in Visual mode.
  2. Switch to Source, then back to Visual.
  3. Before: an error dialog, RangeError: Position N out of range. After: the document switches with no error. Repeat a few times.
  4. The visual_editor_rangeerror_control_passes.qmd attachment should keep switching cleanly.

Documentation

None needed.

Checklist

  • If this PR adds a new feature, or fixes a bug in a previously released version, it includes an entry in NEWS.md
  • If this PR adds or changes UI, the updated UI meets accessibility standards (no UI change)
  • A reviewer is assigned to this PR (if unsure who to assign, check Area Owners list)
  • This PR passes all local unit tests

Picks up quarto-dev/quarto#1228, which fixes "RangeError: Position N out of
range" when switching a document with a linked image and a trailing link
from Source to Visual mode.

Addresses #19588.
@kevinushey kevinushey added this to the 2026.12 (Parrot Balsam) milestone Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

⚠️ The merged report could not be produced -- results below are incomplete or missing; see the run log.

-------------------- 0% pass rate

Passed Failed Skipped Flaky
0 0 0 0
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
no results 0 0 0 0

No report was published; see the run log.


All platforms - commit f46fa6a0b9eba437fe961d3871cdf7820cbe7896 - Run #2595

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visual editor: "RangeError: Position N out of range" when toggling from Source, when document ends with a link and contains an image wrapped in a link

1 participant