Behaviour SwRS-MDOKFSTUDIO-BLOCK-169
Cut removes the selected blocks with one blank separator
When a writer cuts selected blocks, the host SHALL put their Markdown on the clipboard and delete them together with their blank separator in the line breaks of the document, after the range's trailing blank lines (spaces and tabs only) are dropped, so that no gap of two blank lines and no glued blocks are left, and answering that nothing was removed when the document changed during the clipboard write.
Another outcome at step 2 of path 1 in StRS-MDOKFSTUDIO-BLOCK-016, in the state “A run of blocks is selected”.
Step 1 of path 2 in StRS-MDOKFSTUDIO-BLOCK-025: from “A run of blocks is selected” to “The blocks are on the clipboard and gone from the document”.
Scenarios 7
The situations the tests check; open one to read it.
nominalMiddle block
boundaryWhere the cut span sits in the document
| Input | Outcome |
|---|---|
| A span that touches the block above and is followed by a blank line | The blank line after it stays so that the neighbours remain apart |
| The first block of a document with three blocks | No blank line starts the body after the cut |
| The last block of a document with three blocks | The blank line before the last block goes with it |
| The only block of the body | The body is empty |
| The last block of a document without a final line break | The document still has no final line break |
| A list in the middle whose range ends on the two blank lines after it | The clipboard holds the list without the blank lines; the list and the blank lines after it go, and the blocks around it stay one blank line apart, as Delete block leaves them |
A cut never leaves three line breaks in a row and never merges two paragraphs.
boundaryLine breaks of what remains
| Input | Outcome |
|---|---|
| A document with CR LF line breaks, a block is cut | No bare LF appears in the remaining text |
| A document with LF line breaks, a block is cut | No CR appears |
nominalThe block after a cut keeps its place on the screen
| Input | Outcome |
|---|---|
| A cut with pinViewportTop 200 and a block after the span | The host stores a pin for the first line of the cut span with that viewport top, and the next render puts the line of the span at viewport top 200 |
| A cut of the last block, no block follows the span | No pin is stored |
refusalThe document changed during the clipboard write
| Input | Outcome |
|---|---|
| A cut whose clipboard write is pending while the document is edited | When the write completes, the answer is ok false with "The document changed while cutting. The blocks are on the clipboard, nothing was removed." and the document is unchanged |
| No change during the write | When the write completes, the blocks are removed |