Skip to content

Editor.setCursor method

Editor › setCursor

Official

Set the cursor position.

Signature:

setCursor(pos: number | EditorPosition, ch?: number | undefined): void

Parameters:

ParameterTypeDescription
posnumber | EditorPositionThe position to set the cursor to, or a line number (0-based).
ch?number | undefinedThe character index (0-based), if pos is a line number.

Returns: void

Since: 0.11.11

Example:

editor.setCursor({ line: 12, ch: 3 });
editor.setCursor(12, 3);