class KTextEditor.Cursor |
|
|
An object which represents a position in a Document. A Cursor is a basic class which contains the line() and column() a position in a Document. It is very lightweight and maintains no affiliation with a particular Document. If you want additional functionality such as the ability to maintain position in a document, see SmartCursor. The Cursor class is designed to be passed via value, while SmartCursor and derivatives must be passed via pointer or reference as they maintain a connection with their document internally and cannot be copied. Lines and columns start at 0. Think of cursors as having their position at the start of a character, not in the middle of one. If a Cursor is associated with a Range the Range will be notified whenever the cursor (i.e. start or end position) changes its position. Read the class documentation about Range%s for further details. See also SmartCursor |
|
|
|
|
|
|
|
|
|
|
|
|
The default constructor creates a cursor at position (0,0). |
|
This constructor creates a cursor initialized with line and column. line - line for cursor column - column for cursor |
|
Copy constructor. Does not copy the owning range, as a range does not have any association with copies of its cursors.
copy - the cursor to copy. |
|
Determine if this cursor is located at the start of a document. Returns true if the cursor is situated at the start of the document, false if it isn't. |
|
Determine if this cursor is located at the start of a line. Returns true if the cursor is situated at the start of the line, false if it isn't. |
|
Retrieve the column on which this cursor is situated. Returns column number, where 0 is the first column. |
|
Internal Notify the owning range, if any, that this cursor has changed directly. |
|
Returns an invalid cursor. |
|
Returns whether this cursor is a SmartCursor. |
|
Returns whether the current position of this cursor is a valid position (line + column must both be >= 0). Smart cursors should override this to return whether the cursor is valid within the linked document. |
|
Retrieve the line on which this cursor is situated. Returns line number, where 0 is the first line. |
|
|
Returns the range that this cursor belongs to, if any. |
|
Set the cursor column to column. column - new cursor column |
|
Set the cursor line to line. line - new cursor line |
|
Position The following functions provide access to, and manipulation of, the cursor's position. \{ Set the current cursor position to position.
position - new cursor position To do: add bool to indicate success or not, for smart cursors? |
|
Set the cursor position to line and column.
line - new cursor line column - new cursor column |
|
Internal Sets the range that this cursor belongs to.
range - the range that this cursor is referenced from. |
|
Returns a cursor representing the start of any document - i.e., line 0, column 0. |
|
Returns this cursor as a SmartCursor, if it is one. |