Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-LIFE-119

Both panes share one reading anchor that survives updates

When a preview is scrolled, rebuilt, re-laid out or edited, the extension SHALL define its scroll anchor as a source line (the editor's first visible line, and the preview's line at its reading line below the sticky heading band, with the very top of the page always being line 1) and keep that anchor through the update.

Step 1 of path 2 in StRS-MDOKFSTUDIO-LIFE-010: from “The preview is scrolled to a reading line” to “The same source line stays at the reading line after the update”.

Scenarios 8

The situations the tests check; open one to read it.

nominalReading the anchor line
InputOutcome
a preview scrolled down the pagethe anchor line is the line that starts at the reading line below the band, never the caret line; the editor top line is the floor of the anchor
a scroll position of 0the anchor line is line 1
nominalA line inside a long paragraph
InputOutcome
a paragraph of five source lines wrapped over twelve rendered lines, and source line 4 looked upthe position is the measured start of that line, not a proportional guess
a paragraph whose line starts cannot be measured reliably, and a line inside it looked upthe block's top and bottom bound the position
nominalA new render starts at the last anchor
InputOutcome
a preview whose anchor is line 80, and a new render is builtits boot context carries initialAnchor 80 and the page applies it before the first paint
no anchor yet and a visible editor whose zero-based first visible line is 30, the first render is builtits initial anchor is line 31 in one-based numbering
no anchor yet and the follow setting offno anchor is passed
nominalLayout changes re-apply the stored anchor
InputOutcome
an image loads, the pane is resized, the content changes size, the sticky band changes or the zoom changesthe page scrolls again to the stored anchor line instead of re-reading it from the scroll position
a preview scrolled to the middle of a long document, and the reader cycles the width mode through auto, full and marginthe same heading stays within 40 px of where it was
a sticky band that appears while the page is scrolledthe content does not move
a scroll whose layout pass runs before the scroll is handled (a viewport resize reported with each scroll, as in a webview next to an editor)the scroll sets the anchor first; the page stays where the reader scrolled
a pending scroll while blocks change position or height, such as a comment above the reading line closingthe stored anchor survives; the layout-induced scroll does not become a new reading position
boundaryLines added or removed above the anchor
InputOutcome
an anchor at line 50 and two lines inserted at line 10the anchor of each preview of that document is line 52
an edit at line 60 with the anchor at line 50the anchor stays line 50
nominalWhile a block or field editor is open
InputOutcome
an open block editor or frontmatter field editor whose text grows and the layout shiftsthe edited element stays where it was on screen
an open block editor and the text editor scrolled explicitlythe preview follows, the editor stays open and the element's anchor is the new position
nominalEvery mapped block carries its source mapping
Givena rendered document of a heading, paragraphs, an admonition and a figure
a figure directive and an element whose line attribute is 0, negative or not a number
Whenthe host builds the page
the host builds the page
Theneach element with a positive integer source line carries the source file, the source line, the document id and a block id source-block-1, source-block-2 and so on in document order; an element that spans several lines also carries its end line; no line is 0 or negative
the figure is keyboard-accessible with tabindex 0 (an element that is naturally focusable, or one that already carries a tabindex, keeps its own) and the invalid element gets no mapping attributes
refusalThe page measures only its own visible mapped blocks
InputOutcome
an element that names another document or another fileignored for scrolling and anchors
a mapped element with display noneignored
a mapping whose file path uses Windows separatorsthe backslashes are normalized and the document identity check still applies

Implemented in 4

Tested by 8