tabs to spaces

This commit is contained in:
Fabian Jakobs 2012-05-01 11:48:45 +02:00
commit ac364fe0c5
97 changed files with 577 additions and 577 deletions

View file

@ -78,11 +78,11 @@ var Document = function(text) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
/** /**
* Document.setValue(text) -> Void * Document.setValue(text) -> Void
* - text (String): The text to use * - text (String): The text to use
* *
* Replaces all the lines in the current `Document` with the value of `text`. * Replaces all the lines in the current `Document` with the value of `text`.
**/ **/
this.setValue = function(text) { this.setValue = function(text) {
var len = this.getLength(); var len = this.getLength();
this.remove(new Range(0, 0, len, this.getLine(len-1).length)); this.remove(new Range(0, 0, len, this.getLine(len-1).length));
@ -90,21 +90,21 @@ var Document = function(text) {
}; };
/** /**
* Document.getValue() -> String * Document.getValue() -> String
* *
* Returns all the lines in the document as a single string, split by the new line character. * Returns all the lines in the document as a single string, split by the new line character.
**/ **/
this.getValue = function() { this.getValue = function() {
return this.getAllLines().join(this.getNewLineCharacter()); return this.getAllLines().join(this.getNewLineCharacter());
}; };
/** /**
* Document.createAnchor(row, column) -> Anchor * Document.createAnchor(row, column) -> Anchor
* - row (Number): The row number to use * - row (Number): The row number to use
* - column (Number): The column number to use * - column (Number): The column number to use
* *
* Creates a new `Anchor` to define a floating point in the document. * Creates a new `Anchor` to define a floating point in the document.
**/ **/
this.createAnchor = function(row, column) { this.createAnchor = function(row, column) {
return new Anchor(this, row, column); return new Anchor(this, row, column);
}; };
@ -131,10 +131,10 @@ var Document = function(text) {
/** internal, hide /** internal, hide
* Document.$detectNewLine(text) -> Void * Document.$detectNewLine(text) -> Void
* *
* *
**/ **/
this.$detectNewLine = function(text) { this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r\n|\r|\n)/m); var match = text.match(/^.*?(\r\n|\r|\n)/m);
if (match) { if (match) {
@ -194,63 +194,63 @@ var Document = function(text) {
}; };
/** /**
* Document.isNewLine(text) -> Boolean * Document.isNewLine(text) -> Boolean
* - text (String): The text to check * - text (String): The text to check
* *
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`). * Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
* *
**/ **/
this.isNewLine = function(text) { this.isNewLine = function(text) {
return (text == "\r\n" || text == "\r" || text == "\n"); return (text == "\r\n" || text == "\r" || text == "\n");
}; };
/** /**
* Document.getLine(row) -> String * Document.getLine(row) -> String
* - row (Number): The row index to retrieve * - row (Number): The row index to retrieve
* *
* Returns a verbatim copy of the given line as it is in the document * Returns a verbatim copy of the given line as it is in the document
* *
**/ **/
this.getLine = function(row) { this.getLine = function(row) {
return this.$lines[row] || ""; return this.$lines[row] || "";
}; };
/** /**
* Document.getLines(firstRow, lastRow) -> [String] * Document.getLines(firstRow, lastRow) -> [String]
* - firstRow (Number): The first row index to retrieve * - firstRow (Number): The first row index to retrieve
* - lastRow (Number): The final row index to retrieve * - lastRow (Number): The final row index to retrieve
* *
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`. * Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
* *
**/ **/
this.getLines = function(firstRow, lastRow) { this.getLines = function(firstRow, lastRow) {
return this.$lines.slice(firstRow, lastRow + 1); return this.$lines.slice(firstRow, lastRow + 1);
}; };
/** /**
* Document.getAllLines() -> [String] * Document.getAllLines() -> [String]
* *
* Returns all lines in the document as string array. Warning: The caller should not modify this array! * Returns all lines in the document as string array. Warning: The caller should not modify this array!
**/ **/
this.getAllLines = function() { this.getAllLines = function() {
return this.getLines(0, this.getLength()); return this.getLines(0, this.getLength());
}; };
/** /**
* Document.getLength() -> Number * Document.getLength() -> Number
* *
* Returns the number of rows in the document. * Returns the number of rows in the document.
**/ **/
this.getLength = function() { this.getLength = function() {
return this.$lines.length; return this.$lines.length;
}; };
/** /**
* Document.getTextRange(range) -> String * Document.getTextRange(range) -> String
* - range (Range): The range to work with * - range (Range): The range to work with
* *
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc} * [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
**/ **/
this.getTextRange = function(range) { this.getTextRange = function(range) {
if (range.start.row == range.end.row) { if (range.start.row == range.end.row) {
return this.$lines[range.start.row].substring(range.start.column, return this.$lines[range.start.row].substring(range.start.column,
@ -265,10 +265,10 @@ var Document = function(text) {
}; };
/** internal, hide /** internal, hide
* Document.$clipPosition(position) -> Number * Document.$clipPosition(position) -> Number
*
* *
**/ *
**/
this.$clipPosition = function(position) { this.$clipPosition = function(position) {
var length = this.getLength(); var length = this.getLength();
if (position.row >= length) { if (position.row >= length) {
@ -279,14 +279,14 @@ var Document = function(text) {
}; };
/** /**
* Document.insert(position, text) -> Number * Document.insert(position, text) -> Number
* - position (Number): The position to start inserting at * - position (Number): The position to start inserting at
* - text (String): A chunk of text to insert * - text (String): A chunk of text to insert
* + (Number): The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. * + (Number): The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
* Inserts a block of `text` and the indicated `position`. * Inserts a block of `text` and the indicated `position`.
* *
* *
**/ **/
this.insert = function(position, text) { this.insert = function(position, text) {
if (!text || text.length === 0) if (!text || text.length === 0)
return position; return position;
@ -311,10 +311,10 @@ var Document = function(text) {
}; };
/** /**
* Document.insertLines(row, lines) -> Object * Document.insertLines(row, lines) -> Object
* - row (Number): The index of the row to insert at * - row (Number): The index of the row to insert at
* - lines (Array): An array of strings * - lines (Array): An array of strings
* + (Object): Returns an object containing the final row and column, like this:<br/> * + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```<br/> * ```{row: endRow, column: 0}```<br/>
* If `lines` is empty, this function returns an object containing the current row, and column, like this:<br/> * If `lines` is empty, this function returns an object containing the current row, and column, like this:<br/>
* ```{row: row, column: 0}``` * ```{row: row, column: 0}```
@ -322,7 +322,7 @@ var Document = function(text) {
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event. * Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
* *
* *
**/ **/
this.insertLines = function(row, lines) { this.insertLines = function(row, lines) {
if (lines.length == 0) if (lines.length == 0)
return {row: row, column: 0}; return {row: row, column: 0};
@ -342,16 +342,16 @@ var Document = function(text) {
}; };
/** /**
* Document.insertNewLine(position) -> Object * Document.insertNewLine(position) -> Object
* - position (String): The position to insert at * - position (String): The position to insert at
* + (Object): Returns an object containing the final row and column, like this:<br/> * + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}``` * ```{row: endRow, column: 0}```
* *
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event. * Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
* *
* *
* *
**/ **/
this.insertNewLine = function(position) { this.insertNewLine = function(position) {
position = this.$clipPosition(position); position = this.$clipPosition(position);
var line = this.$lines[position.row] || ""; var line = this.$lines[position.row] || "";
@ -375,7 +375,7 @@ var Document = function(text) {
}; };
/** /**
* Document.insertInLine(position, text) -> Object | Number * Document.insertInLine(position, text) -> Object | Number
* - position (Number): The position to insert at * - position (Number): The position to insert at
* - text (String): A chunk of text * - text (String): A chunk of text
* + (Object): Returns an object containing the final row and column, like this:<br/> * + (Object): Returns an object containing the final row and column, like this:<br/>
@ -386,7 +386,7 @@ var Document = function(text) {
* *
* *
* *
**/ **/
this.insertInLine = function(position, text) { this.insertInLine = function(position, text) {
if (text.length == 0) if (text.length == 0)
return position; return position;
@ -412,14 +412,14 @@ var Document = function(text) {
}; };
/** /**
* Document.remove(range) -> Object * Document.remove(range) -> Object
* - range (Range): A specified Range to remove * - range (Range): A specified Range to remove
* + (Object): Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`. * + (Object): Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
* *
* Removes the `range` from the document. * Removes the `range` from the document.
* *
* *
**/ **/
this.remove = function(range) { this.remove = function(range) {
// clip to document // clip to document
range.start = this.$clipPosition(range.start); range.start = this.$clipPosition(range.start);
@ -453,7 +453,7 @@ var Document = function(text) {
}; };
/** /**
* Document.removeInLine(row, startColumn, endColumn) -> Object * Document.removeInLine(row, startColumn, endColumn) -> Object
* - row (Number): The row to remove from * - row (Number): The row to remove from
* - startColumn (Number): The column to start removing at * - startColumn (Number): The column to start removing at
* - endColumn (Number): The column to stop removing at * - endColumn (Number): The column to stop removing at
@ -483,15 +483,15 @@ var Document = function(text) {
}; };
/** /**
* Document.removeLines(firstRow, lastRow) -> [String] * Document.removeLines(firstRow, lastRow) -> [String]
* - firstRow (Number): The first row to be removed * - firstRow (Number): The first row to be removed
* - lastRow (Number): The last row to be removed * - lastRow (Number): The last row to be removed
* + ([String]): Returns all the removed lines. * + ([String]): Returns all the removed lines.
* *
* Removes a range of full lines. This method also triggers the `'change'` event. * Removes a range of full lines. This method also triggers the `'change'` event.
* *
* *
**/ **/
this.removeLines = function(firstRow, lastRow) { this.removeLines = function(firstRow, lastRow) {
var range = new Range(firstRow, 0, lastRow + 1, 0); var range = new Range(firstRow, 0, lastRow + 1, 0);
var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1); var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
@ -507,12 +507,12 @@ var Document = function(text) {
}; };
/** /**
* Document.removeNewLine(row) -> Void * Document.removeNewLine(row) -> Void
* - row (Number): The row to check * - row (Number): The row to check
* *
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event. * Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
* *
**/ **/
this.removeNewLine = function(row) { this.removeNewLine = function(row) {
var firstLine = this.getLine(row); var firstLine = this.getLine(row);
var secondLine = this.getLine(row+1); var secondLine = this.getLine(row+1);
@ -531,9 +531,9 @@ var Document = function(text) {
}; };
/** /**
* Document.replace(range, text) -> Object * Document.replace(range, text) -> Object
* - range (Range): A specified Range to replace * - range (Range): A specified Range to replace
* - text (String): The new text to use as a replacement * - text (String): The new text to use as a replacement
* + (Object): Returns an object containing the final row and column, like this: * + (Object): Returns an object containing the final row and column, like this:
* {row: endRow, column: 0} * {row: endRow, column: 0}
* If the text and range are empty, this function returns an object containing the current `range.start` value. * If the text and range are empty, this function returns an object containing the current `range.start` value.
@ -541,7 +541,7 @@ var Document = function(text) {
* *
* Replaces a range in the document with the new `text`. * Replaces a range in the document with the new `text`.
* *
**/ **/
this.replace = function(range, text) { this.replace = function(range, text) {
if (text.length == 0 && range.isEmpty()) if (text.length == 0 && range.isEmpty())
return range.start; return range.start;
@ -563,10 +563,10 @@ var Document = function(text) {
}; };
/** /**
* Document.applyDeltas(deltas) -> Void * Document.applyDeltas(deltas) -> Void
* *
* Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`. * Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
**/ **/
this.applyDeltas = function(deltas) { this.applyDeltas = function(deltas) {
for (var i=0; i<deltas.length; i++) { for (var i=0; i<deltas.length; i++) {
var delta = deltas[i]; var delta = deltas[i];
@ -584,10 +584,10 @@ var Document = function(text) {
}; };
/** /**
* Document.revertDeltas(deltas) -> Void * Document.revertDeltas(deltas) -> Void
* *
* Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`. * Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
**/ **/
this.revertDeltas = function(deltas) { this.revertDeltas = function(deltas) {
for (var i=deltas.length-1; i>=0; i--) { for (var i=deltas.length-1; i>=0; i--) {
var delta = deltas[i]; var delta = deltas[i];

File diff suppressed because it is too large Load diff

View file

@ -475,17 +475,18 @@ var Editor = function(renderer, session) {
session.$highlightLineMarker = null; session.$highlightLineMarker = null;
if (this.$highlightActiveLine) { if (this.$highlightActiveLine) {
var cursor = this.getCursorPosition(), var cursor = this.getCursorPosition();
foldLine = this.session.getFoldLine(cursor.row); var foldLine = this.session.getFoldLine(cursor.row);
if ((this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) { if ((this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
var range; var range;
if (foldLine) { if (foldLine) {
range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0); range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0);
} else { } else {
range = new Range(cursor.row, 0, cursor.row+1, 0); range = new Range(cursor.row, 0, cursor.row+1, 0);
}
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
} }
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
} }
}; };

View file

@ -133,8 +133,8 @@ var LuaHighlightRules = function() {
regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]' regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]'
}, },
// multiline bracketed comments // multiline bracketed comments
{ {
token : "comment", // --[[ comment token : "comment", // --[[ comment
regex : strPre + '\\-\\-\\[\\[.*$', regex : strPre + '\\-\\-\\[\\[.*$',
merge : true, merge : true,
@ -184,7 +184,7 @@ var LuaHighlightRules = function() {
}, },
// bracketed strings // bracketed strings
{ {
token : "string", // [[ string token : "string", // [[ string
regex : strPre + '\\[\\[.*\\]\\]' regex : strPre + '\\[\\[.*\\]\\]'
}, { }, {
@ -204,7 +204,7 @@ var LuaHighlightRules = function() {
regex : strPre + '\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]' regex : strPre + '\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]'
}, },
// multiline bracketed strings // multiline bracketed strings
{ {
token : "string", // [[ string token : "string", // [[ string
regex : strPre + '\\[\\[.*$', regex : strPre + '\\[\\[.*$',

View file

@ -143,7 +143,7 @@ module.exports = {
]); ]);
editor = new Editor(new MockRenderer(), doc); editor = new Editor(new MockRenderer(), doc);
MultiSelect(editor); MultiSelect(editor);
var selection = editor.selection; var selection = editor.selection;
var range1 = new Range(0, 2, 0, 4); var range1 = new Range(0, 2, 0, 4);
editor.selection.fromOrientedRange(range1); editor.selection.fromOrientedRange(range1);

View file

@ -87,10 +87,10 @@ var Selection = function(session) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
/** /**
* Selection.isEmpty() -> Boolean * Selection.isEmpty() -> Boolean
* *
* Returns `true` if the selection is empty. * Returns `true` if the selection is empty.
**/ **/
this.isEmpty = function() { this.isEmpty = function() {
return (this.$isEmpty || ( return (this.$isEmpty || (
this.selectionAnchor.row == this.selectionLead.row && this.selectionAnchor.row == this.selectionLead.row &&
@ -99,10 +99,10 @@ var Selection = function(session) {
}; };
/** /**
* Selection.isMultiLine() -> Boolean * Selection.isMultiLine() -> Boolean
* *
* Returns `true` if the selection is a multi-line. * Returns `true` if the selection is a multi-line.
**/ **/
this.isMultiLine = function() { this.isMultiLine = function() {
if (this.isEmpty()) { if (this.isEmpty()) {
return false; return false;
@ -112,7 +112,7 @@ var Selection = function(session) {
}; };
/** /**
* Selection.getCursor() -> Number * Selection.getCursor() -> Number
* *
* Gets the current position of the cursor. * Gets the current position of the cursor.
**/ **/
@ -121,12 +121,12 @@ var Selection = function(session) {
}; };
/** /**
* Selection.setSelectionAnchor(row, column) * Selection.setSelectionAnchor(row, column)
* - row (Number): The new row * - row (Number): The new row
* - column (Number): The new column * - column (Number): The new column
* *
* Sets the row and column position of the anchor. This function also emits the `'changeSelection'` event. * Sets the row and column position of the anchor. This function also emits the `'changeSelection'` event.
**/ **/
this.setSelectionAnchor = function(row, column) { this.setSelectionAnchor = function(row, column) {
this.selectionAnchor.setPosition(row, column); this.selectionAnchor.setPosition(row, column);
@ -137,11 +137,11 @@ var Selection = function(session) {
}; };
/** related to: Anchor.getPosition /** related to: Anchor.getPosition
* Selection.getSelectionAnchor() -> Object * Selection.getSelectionAnchor() -> Object
*
* 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.
*
**/
this.getSelectionAnchor = function() { this.getSelectionAnchor = function() {
if (this.$isEmpty) if (this.$isEmpty)
return this.getSelectionLead() return this.getSelectionLead()
@ -150,21 +150,21 @@ var Selection = function(session) {
}; };
/** /**
* Selection.getSelectionLead() -> Object * Selection.getSelectionLead() -> Object
* *
* 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.
**/ **/
this.getSelectionLead = function() { this.getSelectionLead = function() {
return this.selectionLead.getPosition(); return this.selectionLead.getPosition();
}; };
/** /**
* Selection.shiftSelection(columns) * Selection.shiftSelection(columns)
* - columns (Number): The number of columns to shift by * - columns (Number): The number of columns to shift by
* *
* Shifts the selection up (or down, if [[Selection.isBackwards `isBackwards()`]] is true) the given number of columns. * Shifts the selection up (or down, if [[Selection.isBackwards `isBackwards()`]] is true) the given number of columns.
* *
**/ **/
this.shiftSelection = function(columns) { this.shiftSelection = function(columns) {
if (this.$isEmpty) { if (this.$isEmpty) {
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns); this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
@ -187,10 +187,10 @@ var Selection = function(session) {
}; };
/** /**
* Selection.isBackwards() -> Boolean * Selection.isBackwards() -> Boolean
* *
* Returns `true` if the selection is going backwards in the document. * Returns `true` if the selection is going backwards in the document.
**/ **/
this.isBackwards = function() { this.isBackwards = function() {
var anchor = this.selectionAnchor; var anchor = this.selectionAnchor;
var lead = this.selectionLead; var lead = this.selectionLead;
@ -198,10 +198,10 @@ var Selection = function(session) {
}; };
/** /**
* Selection.getRange() -> Range * Selection.getRange() -> Range
* *
* [Returns the [[Range `Range`]] for the selected text.]{: #Selection.getRange} * [Returns the [[Range `Range`]] for the selected text.]{: #Selection.getRange}
**/ **/
this.getRange = function() { this.getRange = function() {
var anchor = this.selectionAnchor; var anchor = this.selectionAnchor;
var lead = this.selectionLead; var lead = this.selectionLead;
@ -218,10 +218,10 @@ var Selection = function(session) {
}; };
/** /**
* Selection.clearSelection() * Selection.clearSelection()
* *
* [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.]{: #Selection.clearSelection} * [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.]{: #Selection.clearSelection}
**/ **/
this.clearSelection = function() { this.clearSelection = function() {
if (!this.$isEmpty) { if (!this.$isEmpty) {
this.$isEmpty = true; this.$isEmpty = true;
@ -230,10 +230,10 @@ var Selection = function(session) {
}; };
/** /**
* Selection.selectAll() * Selection.selectAll()
* *
* Selects all the text in the document. * Selects all the text in the document.
**/ **/
this.selectAll = function() { this.selectAll = function() {
var lastRow = this.doc.getLength() - 1; var lastRow = this.doc.getLength() - 1;
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length); this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
@ -241,13 +241,13 @@ var Selection = function(session) {
}; };
/** /**
* Selection.setSelectionRange(range, reverse) * Selection.setSelectionRange(range, reverse)
* - range (Range): The range of text to select * - range (Range): The range of text to select
* - reverse (Boolean): Indicates if the range should go backwards (`true`) or not * - reverse (Boolean): Indicates if the range should go backwards (`true`) or not
* *
* Sets the selection to the provided range. * Sets the selection to the provided range.
* *
**/ **/
this.setSelectionRange = function(range, reverse) { this.setSelectionRange = function(range, reverse) {
if (reverse) { if (reverse) {
this.setSelectionAnchor(range.end.row, range.end.column); this.setSelectionAnchor(range.end.row, range.end.column);
@ -268,13 +268,13 @@ var Selection = function(session) {
}; };
/** /**
* Selection.selectTo(row, column) * Selection.selectTo(row, column)
* - row (Number): The row to select to * - row (Number): The row to select to
* - column (Number): The column to select to * - column (Number): The column to select to
* *
* Moves the selection cursor to the indicated row and column. * Moves the selection cursor to the indicated row and column.
* *
**/ **/
this.selectTo = function(row, column) { this.selectTo = function(row, column) {
this.$moveSelection(function() { this.$moveSelection(function() {
this.moveCursorTo(row, column); this.moveCursorTo(row, column);
@ -282,12 +282,12 @@ var Selection = function(session) {
}; };
/** /**
* Selection.selectToPosition(pos) * Selection.selectToPosition(pos)
* - pos (Object): An object containing the row and column * - pos (Object): An object containing the row and column
* *
* Moves the selection cursor to the row and column indicated by `pos`. * Moves the selection cursor to the row and column indicated by `pos`.
* *
**/ **/
this.selectToPosition = function(pos) { this.selectToPosition = function(pos) {
this.$moveSelection(function() { this.$moveSelection(function() {
this.moveCursorToPosition(pos); this.moveCursorToPosition(pos);
@ -295,10 +295,10 @@ var Selection = function(session) {
}; };
/** /**
* Selection.selectUp() * Selection.selectUp()
* *
* Moves the selection up one row. * Moves the selection up one row.
**/ **/
this.selectUp = function() { this.selectUp = function() {
this.$moveSelection(this.moveCursorUp); this.$moveSelection(this.moveCursorUp);
}; };
@ -331,10 +331,10 @@ var Selection = function(session) {
}; };
/** /**
* Selection.selectLineStart() * Selection.selectLineStart()
* *
* Moves the selection to the beginning of the current line. * Moves the selection to the beginning of the current line.
**/ **/
this.selectLineStart = function() { this.selectLineStart = function() {
this.$moveSelection(this.moveCursorLineStart); this.$moveSelection(this.moveCursorLineStart);
}; };
@ -385,10 +385,10 @@ var Selection = function(session) {
}; };
/** related to: EditSession.getWordRange /** related to: EditSession.getWordRange
* Selection.selectWord() * Selection.selectWord()
* *
* Moves the selection to highlight the entire word. * Moves the selection to highlight the entire word.
**/ **/
this.getWordRange = function(row, column) { this.getWordRange = function(row, column) {
if (typeof column == "undefined") { if (typeof column == "undefined") {
var cursor = row || this.selectionLead; var cursor = row || this.selectionLead;
@ -398,16 +398,15 @@ var Selection = function(session) {
return this.session.getWordRange(row, column); return this.session.getWordRange(row, column);
}; };
>>>>>>> ui/navbar
this.selectWord = function() { this.selectWord = function() {
this.setSelectionRange(this.getWordRange()); this.setSelectionRange(this.getWordRange());
}; };
/** related to: EditSession.getAWordRange /** related to: EditSession.getAWordRange
* Selection.selectAWord() * Selection.selectAWord()
* *
* Selects a word, including its right whitespace. * Selects a word, including its right whitespace.
**/ **/
this.selectAWord = function() { this.selectAWord = function() {
var cursor = this.getCursor(); var cursor = this.getCursor();
var range = this.session.getAWordRange(cursor.row, cursor.column); var range = this.session.getAWordRange(cursor.row, cursor.column);
@ -441,28 +440,28 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorUp() * Selection.moveCursorUp()
* *
* Moves the cursor up one row. * Moves the cursor up one row.
**/ **/
this.moveCursorUp = function() { this.moveCursorUp = function() {
this.moveCursorBy(-1, 0); this.moveCursorBy(-1, 0);
}; };
/** /**
* Selection.moveCursorDown() * Selection.moveCursorDown()
* *
* Moves the cursor down one row. * Moves the cursor down one row.
**/ **/
this.moveCursorDown = function() { this.moveCursorDown = function() {
this.moveCursorBy(1, 0); this.moveCursorBy(1, 0);
}; };
/** /**
* Selection.moveCursorLeft() * Selection.moveCursorLeft()
* *
* Moves the cursor left one column. * Moves the cursor left one column.
**/ **/
this.moveCursorLeft = function() { this.moveCursorLeft = function() {
var cursor = this.selectionLead.getPosition(), var cursor = this.selectionLead.getPosition(),
fold; fold;
@ -485,7 +484,7 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorRight() * Selection.moveCursorRight()
* *
* Moves the cursor right one column. * Moves the cursor right one column.
**/ **/
@ -511,7 +510,7 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorLineStart() * Selection.moveCursorLineStart()
* *
* Moves the cursor to the start of the line. * Moves the cursor to the start of the line.
**/ **/
@ -544,7 +543,7 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorLineEnd() * Selection.moveCursorLineEnd()
* *
* Moves the cursor to the end of the line. * Moves the cursor to the end of the line.
**/ **/
@ -559,7 +558,7 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorFileEnd() * Selection.moveCursorFileEnd()
* *
* Moves the cursor to the end of the file. * Moves the cursor to the end of the file.
**/ **/
@ -570,7 +569,7 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorFileStart() * Selection.moveCursorFileStart()
* *
* Moves the cursor to the start of the file. * Moves the cursor to the start of the file.
**/ **/
@ -626,7 +625,7 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorLongWordLeft() * Selection.moveCursorLongWordLeft()
* *
* Moves the cursor to the word on the left. * Moves the cursor to the word on the left.
**/ **/
@ -789,23 +788,23 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorToPosition(position) * Selection.moveCursorToPosition(position)
* - position (Object): The position to move to * - position (Object): The position to move to
* *
* Moves the selection to the position indicated by its `row` and `column`. * Moves the selection to the position indicated by its `row` and `column`.
**/ **/
this.moveCursorToPosition = function(position) { this.moveCursorToPosition = function(position) {
this.moveCursorTo(position.row, position.column); this.moveCursorTo(position.row, position.column);
}; };
/** /**
* Selection.moveCursorTo(row, column, keepDesiredColumn) * Selection.moveCursorTo(row, column, keepDesiredColumn)
* - row (Number): The row to move to * - row (Number): The row to move to
* - column (Number): The column to move to * - column (Number): The column to move to
* - keepDesiredColumn (Boolean): [If `true`, the cursor move does not respect the previous column]{: #preventUpdateBool} * - keepDesiredColumn (Boolean): [If `true`, the cursor move does not respect the previous column]{: #preventUpdateBool}
* *
* Moves the cursor to the row and column provided. [If `preventUpdateDesiredColumn` is `true`, then the cursor stays in the same column position as its original point.]{: #preventUpdateBoolDesc} * Moves the cursor to the row and column provided. [If `preventUpdateDesiredColumn` is `true`, then the cursor stays in the same column position as its original point.]{: #preventUpdateBoolDesc}
**/ **/
this.moveCursorTo = function(row, column, keepDesiredColumn) { this.moveCursorTo = function(row, column, keepDesiredColumn) {
// Ensure the row/column is not inside of a fold. // Ensure the row/column is not inside of a fold.
var fold = this.session.getFoldAt(row, column, 1); var fold = this.session.getFoldAt(row, column, 1);
@ -823,13 +822,13 @@ var Selection = function(session) {
}; };
/** /**
* Selection.moveCursorToScreen(row, column, keepDesiredColumn) * Selection.moveCursorToScreen(row, column, keepDesiredColumn)
* - row (Number): The row to move to * - row (Number): The row to move to
* - column (Number): The column to move to * - column (Number): The column to move to
* - keepDesiredColumn (Boolean): {:preventUpdateBool} * - keepDesiredColumn (Boolean): {:preventUpdateBool}
* *
* Moves the cursor to the screen position indicated by row and column. {:preventUpdateBoolDesc} * Moves the cursor to the screen position indicated by row and column. {:preventUpdateBoolDesc}
**/ **/
this.moveCursorToScreen = function(row, column, keepDesiredColumn) { this.moveCursorToScreen = function(row, column, keepDesiredColumn) {
var pos = this.session.screenToDocumentPosition(row, column); var pos = this.session.screenToDocumentPosition(row, column);
this.moveCursorTo(pos.row, pos.column, keepDesiredColumn); this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);

View file

@ -360,7 +360,7 @@ exports.Generator = function(source) {
} }
this.end = function(breakOnError, callback) { this.end = function(breakOnError, callback) {
if (!callback) { if (!callback) {
callback = arguments[0] callback = arguments[0]
breakOnError = true breakOnError = true
} }