Skip to content

CodeMirrorEditor.mapPos method

CodeMirrorEditor › mapPos

Unofficial

Map a position taken before the changes made during the operation in progress onto where it sits after them.

Signature:

mapPos(pos: EditorPosition, assoc?: number | undefined): EditorPosition

Parameters:

ParameterTypeDescription
posEditorPositionThe position to map.
assoc?number | undefinedWhich side of an insertion at that exact position the mapped position ends up on. Defaults to 1, after the insertion.

Returns: EditorPositionThe mapped position, or pos unchanged when no operation has made any changes.