Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-MYST-045

The host renames only the label text in one undo step

When the host receives a label rename, the extension SHALL change only the `(old)=` text of the stated line as one undo step of the source editor, keeping surrounding whitespace and CRLF endings, and when that line is no longer exactly `(old)=` change nothing and answer The label is no longer on that line. Refresh the preview, without searching other lines; it SHALL accept a previewLabelRename message only with a source line, two valid label names and the current render, and answer previewLabelRenameResult with the same edit id.

Step 2 of path 2 in StRS-MDOKFSTUDIO-MYST-009: from “The Rename label popover is open” to “The host holds a valid rename”.

Scenarios 7

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

nominalA valid rename edits only the label text
Giventhe line ` (old)=` with CRLF
Whena valid rename to `new` is accepted
Thenonly the label text changes, whitespace and CRLF stay, and one undo restores it
nominalThe uses of the old name are counted, not rewritten
Given`{ref}` uses of the old name
Whena rename is accepted
Thenthey are not rewritten and their count is returned as remainingRefs
refusalThe label line changed
Giventhe line edited to something else
Whena rename request arrives
Thenthe refusal The label is no longer on that line. Refresh the preview is returned and nothing changes
boundaryThe same label on another line is not touched
Giventhe same label present on another line
Whena rename request arrives
Thenthat other line is not touched; only the stated line is checked and no other line is searched
nominalA valid message is answered with its edit id
Givena previewLabelRename with line, old name, new name and edit id for the current render
Whenthe host receives it
ThenpreviewLabelRenameResult carries the same edit id with ok, remainingRefs or reason
refusalAccepted shape of the rename message
Field of previewLabelRenameAcceptedOtherwise
lineA source line (a safe integer, 1 or more)The validator rejects the message
oldNameA valid label name: letters, digits and `_ . : -`, 100 characters at mostThe validator rejects the message
newNameThe same pattern and bound as oldNameThe validator rejects the message
editIdOptional; repeated in the answer, which the page matches by itNot checked by the validator
render identityThe current renderThe gate drops or refuses the message (see SwRS-MDOKFSTUDIO-TRUST-065)

A message rejected by the validator changes nothing in the document.

refusalA message from a stale render
Givena previewLabelRename from a stale render
Whenthe host receives it
Thenthe host answers with ok false and the reason The label is no longer on that line. Refresh the preview., and nothing in the document changes

Implemented in 4

Tested by 5

Replaces

SwRS-MDOKFSTUDIO-MYST-046A valid rename edits only the label text as one undo step superseded superseded by SwRS-MDOKFSTUDIO-MYST-045 Markdown file
SwRS-MDOKFSTUDIO-MYST-051The label rename message is validated and answered superseded superseded by SwRS-MDOKFSTUDIO-MYST-045 Markdown file