Behaviour SwRS-MDOKFSTUDIO-LIFE-108
Scrolling or clicking the preview reveals the source line
When the reader scrolls the preview to another source line or activates a rendered block outside edit mode, the extension SHALL reveal that source line in the visible text editor that shows the preview's file, as the settings allow, and leave every editor unmoved when no visible text editor shows that file or the report names another file.
Step 2 of path 1 in StRS-MDOKFSTUDIO-LIFE-010: from “The preview shows the line of the editor” to “Both panes show the same source line”.
Scenarios 10
The situations the tests check; open one to read it.
nominalScrolling posts the new top line
Givenanchor mode and scrollEditorWithPreview on and the reader scrolling from line 10 to line 14.6
a scroll that leaves the rounded line at 14
a scroll that leaves the rounded line at 14
Whenthe scroll frame runs
the next frame runs
the next frame runs
Thenthe page posts previewScroll with line 14
no second previewScroll is posted; with the anchor mode off the page posts only previewState
no second previewScroll is posted; with the anchor mode off the page posts only previewState
nominalThe host reveals the line at the top of the editor
Givena preview and a text editor of the same file, scrollPreviewWithEditor and scrollEditorWithPreview on
scrollEditorWithPreview off
scrollEditorWithPreview off
Whenthe host receives previewScroll with line 14
the message arrives
the message arrives
Thenthe editor shows line 14 at its top and its caret does not move
the editor is not moved
the editor is not moved
nominalClicking a block reveals its source line
| Input | Outcome |
|---|---|
| a click on a paragraph that starts at source line 2, in reading mode, scrollEditorWithPreview on, the text editor scrolled elsewhere | the page posts previewReveal with activation click and the block's source line (line 50 in the unit test); the editor reveals line 2, centred when it was outside the viewport |
| a click on a link, a checkbox, a comment chip or an insertion control | no source line is revealed |
| a click while scrollEditorWithPreview is off | no source line is revealed |
nominalEnter or Space on a focused block
| Input | Outcome |
|---|---|
| Enter on a focused paragraph in reading mode | the page posts previewReveal with activation keyboard and the host reveals the line |
| Space on a focused rendered block outside edit mode | the page posts previewReveal with activation keyboard for that block's source line |
| Enter with the focus in a button, an input, a link or the Description toggle | no reveal is posted |
boundaryA text diff shows the file
| Input | Outcome |
|---|---|
| a diff whose original side is a git or virtual document at the path of the file and whose modified side is the file | the line is revealed in the modified side only |
| a diff with no side of the file scheme | no editor moves |
refusalNo text editor shows the file
Givena preview with no visible text editor of its file
a text editor of another file
a text editor of another file
Whenthe reader scrolls or clicks in the preview
the reader scrolls the preview
the reader scrolls the preview
Thenno editor is created and the document is unchanged
that editor does not move
that editor does not move
refusalA report that names another source file
| Input | Outcome |
|---|---|
| previewReveal whose sourceFile is another path | the editor is not moved |
| previewScroll that carries a line and no source file | the line is revealed in the editor of the preview's file |
| previewScroll or previewReveal naming a stale or foreign render | refused before this rule runs, see SwRS-MDOKFSTUDIO-TRUST-065 |
boundaryThe revealed line stays inside the document
| Input | Outcome |
|---|---|
| a document of 50 lines and a reveal of line 400 | line 50 is revealed |
| a reveal request below line 1 | line 1 is revealed |
boundaryAccepted shape of previewScroll and previewReveal
| Input | Outcome |
|---|---|
| line, endLine, sourceLine or selectionLine a safe integer of at least 1 | accepted |
| anchorLine a finite number of at least 1 and scrollTop a finite number of at least 0 | accepted |
| activation click or keyboard, and a sourceFile string | accepted; the validator does not check them, the host compares the sourceFile path with the active document |
| line 0, line 1.5, anchorLine below 1 or a negative scrollTop | malformed: dropped by the envelope check without a visible change, the editor is not moved (see SwRS-MDOKFSTUDIO-TRUST-052) |
| a well-formed previewScroll while scrollPreviewWithEditor is off | the reading state is recorded, the editor is not moved |
boundaryDefaults, the setting off and the double click
| Input | Outcome |
|---|---|
| No stored value for markdownOkfSchemaStudio.preview.scrollEditorWithPreview, preview settings read | The setting is true (on by default) |
| scrollEditorWithPreview set to false and the reader scrolls or clicks in the preview | The editor does not move |
| The reader double-clicks rendered content outside edit mode | The page posts nothing beyond the reveals of its two clicks; there is no double-click setting (a doubleClickToSwitchToEditor value left in the user settings is not a setting of the extension and has no effect) |
Implemented in 3
Tested by 7
Replaces
SwRS-MDOKFSTUDIO-LIFE-097Two settings decide how the panes follow each other superseded superseded by SwRS-MDOKFSTUDIO-LIFE-100, SwRS-MDOKFSTUDIO-LIFE-108 Markdown file