Behaviour SwRS-MDOKFSTUDIO-TABLE-094
Editing one cell changes exactly one line of the source
When a table is parsed and written back after a cell edit, a row insertion, a row deletion or no change, the extension SHALL change only the line the edit concerns, so that a cell edit changes one line, a new row adds one line, a deleted row removes one line and an unchanged table gives back exactly the original text; when a row is split into cells it SHALL accept rows with or without leading and trailing pipes, keep a pipe escaped with a backslash within its cell, and split a cell at every other pipe, also one inside a code span, as the preview does.
Another outcome at step 1 of path 2 in StRS-MDOKFSTUDIO-TABLE-013, in the state “A cell editor is open in a pipe table”.
Step 1 of path 1 in StRS-MDOKFSTUDIO-TABLE-014: from “A cell editor is open in a pipe table” to “Only the line of the cell is changed”.
Scenarios 15
The situations the tests check; open one to read it.
nominalUnchanged table gives back the original text
| Table written back with no change | Outcome |
|---|---|
| compact | output equals the input |
| padded | output equals the input |
| no spaces | output equals the input |
| aligned | output equals the input |
| no outer pipes | output equals the input |
| escaped pipe and pipe in a code span | output equals the input |
| indented | output equals the input |
| CRLF line endings | output equals the input |
| wider than the padding | output equals the input |
| CRLF table with an escaped pipe and a pipe in a code span | output equals the input |
nominalOne edited cell changes one line
the same two tables in a real window with the edit saved by Enter
the buffer is compared with the original
the diff is one line
nominalThe edited cell keeps its leading whitespace and its width
| Edit | Outcome | ||
|---|---|---|---|
| the padded cell " | first | " edited to a slightly longer value | the value fills the original cell width with trailing spaces, at least one |
| the same cell edited to a much longer value | the value gets one trailing space | ||
| a cell emptied, in a padded table | the table keeps its padding | ||
| an empty cell filled, in a padded table | the table keeps its padding | ||
| a cell emptied or filled, in a compact table | single spaces |
boundaryAny single cell edit parses again with that cell
| Input | Outcome |
|---|---|
| each header and body cell of every corpus table set to "" (the delimiter row is skipped) | the rows equal the edited model and at most one line changed |
| the same cells set to "x" | the rows equal the edited model and at most one line changed |
| the same cells set to a typed pipe between a and b | the pipe is saved escaped, the rows equal the edited model and at most one line changed |
| a cell set to the value it already holds | no line changes |
nominalA new row takes the style of a neighbouring body row
a table written "a | b" without outer pipes and a row inserted after the first body row
the table is written back
one parseable line "| | |" is added (the row is written with outer pipes) and the table parses again with the new empty row
nominalDeleting a row removes exactly one line
refusalThe header row is not deleted
boundaryEdge cells of rows without outer pipes and indented tables
| Input | Outcome |
|---|---|
| a table "a | b" over "c | d" with the first cell of the body row emptied | that row alone is rewritten canonically, keeping its indentation, the table parses with an empty cell and one line changed |
| the same table with the last cell of the body row emptied | that row alone is rewritten canonically, the table parses with an empty cell and one line changed |
| rows with a leading pipe only or a trailing pipe only and an edge cell emptied | the table still parses with the empty cell |
| a table whose rows are indented and one cell edited | only the edited row changes and its indentation is unchanged |
| the same indented table after Col + | the indentation is lost (see SwRS-MDOKFSTUDIO-TABLE-055) |
boundaryA row with text after its closing pipe
nominalRows without outer pipes
boundaryTrailing pipe after a backslash
nominalEscaped pipe
nominalEscaped pipe in backticks
boundaryUnescaped pipe in backticks
boundaryText after the closing pipe of a body row
the same extra cell in the header or in the delimiter row
the table is parsed
it is no pipe table of the editor, as it is none in the preview