fix documentation for position
This commit is contained in:
parent
e5ca6769cd
commit
b9417a10be
2 changed files with 31 additions and 35 deletions
|
|
@ -38,14 +38,14 @@ var Anchor = require("./anchor").Anchor;
|
|||
|
||||
/**
|
||||
* Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s.
|
||||
*
|
||||
*
|
||||
* At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
|
||||
*
|
||||
* @class Document
|
||||
**/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
|
||||
* @param {String | Array} text The starting text
|
||||
* @constructor
|
||||
|
|
@ -104,7 +104,7 @@ var Document = function(text) {
|
|||
* @method $split
|
||||
* @param {String} text The text to work with
|
||||
* @returns {String} A String array, with each index containing a piece of the original `text` string.
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
|
|
@ -135,9 +135,9 @@ var Document = function(text) {
|
|||
* If `newLineMode == unix`, `\n` is returned.
|
||||
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getNewLineCharacter = function() {
|
||||
switch (this.$newLineMode) {
|
||||
|
|
@ -189,7 +189,7 @@ var Document = function(text) {
|
|||
/**
|
||||
* Returns a verbatim copy of the given line as it is in the document
|
||||
* @param {Number} row The row index to retrieve
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
|
@ -201,7 +201,7 @@ var Document = function(text) {
|
|||
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
|
||||
* @param {Number} firstRow The first row index to retrieve
|
||||
* @param {Number} lastRow The final row index to retrieve
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
|
@ -253,11 +253,9 @@ var Document = function(text) {
|
|||
|
||||
/**
|
||||
* Inserts a block of `text` and the indicated `position`.
|
||||
* @param {Number} position The position to start inserting at
|
||||
* @param {Object} position The position to start inserting at
|
||||
* @param {String} text A chunk of text to insert
|
||||
* @returns {Number} The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
*
|
||||
*
|
||||
* @returns {Object} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
*
|
||||
**/
|
||||
this.insert = function(position, text) {
|
||||
|
|
@ -350,12 +348,12 @@ var Document = function(text) {
|
|||
|
||||
/**
|
||||
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
|
||||
* @param {String} position The position to insert at
|
||||
* @param {Object} position The position to insert at
|
||||
* @returns {Object} Returns an object containing the final row and column, like this:<br/>
|
||||
* ```
|
||||
* {row: endRow, column: 0}
|
||||
* ```
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.insertNewLine = function(position) {
|
||||
position = this.$clipPosition(position);
|
||||
|
|
@ -381,15 +379,13 @@ var Document = function(text) {
|
|||
|
||||
/**
|
||||
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
|
||||
* @param {Number} position The position to insert at
|
||||
* @param {Object} position The position to insert at
|
||||
* @param {String} text A chunk of text
|
||||
* @returns {Object} Returns an object containing the final row and column, like this:
|
||||
* ```
|
||||
* {row: endRow, column: 0}
|
||||
* ```
|
||||
* @returns {Number} If `text` is empty, this function returns the value of `position`
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.insertInLine = function(position, text) {
|
||||
if (text.length == 0)
|
||||
|
|
@ -419,7 +415,7 @@ var Document = function(text) {
|
|||
* Removes the `range` from the document.
|
||||
* @param {Range} range A specified Range to remove
|
||||
* @returns {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`.
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.remove = function(range) {
|
||||
|
|
@ -507,7 +503,7 @@ var Document = function(text) {
|
|||
/**
|
||||
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
|
||||
* @param {Number} row The row to check
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.removeNewLine = function(row) {
|
||||
var firstLine = this.getLine(row);
|
||||
|
|
|
|||
|
|
@ -104,19 +104,19 @@ var SearchHighlight = require("./search_highlight").SearchHighlight;
|
|||
**/
|
||||
/**
|
||||
* Emitted when the current mode changes.
|
||||
*
|
||||
*
|
||||
* @event changeMode
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* Emitted when the wrap mode changes.
|
||||
*
|
||||
*
|
||||
* @event changeWrapMode
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* Emitted when the wrapping limit changes.
|
||||
*
|
||||
*
|
||||
* @event changeWrapLimit
|
||||
*
|
||||
**/
|
||||
|
|
@ -138,8 +138,8 @@ var SearchHighlight = require("./search_highlight").SearchHighlight;
|
|||
*
|
||||
* @param {Number} scrollLeft The new scroll left value
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`.
|
||||
|
|
@ -172,7 +172,7 @@ var EditSession = function(text, mode) {
|
|||
if (typeof text != "object" || !text.getLine)
|
||||
text = new Document(text);
|
||||
|
||||
this.setDocument(text);
|
||||
this.setDocument(text);
|
||||
|
||||
this.selection = new Selection(this);
|
||||
this.setMode(mode);
|
||||
|
|
@ -1158,18 +1158,18 @@ var EditSession = function(text, mode) {
|
|||
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
|
||||
* @param {Number} firstRow The first row index to retrieve
|
||||
* @param {Number} lastRow The final row index to retrieve
|
||||
*
|
||||
*
|
||||
* @returns [String]
|
||||
*
|
||||
**/
|
||||
*
|
||||
**/
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
return this.doc.getLines(firstRow, lastRow);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the number of rows in the document.
|
||||
* Returns the number of rows in the document.
|
||||
* @returns {Number}
|
||||
**/
|
||||
**/
|
||||
this.getLength = function() {
|
||||
return this.doc.getLength();
|
||||
};
|
||||
|
|
@ -1177,18 +1177,18 @@ var EditSession = function(text, mode) {
|
|||
/**
|
||||
* {:Document.getTextRange.desc}
|
||||
* @param {Range} range The range to work with
|
||||
*
|
||||
*
|
||||
* @returns {Range}
|
||||
**/
|
||||
**/
|
||||
this.getTextRange = function(range) {
|
||||
return this.doc.getTextRange(range || this.selection.getRange());
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a block of `text` and the indicated `position`.
|
||||
* @param {Number} position The position to start inserting at
|
||||
* @param {Object} position The position {row, column} to start inserting at
|
||||
* @param {String} text A chunk of text to insert
|
||||
* @returns {Number} The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
* @returns {Object} The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
|
@ -2027,7 +2027,7 @@ var EditSession = function(text, mode) {
|
|||
* 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.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
|
@ -2076,7 +2076,7 @@ var EditSession = function(text, mode) {
|
|||
/**
|
||||
* Returns the position (on screen) for the last character in the provided screen row.
|
||||
* @param {Number} screenRow The screen row to check
|
||||
*
|
||||
*
|
||||
*
|
||||
* @related EditSession.documentToScreenColumn
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue