Skip to main content

LensStudio:Ui.TextCursor.MoveMode

Enum

Enum controlling whether moving the cursor moves the anchor or keeps it to extend the selection.

Index

Enumeration Members

Example

// TextCursor.MoveMode controls whether cursor movement clears or extends selection.
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
root.layout = layout;

const edit = new TextEdit(root);
edit.plainText = 'Select some text here to test MoveMode.';
layout.addWidget(edit);

const cursor = edit.textCursor;
// MoveAnchor: moves cursor and clears any selection
cursor.movePosition(TextCursor.MoveOperation.Start, TextCursor.MoveMode.MoveAnchor);
// KeepAnchor: moves cursor but keeps anchor, creating a selection
cursor.movePosition(TextCursor.MoveOperation.EndOfLine, TextCursor.MoveMode.KeepAnchor);

Enumeration Members

KeepAnchor

KeepAnchor: number

Moves only the cursor while keeping the anchor fixed, extending or creating a selection.


MoveAnchor

MoveAnchor: number

Moves both the cursor and the anchor to the new position, collapsing any selection.