Contains the cursor position and the text selection of an edit session.
The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.
Contains the cursor position and the text selection of an edit session.
The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.
Creates a new Selection object. ...
Creates a new Selection object.
| session | EditSession | Required. The session to use |
[Empties the selection (by de-selecting it). This function also emits the 'changeSelection' event.]{: #Selection.c...
Empties the selection (by de-selecting it). This function also emits the 'changeSelection' event.
Gets the current position of the cursor. ...
Gets the current position of the cursor.
Returns an object containing the row and column of the calling selection anchor. ...
Returns an object containing the row and column of the calling selection anchor.
Returns an object containing the row and column of the calling selection lead. ...
Returns an object containing the row and column of the calling selection lead.
Returns true if the selection is going backwards in the document. ...
Returns true if the selection is going backwards in the document.
Returns true if the selection is empty. ...
Returns true if the selection is empty.
Returns true if the selection is a multi-line. ...
Returns true if the selection is a multi-line.
Merges overlapping ranges ensuring consistency after changes ...
Merges overlapping ranges ensuring consistency after changes
Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document. ...
Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.
Moves the cursor down one row. ...
Moves the cursor down one row.
Moves the cursor to the end of the file. ...
Moves the cursor to the end of the file.
Moves the cursor to the start of the file. ...
Moves the cursor to the start of the file.
Moves the cursor left one column. ...
Moves the cursor left one column.
Moves the cursor to the end of the line. ...
Moves the cursor to the end of the line.
Moves the cursor to the start of the line. ...
Moves the cursor to the start of the line.
Moves the cursor right one column. ...
Moves the cursor right one column.
Moves the cursor to the row and column provided. [If preventUpdateDesiredColumn is true, then the cursor stays i...
If preventUpdateDesiredColumn is true, then the cursor stays in the same column position as its original point.
Moves the cursor to the screen position indicated by row and column. If preventUpdateDesiredColumn is true, then the cursor stays in the same column position as its original point. ...
Moves the cursor to the screen position indicated by row and column. If preventUpdateDesiredColumn is true, then the cursor stays in the same column position as its original point.
Moves the cursor up one row. ...
Moves the cursor up one row.
Moves the cursor to the word on the left. ...
Moves the cursor to the word on the left.
Moves the cursor to the word on the right. ...
Moves the cursor to the word on the right.
Gets list of ranges composing rectangular block on the screen ...
Gets list of ranges composing rectangular block on the screen
/ this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) { var rectSel = [];
var xBackwards = screenCursor.column < screenAnchor.column;
if (xBackwards) {
var startColumn = screenCursor.column;
var endColumn = screenAnchor.column;
} else {
var startColumn = screenAnchor.column;
var endColumn = screenCursor.column;
}
var yBackwards = screenCursor.row < screenAnchor.row;
if (yBackwards) {
var startRow = screenCursor.row;
var endRow = screenAnchor.row;
} else {
var startRow = screenAnchor.row;
var endRow = screenCursor.row;
}
if (startColumn < 0)
startColumn = 0;
if (startRow < 0)
startRow = 0;
if (startRow == endRow)
includeEmptyLines = true;
for (var row = startRow; row <= endRow; row++) {
var range = Range.fromPoints(
this.session.screenToDocumentPosition(row, startColumn),
this.session.screenToDocumentPosition(row, endColumn)
);
if (range.isEmpty()) {
if (docEnd && isSamePoint(range.end, docEnd))
break;
var docEnd = range.end;
}
range.cursor = xBackwards ? range.start : range.end;
rectSel.push(range);
}
if (yBackwards)
rectSel.reverse();
if (!includeEmptyLines) {
var end = rectSel.length - 1;
while (rectSel[end].isEmpty() && end > 0)
end--;
if (end > 0) {
var start = 0;
while (rectSel[start].isEmpty())
start++;
}
for (var i = end; i >= start; i--) {
if (rectSel[i].isEmpty())
rectSel.splice(i, 1);
}
}
return rectSel;
}; }).call(Selection.prototype);
// extend Editor var Editor = require("./editor").Editor; (function() {
/** extension Editor.updateSelectionMarkers()
Updates the cursor and marker layers.
| screenCursor | Cursor | Required. The cursor to use |
| screenAnchor | Anchor | Required. The anchor to use |
| includeEmptyLins | Boolean | Required. If true, this includes ranges inside the block which are empty due to clipping |
Selects all the text in the document. ...
Selects all the text in the document.
Selects a word, including its right whitespace. ...
Selects a word, including its right whitespace.
Moves the selection down one row. ...
Moves the selection down one row.
Moves the selection to the end of the file. ...
Moves the selection to the end of the file.
Moves the selection to the start of the file. ...
Moves the selection to the start of the file.
Moves the selection left one column. ...
Moves the selection left one column.
Selects the entire line. ...
Selects the entire line.
Moves the selection to the end of the current line. ...
Moves the selection to the end of the current line.
Moves the selection to the beginning of the current line. ...
Moves the selection to the beginning of the current line.
Moves the selection right one column. ...
Moves the selection right one column.
Moves the selection up one row. ...
Moves the selection up one row.
Moves the selection to highlight the entire word. ...
Moves the selection to highlight the entire word.
Moves the selection to the first word on the left. ...
Moves the selection to the first word on the left.
Moves the selection to the first word on the right. ...
Moves the selection to the first word on the right.
Shifts the selection up (or down, if isBackwards is true) the given number of columns. ...
Shifts the selection up (or down, if isBackwards is true) the given number of columns.
| columns | Number | Required. The number of columns to shift by |