Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-REVIEW-094

Edits move the stored lines of a thread in memory and write nothing to its file

When lines are inserted or removed above a review thread in an edited document, the extension SHALL move the stored lines of the thread by the same number of lines in memory; the edit writes nothing to the comments file, and a change of a document without unsaved changes drops the lines followed in memory so that every thread is checked again against the new text.

Step 1 of path 1 in StRS-MDOKFSTUDIO-REVIEW-008: from “The text of a document with review threads changes” to “The stored lines of the thread have moved”.

Scenarios 8

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

nominalLines inserted above
Givena thread on lines 10 to 12, a thread on line 3 and two lines inserted at line 5
Whenthe document changes
Thenthe first thread is on lines 12 to 14 and the thread on line 3 is unchanged
nominalLines removed above
Giventhe same threads and the lines 5 and 6 removed (a change from line 4 to line 6)
Whenthe document changes
Thenthe first thread is on lines 8 to 10
boundarySeveral changes of one edit event move the thread once

Every change is read in the coordinates of the text before the event and the thread moves by their sum, whatever the order of the changes.

InputOutcome
a thread on line 20 and one event that inserts two lines at line 2, inserts two lines at line 10 and removes two lines at 15 to 17the thread is on line 22
the same changes listed in the opposite orderthe thread is on line 22 as well
boundaryA thread end line never falls before its first line
InputOutcome
a thread on lines 5 to 8 and a removal from line 6 to line 12endLine is not smaller than line
no change eventthe same threads are returned
nominalA quote still inside its lines keeps its thread there
Givena thread on line 3 quoting "quick brown fox" and a paragraph on line 3 holding it
Whenthe thread is checked against the document text
Thenthe thread stays anchored on line 3
with several copies of the quote in the document, one inside the old lines that fits the surroundings of the thread, the thread stays as well
boundaryA thread without a quote stays while its line exists
InputOutcome
a block-only thread (no quoted text) on line 3 in a document of 5 linesthe thread stays anchored
the same thread on line 30 in that documentthe thread is orphaned
refusalTyping writes nothing
Givena document with three threads and lines inserted above them
Whenthe edits are made without saving
Thenthe comments file on disk is unchanged
when the threads are posted again the page shows the threads on their new lines
boundaryChange of a clean document
InputOutcome
A document without unsaved changes changes (a revert, a reload from disk, an undo or a redo whose change event reports no unsaved changes)The lines followed in memory are dropped and the threads are checked again against the new text
The same change while the comments file text stays the sameThe threads are still checked again against the new text: the unchanged file does not skip the check, and later edits shift the new lines
An undo or a redo whose change event reports unsaved changes (the flag is the state before the change, so an undo back to the saved text still reports unsaved changes)The lines are shifted in memory as for any edit, then every thread is checked again against the new text starting from the lines followed in memory
A document with unsaved changes changes (not an undo or a redo)The lines are shifted in memory instead

Implemented in 2

Tested by 2