Skip to content

Guard against null coordsAtPos in VerticalLines - #602

Open
c-tonneslan wants to merge 1 commit into
vslinko:mainfrom
c-tonneslan:fix-verticallines-null-coords
Open

Guard against null coordsAtPos in VerticalLines#602
c-tonneslan wants to merge 1 commit into
vslinko:mainfrom
c-tonneslan:fix-verticallines-null-coords

Conversation

@c-tonneslan

Copy link
Copy Markdown

Fixes #601.

VerticalLinesPluginValue.recursive() calls this.view.coordsAtPos(fromOffset, 1) and immediately reads coords.left / coords.right. CodeMirror's coordsAtPos() returns null when a position is temporarily outside the rendered viewport (during scroll, fold, tab switch, or remeasure), producing Uncaught TypeError: Cannot read properties of null (reading 'left').

This adds a null guard right after the call — matching the fix suggested in the issue. The skipped segment is redrawn on the next scheduled recalculation, so there is no visible regression. tsc --noEmit passes.

coordsAtPos() returns null when a position is temporarily outside the rendered
viewport (scroll, fold, tab switch), causing a TypeError reading coords.left.
Skip the pass and let the next recalculation redraw it. Fixes vslinko#601.

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
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.

[BUG]VerticalLinesPlugin throws when list coordinates are temporarily unavailable

1 participant