Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-061

Tab, Shift+Tab and Enter indent and continue lists, quotes and fences

When a writer presses Tab, Shift+Tab or Enter in the text box of a block editor, the page SHALL indent or outdent every line touched by the selection, or continue the list marker, quote prefix or indentation of the current line, and leave the key to the text box when no rule applies.

Step 1 of path 1 in StRS-MDOKFSTUDIO-BLOCK-008: from “A block editor is open on a list” to “The next item starts with its marker”.

Scenarios 7

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

nominalTab indents the lines touched by the selection
InputOutcome
Selection over the list lines `- a` and `- b`Each gains two spaces (` - a`, ` - b`); a numbered `1. a` gains three, `10. a` four
Selection over two prose linesEach gains four spaces; a quote prefix stays in front; the editor stays open
Collapsed caret on the prose line `some prose` after `some`The text becomes `some prose` with the caret after the four spaces
Collapsed caret at the end of the list line `- a`The whole line is indented by the marker width instead: ` - a`
nominalShift+Tab outdents the touched lines
InputOutcome
` - a` with the caret at its endThe line becomes ` - a`
` - a`The line becomes `- a`
` plain`The line becomes `plain`
`- a` (nothing to remove)The text is unchanged, the key is still consumed and the editor stays open

Up to one indentation unit, or one tab, is removed from the start of every touched line.

nominalEnter continues the list marker
InputOutcome
`- a`, `* a` or `+ a` with the caret at the endThe next line starts with the same bullet and a space
`1. a`The next line starts with `2. `
`9) a`The next line starts with `10) `
An indented itemThe next line keeps the indentation
`- [x] done`The next item starts with `- [ ] ` (box reset)
`- ( ) a` or `- (x) a` (an option item)The next item starts with `- ( ) ` (marker reset); a numbered `1. ( ) a` gives `2. ( ) `
`- ab` with the caret between a and bThe line splits into `- a` and `- b`
nominalEnter continues a quote prefix or the indentation
InputOutcome
`> quote` with the caret at its endThe next line starts with `> `
` code` with the caret at its endThe next line starts with four spaces
`plain` without indentationThe page leaves the key to the text box

The list marker, the quote prefix and the indentation are the only constructs that Enter continues.

boundaryEnter on an empty list item or quote line
InputOutcome
The lines `a`, ` - ` and `b` with the caret on the empty itemThe item line becomes empty and the caret sits on it
The line `> ` with the caret at its endThe line becomes empty
The line `- ( ) ` (an option item with no text) with the caret at its endThe line becomes empty, which ends the option list
boundaryEnter inside a fenced code block
InputOutcome
`` ```\n x `` with the caret after the x, inside the fenceThe next line starts with two spaces
`` ```\n- a `` with the caret at the end of the last lineThe key is left to the text box; after the closing fence a list is continued again

Only the indentation of the current line is continued while an odd number of fence lines lies above the caret.

refusalThe key stays native
InputOutcome
Tab with Ctrl, Cmd or Alt held, or during an IME compositionThe page does not handle the key; Ctrl+Tab still reaches VS Code
Shift+Enter at the end of a list itemThe text box inserts a plain line break without a marker
Enter with Alt, Ctrl or Cmd, with a non-collapsed selection or during an IME compositionThe page leaves the key to the text box
Enter with the caret before or inside the marker, as in `|- a`, `-| a` or `- (| ) a`The page does not continue the list

Implemented in 1

Tested by 4