More styles
This commit is contained in:
parent
56ae5d9ff9
commit
a0ed6dcbab
15 changed files with 183 additions and 293 deletions
|
|
@ -180,7 +180,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
/** related to: BackgroundTokenizer.$tokenizeRows
|
||||
* BackgroundTokenizer.getTokens(firstRow, lastRow) -> Array
|
||||
* BackgroundTokenizer.getTokens(firstRow, lastRow) -> [Object]
|
||||
* - firstRow (Number): The row to start at
|
||||
* - lastRow (Number): The row to finish at
|
||||
*
|
||||
|
|
@ -205,15 +205,13 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.$tokenizeRows(firstRow, lastRow) -> Array
|
||||
* BackgroundTokenizer.$tokenizeRows(firstRow, lastRow) -> [Object]
|
||||
* - startRow (Number): The row to start at
|
||||
* - lastRow (Number): The row to finish at
|
||||
* + ([Object]): A list of the tokenized rows. Each item in the list is an object with two properties, `state` and `start`.
|
||||
*
|
||||
* Tokenizes all the rows within the specified region.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns a list of the tokenized rows. Each item in the list is an object with two properties, `state` and `start`.
|
||||
*
|
||||
**/
|
||||
this.$tokenizeRows = function(firstRow, lastRow) {
|
||||
|
|
|
|||
|
|
@ -110,14 +110,12 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/** internal, hide
|
||||
* Document.$split(text) -> Array
|
||||
* Document.$split(text) -> [String]
|
||||
* - text (String): The text to work with
|
||||
*
|
||||
* + ([String]): A String array, with each index containing a piece of the original `text` string.
|
||||
*
|
||||
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* A String array, with each index containing a piece of the original `text` string.
|
||||
*
|
||||
**/
|
||||
|
||||
|
|
@ -148,15 +146,13 @@ var Document = function(text) {
|
|||
|
||||
/**
|
||||
* Document.getNewLineCharacter() -> String
|
||||
* + (String): If `newLineMode == windows`, `\r\n` is returned.<br/>
|
||||
* If `newLineMode == unix`, `\n` is returned.<br/>
|
||||
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
||||
*
|
||||
* Returns the newline character that's being used, depending on the value of `newLineMode`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* If `newLineMode == windows`, `\r\n` is returned.
|
||||
* If `newLineMode == unix`, `\n` is returned.
|
||||
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getNewLineCharacter = function() {
|
||||
|
|
@ -220,7 +216,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getLines(firstRow, lastRow) -> Array
|
||||
* Document.getLines(firstRow, lastRow) -> [String]
|
||||
* - firstRow (Number): The first row index to retrieve
|
||||
* - lastRow (Number): The final row index to retrieve
|
||||
*
|
||||
|
|
@ -232,7 +228,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getAllLines() -> Array
|
||||
* Document.getAllLines() -> [String]
|
||||
*
|
||||
* Returns all lines in the document as string array. Warning: The caller should not modify this array!
|
||||
**/
|
||||
|
|
@ -287,12 +283,9 @@ var Document = function(text) {
|
|||
* Document.insert(position, text) -> Number
|
||||
* - position (Number): The position to start inserting at
|
||||
* - 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`.
|
||||
* Inserts a block of `text` and the indicated `position`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns the position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
*
|
||||
**/
|
||||
this.insert = function(position, text) {
|
||||
|
|
@ -322,18 +315,13 @@ var Document = function(text) {
|
|||
* Document.insertLines(row, lines) -> Object
|
||||
* - row (Number): The index of the row to insert at
|
||||
* - lines (Array): An array of strings
|
||||
*
|
||||
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
||||
* ```{row: endRow, column: 0}```<br/>
|
||||
* If `lines` is empty, this function returns an object containing the current row, and column, like this:<br/>
|
||||
* ```{row: row, column: 0}```
|
||||
*
|
||||
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {row: endRow, column: 0}
|
||||
*
|
||||
* If `lines` is empty, this function returns an object containing the current row, and column, like this:
|
||||
*
|
||||
* {row: row, column: 0}
|
||||
*
|
||||
**/
|
||||
this.insertLines = function(row, lines) {
|
||||
|
|
@ -357,14 +345,12 @@ var Document = function(text) {
|
|||
/**
|
||||
* Document.insertNewLine(position) -> Object
|
||||
* - position (String): The position to insert at
|
||||
*
|
||||
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
||||
* ```{row: endRow, column: 0}```
|
||||
*
|
||||
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {row: endRow, column: 0}
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.insertNewLine = function(position) {
|
||||
|
|
@ -393,16 +379,13 @@ var Document = function(text) {
|
|||
* Document.insertInLine(position, text) -> Object | Number
|
||||
* - position (Number): The position to insert at
|
||||
* - text (String): A chunk of text
|
||||
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
||||
* ```{row: endRow, column: 0}```
|
||||
* + (Number): If `text` is empty, this function returns the value of `position`
|
||||
*
|
||||
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {row: endRow, column: 0}
|
||||
*
|
||||
* If `text` is empty, this function returns the value of `position`.
|
||||
*
|
||||
**/
|
||||
this.insertInLine = function(position, text) {
|
||||
|
|
@ -432,12 +415,11 @@ var Document = function(text) {
|
|||
/**
|
||||
* Document.remove(range) -> Object
|
||||
* - 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`.
|
||||
*
|
||||
* Removes the `range` from the document.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* 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`.
|
||||
**/
|
||||
this.remove = function(range) {
|
||||
// clip to document
|
||||
|
|
@ -472,16 +454,15 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.removeInLine(row, startColumn, endColumn) -> Object | Void
|
||||
* Document.removeInLine(row, startColumn, endColumn) -> Object
|
||||
* - row (Number): The row to remove from
|
||||
* - startColumn (Number): The column to start removing at
|
||||
* - endColumn (Number): The column to stop removing at
|
||||
* + (Object): Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
|
||||
*
|
||||
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing `startRow` and `startColumn`, indicating the new row and column values. If `startColumn` is equal to `endColumn`, this function returns nothing.
|
||||
*
|
||||
**/
|
||||
this.removeInLine = function(row, startColumn, endColumn) {
|
||||
if (startColumn == endColumn)
|
||||
|
|
@ -503,16 +484,13 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.removeLines(firstRow, lastRow) -> Array
|
||||
* Document.removeLines(firstRow, lastRow) -> [String]
|
||||
* - firstRow (Number): The first row to be removed
|
||||
* - lastRow (Number): The last row to be removed
|
||||
*
|
||||
* + ([String]): Returns all the removed lines.
|
||||
*
|
||||
* Removes a range of full lines. This method also triggers the `'change'` event.
|
||||
*
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns all the removed lines.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.removeLines = function(firstRow, lastRow) {
|
||||
|
|
@ -557,18 +535,12 @@ var Document = function(text) {
|
|||
* Document.replace(range, text) -> Object
|
||||
* - range (Range): A specified Range to replace
|
||||
* - text (String): The new text to use as a replacement
|
||||
* + (Object): Returns an object containing the final row and column, like this:
|
||||
* {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 is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
|
||||
*
|
||||
* Replaces a range in the document with the new `text`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {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 is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
|
||||
*
|
||||
**/
|
||||
this.replace = function(range, text) {
|
||||
|
|
|
|||
|
|
@ -1056,12 +1056,10 @@ var EditSession = function(text, mode) {
|
|||
* EditSession.insert(position, text) -> Number
|
||||
* - position (Number): The position to start inserting at
|
||||
* - 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`.
|
||||
*
|
||||
* Inserts a block of `text` and the indicated `position`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns the position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
*
|
||||
**/
|
||||
this.insert = function(position, text) {
|
||||
|
|
@ -1071,12 +1069,11 @@ var EditSession = function(text, mode) {
|
|||
/** related to: Document.remove
|
||||
* EditSession.remove(range) -> Object
|
||||
* - range (Range): A specified Range to remove
|
||||
* + (Object): 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.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* 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`.
|
||||
*
|
||||
**/
|
||||
this.remove = function(range) {
|
||||
return this.doc.remove(range);
|
||||
|
|
@ -1217,18 +1214,14 @@ var EditSession = function(text, mode) {
|
|||
* EditSession.replace(range, text) -> Object
|
||||
* - range (Range): A specified Range to replace
|
||||
* - text (String): The new text to use as a replacement
|
||||
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
||||
* ```{row: endRow, column: 0}```<br/>
|
||||
* If the text and range are empty, this function returns an object containing the current `range.start` value.<br/>
|
||||
* If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
|
||||
*
|
||||
* Replaces a range in the document with the new `text`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an object containing the final row and column, like this:
|
||||
*
|
||||
* {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 is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.replace = function(range, text) {
|
||||
|
|
@ -1239,15 +1232,12 @@ var EditSession = function(text, mode) {
|
|||
* EditSession.moveText(fromRange, toPosition) -> Range
|
||||
* - fromRange (Range): The range of text you want moved within the document
|
||||
* - toPosition (Object): The location (row and column) where you want to move the text to
|
||||
*
|
||||
* + (Range): The new range where the text was moved to.
|
||||
* Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
|
||||
*
|
||||
* { row: newRowLocation, column: newColumnLocation }
|
||||
*
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* The new range where the text was moved to.
|
||||
*
|
||||
**/
|
||||
this.moveText = function(fromRange, toPosition) {
|
||||
|
|
@ -1332,12 +1322,10 @@ var EditSession = function(text, mode) {
|
|||
* EditSession.moveLinesUp(firstRow, lastRow) -> Number
|
||||
* - firstRow (Number): The starting row to move up
|
||||
* - lastRow (Number): The final row to move up
|
||||
*
|
||||
* + (Number): If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
|
||||
*
|
||||
* Shifts all the lines in the document up one, starting from `firstRow` and ending at `lastRow`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
|
||||
*
|
||||
**/
|
||||
this.moveLinesUp = function(firstRow, lastRow) {
|
||||
|
|
@ -1352,12 +1340,9 @@ var EditSession = function(text, mode) {
|
|||
* EditSession.moveLinesDown(firstRow, lastRow) -> Number
|
||||
* - firstRow (Number): The starting row to move down
|
||||
* - lastRow (Number): The final row to move down
|
||||
* + (Number): If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
|
||||
*
|
||||
*
|
||||
* Shifts all the lines in the document down one, starting from `firstRow` and ending at `lastRow`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
|
||||
*
|
||||
**/
|
||||
this.moveLinesDown = function(firstRow, lastRow) {
|
||||
|
|
@ -1372,12 +1357,11 @@ var EditSession = function(text, mode) {
|
|||
* EditSession.duplicateLines(firstRow, lastRow) -> Number
|
||||
* - firstRow (Number): The starting row to duplicate
|
||||
* - lastRow (Number): The final row to duplicate
|
||||
*
|
||||
* + (Number): Returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
|
||||
*
|
||||
* Duplicates all the text between `firstRow` and `lastRow`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.duplicateLines = function(firstRow, lastRow) {
|
||||
|
|
@ -1921,17 +1905,17 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
|
||||
/** internal, hide
|
||||
* EditSession.$getStringScreenWidth(str, maxScreenColumn, screenColumn) -> Array
|
||||
* EditSession.$getStringScreenWidth(str, maxScreenColumn, screenColumn) -> [Number]
|
||||
* - str (String): The string to calculate the screen width of
|
||||
* - maxScreenColumn (Number):
|
||||
* - screenColumn (Number):
|
||||
* + ([Number]): Returns an `int[]` array with two elements:<br/>
|
||||
* The first position indicates the number of columns for `str` on screen.<br/>
|
||||
* The second value contains the position of the document column that this function read until.
|
||||
*
|
||||
* Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* Returns an `int[]` array with two elements. The first position indicates the number of columns for `str` on screen. The second value contains the position of the document column that this function read until.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
|
||||
if (maxScreenColumn == 0) {
|
||||
|
|
@ -2066,13 +2050,11 @@ var EditSession = function(text, mode) {
|
|||
* EditSession.screenToDocumentPosition(screenRow, screenColumn) -> Object
|
||||
* - screenRow (Number): The screen row to check
|
||||
* - screenColumn (Number): The screen column to check
|
||||
*
|
||||
* + (Object): The object returned has two properties: `row` and `column`.
|
||||
*
|
||||
* Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations}
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* The object returned has two properties: `row` and `column`.
|
||||
*
|
||||
**/
|
||||
this.screenToDocumentPosition = function(screenRow, screenColumn) {
|
||||
if (screenRow < 0) {
|
||||
|
|
@ -2173,12 +2155,10 @@ var EditSession = function(text, mode) {
|
|||
* EditSession.documentToScreenPosition(docRow, docColumn) -> Object
|
||||
* - docRow (Number): The document row to check
|
||||
* - docColumn (Number): The document column to check
|
||||
* + (Object): The object returned by this method has two properties: `row` and `column`.
|
||||
*
|
||||
* Converts document coordinates to screen coordinates. {:conversionConsiderations}
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* The object returned by this method has two properties: `row` and `column`.
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -1244,12 +1244,11 @@ var Editor = function(renderer, session) {
|
|||
|
||||
/** related to: EditSession.moveLinesDown
|
||||
* Editor.moveLinesDown() -> Number
|
||||
*
|
||||
* + (Number): On success, it returns -1.
|
||||
*
|
||||
* Shifts all the selected lines down one row.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* On success, it returns -1.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.moveLinesDown = function() {
|
||||
|
|
@ -1260,12 +1259,10 @@ var Editor = function(renderer, session) {
|
|||
|
||||
/** related to: EditSession.moveLinesUp
|
||||
* Editor.moveLinesUp() -> Number
|
||||
*
|
||||
* + (Number): On success, it returns -1.
|
||||
*
|
||||
* Shifts all the selected lines up one row.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* On success, it returns -1.
|
||||
*
|
||||
**/
|
||||
this.moveLinesUp = function() {
|
||||
|
|
@ -1278,16 +1275,13 @@ var Editor = function(renderer, session) {
|
|||
* Editor.moveText(fromRange, toPosition) -> Range
|
||||
* - fromRange (Range): The range of text you want moved within the document
|
||||
* - toPosition (Object): The location (row and column) where you want to move the text to
|
||||
* + (Range): The new range where the text was moved to.
|
||||
*
|
||||
* Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
|
||||
*
|
||||
* { row: newRowLocation, column: newColumnLocation }
|
||||
*
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* The new range where the text was moved to.
|
||||
*
|
||||
**/
|
||||
this.moveText = function(range, toPosition) {
|
||||
if (this.$readOnly)
|
||||
|
|
@ -1298,13 +1292,11 @@ var Editor = function(renderer, session) {
|
|||
|
||||
/** related to: EditSession.duplicateLines
|
||||
* Editor.copyLinesUp() -> Number
|
||||
*
|
||||
* + (Number): On success, returns 0.
|
||||
*
|
||||
* Copies all the selected lines up one row.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* On success, returns 0.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.copyLinesUp = function() {
|
||||
this.$moveLines(function(firstRow, lastRow) {
|
||||
|
|
@ -1315,12 +1307,11 @@ var Editor = function(renderer, session) {
|
|||
|
||||
/** related to: EditSession.duplicateLines
|
||||
* Editor.copyLinesDown() -> Number
|
||||
*
|
||||
* + (Number): On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
|
||||
*
|
||||
* Copies all the selected lines down one row.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.copyLinesDown = function() {
|
||||
|
|
@ -1576,14 +1567,12 @@ var Editor = function(renderer, session) {
|
|||
|
||||
/** related to: Selection.getCursor
|
||||
* Editor.getCursorPosition() -> Object
|
||||
*
|
||||
* + (Object): This returns an object that looks something like this:<br/>
|
||||
* ```{ row: currRow, column: currCol }```
|
||||
*
|
||||
* Gets the current position of the cursor.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* This returns an object that looks something like this:
|
||||
*
|
||||
* { row: currRow, column: currCol }
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getCursorPosition = function() {
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ var EditSession = require("./edit_session").EditSession;
|
|||
/**
|
||||
* Selection.mergeOverlappingRanges()
|
||||
*
|
||||
* merges overlapping ranges ensuring consistency after changes
|
||||
* Merges overlapping ranges ensuring consistency after changes
|
||||
**/
|
||||
this.mergeOverlappingRanges = function() {
|
||||
var removed = this.rangeList.merge();
|
||||
|
|
@ -471,13 +471,10 @@ var Editor = require("./editor").Editor;
|
|||
* - needle (String): The text to find
|
||||
* - options (Object): Any of the additional [[Search search options]]
|
||||
* - additive (Boolean): TODO
|
||||
* + (Number): The number of found ranges.
|
||||
*
|
||||
* Finds and selects all the occurences of needle
|
||||
* Finds and selects all the occurences of `needle`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* The number of found ranges.
|
||||
*
|
||||
**/
|
||||
this.findAll = function(needle, options, additive) {
|
||||
options = options || {};
|
||||
|
|
|
|||
130
lib/ace/range.js
130
lib/ace/range.js
|
|
@ -115,20 +115,17 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
/** related to: Range.compare
|
||||
* Range.compareRange(range) -> Number
|
||||
* - range (Range): A range to compare with
|
||||
*
|
||||
* + (Number): This method returns one of the following numbers:<br/>
|
||||
* <br/>
|
||||
* * `-2`: (B) is in front of (A), and doesn't intersect with (A)<br/>
|
||||
* * `-1`: (B) begins before (A) but ends inside of (A)<br/>
|
||||
* * `0`: (B) is completely inside of (A) OR (A) is completely inside of (B)<br/>
|
||||
* * `+1`: (B) begins inside of (A) but ends outside of (A)<br/>
|
||||
* * `+2`: (B) is after (A) and doesn't intersect with (A)<br/>
|
||||
* * `42`: FTW state: (B) ends in (A) but starts outside of (A)
|
||||
*
|
||||
* Compares `this` range (A) with another range (B).
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* This method returns one of the following numbers:
|
||||
*
|
||||
* * -2: (B) is in front of (A), and doesn't intersect with (A)
|
||||
* * -1: (B) begins before (A) but ends inside of (A)
|
||||
* * 0: (B) is completely inside of (A) OR (A) is completely inside of (B)
|
||||
* * +1: (B) begins inside of (A) but ends outside of (A)
|
||||
* * +2: (B) is after (A) and doesn't intersect with (A)
|
||||
* * 42: FTW state: (B) ends in (A) but starts outside of (A)
|
||||
*
|
||||
**/
|
||||
this.compareRange = function(range) {
|
||||
var cmp,
|
||||
|
|
@ -162,22 +159,22 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
/** related to: Range.compare
|
||||
* Range.comparePoint(p) -> Number
|
||||
* - p (Range): A point to compare with
|
||||
* + (Number): This method returns one of the following numbers:<br/>
|
||||
* * `0` if the two points are exactly equal<br/>
|
||||
* * `-1` if `p.row` is less then the calling range<br/>
|
||||
* * `1` if `p.row` is greater than the calling range<br/>
|
||||
* <br/>
|
||||
* If the starting row of the calling range is equal to `p.row`, and:<br/>
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
|
||||
* * Otherwise, it returns -1<br/>
|
||||
*<br/>
|
||||
* If the ending row of the calling range is equal to `p.row`, and:<br/>
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
|
||||
* * Otherwise, it returns 1<br/>
|
||||
*
|
||||
* Checks the row and column points of `p` with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `0` if the two points are exactly equal
|
||||
* * `-1` if `p.row` is less then the calling range
|
||||
* * `1` if `p.row` is greater than the calling range
|
||||
*
|
||||
* If the starting row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
|
||||
* * Otherwise, it returns -1
|
||||
*
|
||||
* If the ending row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
**/
|
||||
this.comparePoint = function(p) {
|
||||
|
|
@ -328,22 +325,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
* Range.compare(row, column) -> Number
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
* + (Number): This method returns one of the following numbers:<br/>
|
||||
* * `0` if the two points are exactly equal <br/>
|
||||
* * `-1` if `p.row` is less then the calling range <br/>
|
||||
* * `1` if `p.row` is greater than the calling range <br/>
|
||||
* <br/>
|
||||
* If the starting row of the calling range is equal to `p.row`, and: <br/>
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
|
||||
* * Otherwise, it returns -1<br/>
|
||||
* <br/>
|
||||
* If the ending row of the calling range is equal to `p.row`, and: <br/>
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0` <br/>
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
* Checks the row and column points with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `0` if the two points are exactly equal
|
||||
* * `-1` if `p.row` is less then the calling range
|
||||
* * `1` if `p.row` is greater than the calling range
|
||||
*
|
||||
* If the starting row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
|
||||
* * Otherwise, it returns -1
|
||||
*
|
||||
* If the ending row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
**/
|
||||
this.compare = function(row, column) {
|
||||
|
|
@ -372,22 +368,23 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
* Range.compareStart(row, column) -> Number
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
* + (Number): This method returns one of the following numbers:<br/>
|
||||
* <br/>
|
||||
* * `0` if the two points are exactly equal<br/>
|
||||
* * `-1` if `p.row` is less then the calling range<br/>
|
||||
* * `1` if `p.row` is greater than the calling range, or if `isStart` is `true`.<br/>
|
||||
* <br/>
|
||||
* If the starting row of the calling range is equal to `p.row`, and:<br/>
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
|
||||
* * Otherwise, it returns -1<br/>
|
||||
* <br/>
|
||||
* If the ending row of the calling range is equal to `p.row`, and:<br/>
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
* Checks the row and column points with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `0` if the two points are exactly equal
|
||||
* * `-1` if `p.row` is less then the calling range
|
||||
* * `1` if `p.row` is greater than the calling range, or if `isStart` is `true.
|
||||
*
|
||||
* If the starting row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
|
||||
* * Otherwise, it returns -1
|
||||
*
|
||||
* If the ending row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
**/
|
||||
this.compareStart = function(row, column) {
|
||||
|
|
@ -402,22 +399,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
* Range.compareEnd(row, column) -> Number
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
* + (Number): This method returns one of the following numbers:<br/>
|
||||
* * `0` if the two points are exactly equal<br/>
|
||||
* * `-1` if `p.row` is less then the calling range<br/>
|
||||
* * `1` if `p.row` is greater than the calling range, or if `isEnd` is `true.<br/>
|
||||
* <br/>
|
||||
* If the starting row of the calling range is equal to `p.row`, and:<br/>
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
|
||||
* * Otherwise, it returns -1<br/>
|
||||
*<br/>
|
||||
* If the ending row of the calling range is equal to `p.row`, and:<br/>
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
* Checks the row and column points with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `0` if the two points are exactly equal
|
||||
* * `-1` if `p.row` is less then the calling range
|
||||
* * `1` if `p.row` is greater than the calling range, or if `isEnd` is `true.
|
||||
*
|
||||
* If the starting row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
|
||||
* * Otherwise, it returns -1
|
||||
*
|
||||
* If the ending row of the calling range is equal to `p.row`, and:
|
||||
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`
|
||||
* * Otherwise, it returns 1
|
||||
*
|
||||
**/
|
||||
this.compareEnd = function(row, column) {
|
||||
|
|
@ -432,15 +428,15 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
|||
* Range.compareInside(row, column) -> Number
|
||||
* - row (Number): A row point to compare with
|
||||
* - column (Number): A column point to compare with
|
||||
* + (Number): This method returns one of the following numbers:<br/>
|
||||
* * `1` if the ending row of the calling range is equal to `row`, and the ending column of the calling range is equal to `column`<br/>
|
||||
* * `-1` if the starting row of the calling range is equal to `row`, and the starting column of the calling range is equal to `column`<br/>
|
||||
* <br/>
|
||||
* Otherwise, it returns the value after calling [[Range.compare `compare()`]].
|
||||
*
|
||||
* Checks the row and column points with the row and column points of the calling range.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* * `1` if the ending row of the calling range is equal to `row`, and the ending column of the calling range is equal to `column`
|
||||
* * `-1` if the starting row of the calling range is equal to `row`, and the starting column of the calling range is equal to `column`
|
||||
*
|
||||
* Otherwise, it returns the value after calling [[Range.compare `compare()`]].
|
||||
*
|
||||
**/
|
||||
this.compareInside = function(row, column) {
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ Search.SELECTION = 2;
|
|||
};
|
||||
|
||||
/**
|
||||
* Search.findAll(session) -> Array | null
|
||||
* Search.findAll(session) -> [Range] | null
|
||||
* - session (EditSession): The session to search with
|
||||
*
|
||||
* Searches for all occurances `options.needle`. If found, this method returns an array of [[Range `Range`s]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session.
|
||||
|
|
@ -165,17 +165,15 @@ Search.SELECTION = 2;
|
|||
};
|
||||
|
||||
/**
|
||||
* Search.replace(input, replacement) -> String | null
|
||||
* Search.replace(input, replacement) -> String
|
||||
* - input (String): The text to search in
|
||||
* - replacement (String): The replacing text
|
||||
* + (String): If `options.regExp` is `true`, this function returns `input` with the replacement already made. Otherwise, this function just returns `replacement`.<br/>
|
||||
* If `options.needle` was not found, this function returns `null`.
|
||||
*
|
||||
* Searches for `options.needle` in `input`, and, if found, replaces it with `replacement`.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* If `options.regExp` is `true`, this function returns `input` with the replacement already made. Otherwise, this function just returns `replacement`.
|
||||
*
|
||||
* If `options.needle` was not found, this function returns `null`.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.replace = function(input, replacement) {
|
||||
|
|
|
|||
|
|
@ -67,9 +67,10 @@ var TokenIterator = function(session, initialRow, initialColumn) {
|
|||
(function() {
|
||||
|
||||
/**
|
||||
* TokenIterator.stepBackward() -> Array | null
|
||||
* TokenIterator.stepBackward() -> [String]
|
||||
* + (String): If the current point is not at the top of the file, this function returns `null`. Otherwise, it returns an array of the tokenized strings.
|
||||
*
|
||||
* Tokenizes all the items from the current point to the row prior in the document. If the current point is at the top of the file, this function returns `null`. Otherwise, it returns an array of the tokenized strings.
|
||||
* Tokenizes all the items from the current point to the row prior in the document.
|
||||
**/
|
||||
this.stepBackward = function() {
|
||||
this.$tokenIndex -= 1;
|
||||
|
|
@ -89,7 +90,7 @@ var TokenIterator = function(session, initialRow, initialColumn) {
|
|||
};
|
||||
|
||||
/**
|
||||
* TokenIterator.stepForward() -> String | null
|
||||
* TokenIterator.stepForward() -> String
|
||||
*
|
||||
* Tokenizes all the items from the current point until the next row in the document. If the current point is at the end of the file, this function returns `null`. Otherwise, it returns the tokenized string.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -1075,9 +1075,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
*
|
||||
* Returns an object containing the `pageX` and `pageY` coordinates of the document position.
|
||||
*
|
||||
* #### Returns
|
||||
*
|
||||
* The object returned has two properties: `pageX` and `pageY`.
|
||||
*
|
||||
**/
|
||||
this.textToScreenCoordinates = function(row, column) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue