IndentContext

open class IndentContext(val state: EditorState, val simulateBreak: DocPos? = null, val simulateDoubleBreak: Boolean = false)

Context object passed to indent services and node prop strategies.

Mirrors CodeMirror 6's IndentContext. When simulateBreak is set, the context computes indentation as if a line break had been inserted at that position (used to answer "what indentation would this position get after pressing Enter"). simulateDoubleBreak additionally treats the break position as an empty line (Enter pressed twice).

Inheritors

Constructors

Link copied to clipboard
constructor(state: EditorState, simulateBreak: DocPos? = null, simulateDoubleBreak: Boolean = false)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val unit: Int

The indent unit size for this state.

Functions

Link copied to clipboard
fun lineAt(pos: DocPos, bias: Int = 1): Line

Get the document line at pos.

Link copied to clipboard
fun lineIndent(pos: DocPos, bias: Int = 1): Int

Get the indentation column at the start of the line at pos.

Link copied to clipboard
fun textAfterPos(pos: DocPos, bias: Int = 1): String

The text on the line at pos, starting from pos and capped at 100 characters. Honors simulateBreak/simulateDoubleBreak and bias. Matches CodeMirror's textAfterPos.