ICursor
interface is implemented by a cursor object. Each document view has a single read-only instance of a cursor object, which can be used to manage editor window's multiple cursors.
interface ICursor {
// Properties
readonly ${offset}: number;
readonly ${singleCursor}: boolean;
readonly ${all}: number[];
// Methods
${move}(action: ${CursorAction}, flags = ${ActionFlags}.None): void;
${moveTo}(offset: number, flags = ${ActionFlags}.None): void;
}
// This interface is not available in managed environment
// This interface is not available in native environment
readonly offset: number;
// This property is not available in managed environment
// This property is not available in native environment
Returns the main cursor offset.
readonly singleCursor: boolean;
// This property is not available in managed environment
// This property is not available in native environment
Returns true
if the cursor object has only a single cursor and false
otherwise.
readonly all: number[];
// This property is not available in managed environment
// This property is not available in native environment
Returns all cursors in an array.
move(action: ${CursorAction}, flags = ${ActionFlags}.None): void;
// This method is not available in managed environment
// This method is not available in native environment
action
flags
Emulates the pressing of a specified keyboard key. Optional flags
may add a key modifier to the action.
// Move the cursor two cells down
activeView.cursor.move(CursorAction.Down);
activeView.cursor.move(CursorAction.Down);
// Select the next row of data
activeView.cursor.move(CursorAction.Down, ActionFlags.Shift);
moveTo(offset: number, flags = ${ActionFlags}.None): void;
// This method is not available in managed environment
// This method is not available in native environment
offset
flags
Move the cursor to a given offset. If ActionFlags.Alt
modifier is set, adds new alternate cursor. If ActionFlags.Shift
modifier and optionally ActionFlags.Ctrl
are set, modifies the current selection.
// Move the cursor to 0x100, deleting all alternate cursors
activeView.cursor.moveTo(0x100);
// Add new alternate cursor at 0x200
activeView.cursor.moveTo(0x200, ActionFlags.Alt);