Skip to content

XUICETextSelection

Description

Represents a selection of text within the code editor.

Properties

Name Type Read-Only
Anchor Integer
EndLocation Integer
Length Integer
mOwnerRef WeakRef
Owner XUICodeEditor
StartLocation Integer

Methods

Name Parameters Returns
Clone XUICETextSelection
Constructor anchor As Integer, startPos As Integer, endPos As Integer, editor As XUICodeEditor
ContainsColumn column As Integer Boolean
ContainsLine line As XUICELine Boolean
InRange value As Integer, lower As Integer, upper As Integer Boolean
IntersectsLine line As XUICELine Boolean
SelectedColumnsInLine line As XUICELine XUICESelectedColumns
ToString String

Property Descriptions

Anchor As Integer

0-based position of this selection's anchor (original caret starting position).


EndLocation As Integer

0-based end position of this text selection.


Length As Integer

The length of this selection.


mOwnerRef As WeakRef

A weak reference to the MCEEditor that owns this text selection.


Owner As XUICodeEditor

The MCEEditor that owns this text selection.


StartLocation As Integer

0-based start position of this selection.


Method Descriptions

Clone() As XUICETextSelection

Returns a deep clone of this object.


Constructor(anchor As Integer, startPos As Integer, endPos As Integer, editor As XUICodeEditor)

Default constructor.

  • anchor is the 0-based location of the anchor.
  • startPos is the 0-based start position of this selection.
  • endPos is the 0-based end position of this selection.
  • editor is the editor that owns this selection.

The anchor marks the position that the selection began. Typically this will be the caret position when the selection begins but it's not necessarily the same as the start position. The anchor is typically set to -1 when it is not required.


ContainsColumn(column As Integer) As Boolean

True if column is within this selection.


ContainsLine(line As XUICELine) As Boolean

Returns True if this selection entirely contains line.

A line is considered to be contained by a selection if both its start and end locations are within this selection.


InRange(value As Integer, lower As Integer, upper As Integer) As Boolean

Returns True if value is within the passed bounds.


IntersectsLine(line As XUICELine) As Boolean

Returns True if any of this selection intersects line.

A line is intersected by a selection if any character of the line is within it.


SelectedColumnsInLine(line As XUICELine) As XUICESelectedColumns

If line is wholly or partly contained within this selection then returns the columns selected or Nil.

Returns an object representing the start and end columns contained by this selection or Nil if this selection does not intersect line. If this selection extends beyond the length of this line then the returned TextSelection will have its EndLocation set to -1. If this selection begins before this line then the returned TextSelection will have its Anchor set to -1. Otherwise it's set to 0.


ToString() As String

Returns the text selected by this selection in the owning editor.