Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TABLE-007

Table column handle reorders columns in edit mode

When the writer drags the handle above a column of a pipe table or a list-table in edit mode onto another column, or presses Alt+Left or Alt+Right on that handle, the extension SHALL move that column to the new position in every row as one source edit.

Step 1 of path 2 in StRS-MDOKFSTUDIO-TABLE-002: from “A table is shown in edit mode with a handle above each column” to “The column is at its new position”.

Scenarios 9

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

nominalDragging the handle of a column
InputOutcome
Edit mode on, a pipe table of three columns, the handle of the first column dropped on the right half of a cell of the third columnThe column sits after the third: every line of the table (header, delimiter row and body rows) has its cells in the new order, each cell keeping its own spacing, and the alignment colons of the delimiter row travel with their column; the document gets one text edit and the text outside the table is unchanged
The same drag dropped on the left half of a cell of the third columnThe column sits before the third column
While the pointer is held over a columnThe dragged column is dimmed and a line on the left or the right of the column under the pointer shows where it would land, until the drop or the end of the drag
Dropped on the half of the next column that leaves the column in place, or on the column itselfNothing is requested from the host and the document is not edited
The pointer is held anywhere over the columns of the table or over the strip of the handles above the table (over another column's handle too)The marker shows on the nearest gap: the line on the left of the column when the pointer is on its left half, on the right on its right half; it follows the pointer from column to column and a drop there moves the column
The pointer leaves the table and its handle stripNo marker shows; a drop there requests nothing and the document is not edited
nominalKeyboard move with Alt+Left and Alt+Right
InputOutcome
Focus on the handle of the second column, Alt+RightThe column swaps with the third as one edit, and after the render the focus is on the handle of the column at its new place
Alt+Left on the handle of the first column, or Alt+Right on that of the lastNothing happens
Alt+Right repeated before the render of the previous move arrivedThe repeat is ignored: the cells on the page are stale until the render arrives
nominalA block id at the end of a row stays at the end of the row
InputOutcome
A pipe table row `| alpha | 1 | first ^row-b |` and the last column moved left (drag, or Alt+Left on its handle), or a column inserted after the lastThe row reads `| alpha | first | 1 | ^row-b`: the block id (whitespace, then `^` and letters, digits or dashes, at the end of the last cell) leaves the cell and follows the closing pipe, where a `#^row-b` link finds it; the preview no longer shows it. A cell that is only `^row-b` is left empty
A row whose text after the closing pipe is already a tail (`| alpha | 1 | first | ^row-a`), any column movedThe tail stays at the end of the line and nothing is lifted
`<a id="x"></a>` or other text in the last cellIt moves with its cell: only a block id names the row
A table with a token after the closing pipe of one row (`^row-a`, `{#row-c}`, `<!-- keep -->`)Its handles move it like any table and a click on a cell opens the cell editor
nominalThe handle above its column
InputOutcome
Edit mode on, a pipe table or a `{list-table}` of at least two columnsEach column shows the handle of the frontmatter list editor, turned (named "Move table column"), just above the table, outside its cells and horizontally centred on the column, header or not; a table of one body row has these handles too
The bar of an open cell editor above the tableThe bar leaves the room of the handles between it and the table
The page is resized, the zoom changes or a table scrolls sidewaysThe handles follow the header cells
A table that breaks out of the margin (Auto width), or that returns to the column, after the handles were placed or after a column move rendered the page againThe handles are placed again on the top of each column of the table as laid out now
Edit mode switched offThe handles are gone
A click on a handleNo cell editor opens
nominalMoving a column of a `{list-table}`
InputOutcome
A `{list-table}` with `:header-rows: 1` and three columns, the handle of the first column dropped after the thirdIn every item (header rows included) the first cell, with the continuation lines under it, now follows the third; the first cell of each item always carries the item marker `* -` and the others ` -`; an empty cell stays an empty item
A `:widths:` option with one number per columnThe numbers move with the column
The directive line, the title, the other options, the indentation, the fence style, the blank lines between items and the line endingsUnchanged
Rows that do not all have the same number of cells, or an item that is not a list of cellsThe move is refused and the document is not edited
nominalA cell editor of the table is open
InputOutcome
A cell editor of the pipe table is open (its source has arrived) and a column handle is dragged or Alt+Left or Alt+Right is pressed on itThe text of the open cell is part of the table that moves; the column is moved in the editor's model and the editor is saved and closed as one edit, with no request for the table source
The cell editor has not received the source of its table yetThe drag is cancelled and the key is ignored
refusalTables and states without a column move
InputOutcome
A table inside a figure that is not a `{list-table}` (a `{table}` with a caption), an HTML table, a table of an included file, the properties table, a table of one columnNo handle is shown
A drag or a key while a block editor, a frontmatter editor or a cell editor of another table is open, or while a move waits for its renderThe drag is cancelled or the key is ignored and nothing is requested
The host answers the request for the source with an error, or the source is no table that can be read as columns, or the move is refused by the table model (an index outside the table, the same place)No edit is saved and the page tells the host the move is closed
boundaryA table inside a quote or an admonition
InputOutcome
The handle of a column of a pipe table inside a blockquote, a GFM alert or a MyST admonition, dragged or moved with Alt+Left or Alt+RightThe column moves as for a top-level table and every line of the table keeps its container prefix; a source holding no pipe table or more than one is refused and nothing is saved (see SwRS-MDOKFSTUDIO-TABLE-121)
boundaryHandle strip at the top of the page
Giventhe 1400x900 real VS Code window of the integration suite (preview frame 656 px wide), edit mode and a pipe table or a list-table right under the first heading, page at its top
Whena column handle is dragged and held in the handle strip at 80 percent of the third column
Thenthe element at the pointer is not inside the toolbar: the toolbar (x 540 to 642, y 12 to 146 in the frame) ends right of the strip point (x 504 for the pipe table, 453 for the list-table)

Implemented in 3

Tested by 6

Known limits (3)