fix documentation for position

This commit is contained in:
nightwing 2012-11-25 23:55:53 +04:00
commit b9417a10be
2 changed files with 31 additions and 35 deletions

View file

@ -253,11 +253,9 @@ var Document = function(text) {
/** /**
* Inserts a block of `text` and the indicated `position`. * 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 * @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) { this.insert = function(position, text) {
@ -350,7 +348,7 @@ var Document = function(text) {
/** /**
* 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.
* @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/> * @returns {Object} Returns an object containing the final row and column, like this:<br/>
* ``` * ```
* {row: endRow, column: 0} * {row: endRow, column: 0}
@ -381,14 +379,12 @@ var Document = function(text) {
/** /**
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event. * 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 * @param {String} text A chunk of text
* @returns {Object} Returns an object containing the final row and column, like this: * @returns {Object} Returns an object containing the final row and column, like this:
* ``` * ```
* {row: endRow, column: 0} * {row: endRow, column: 0}
* ``` * ```
* @returns {Number} If `text` is empty, this function returns the value of `position`
*
* *
**/ **/
this.insertInLine = function(position, text) { this.insertInLine = function(position, text) {

View file

@ -172,7 +172,7 @@ var EditSession = function(text, mode) {
if (typeof text != "object" || !text.getLine) if (typeof text != "object" || !text.getLine)
text = new Document(text); text = new Document(text);
this.setDocument(text); this.setDocument(text);
this.selection = new Selection(this); this.selection = new Selection(this);
this.setMode(mode); 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`. * 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} firstRow The first row index to retrieve
* @param {Number} lastRow The final row index to retrieve * @param {Number} lastRow The final row index to retrieve
* *
* @returns [String] * @returns [String]
* *
**/ **/
this.getLines = function(firstRow, lastRow) { this.getLines = function(firstRow, lastRow) {
return this.doc.getLines(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} * @returns {Number}
**/ **/
this.getLength = function() { this.getLength = function() {
return this.doc.getLength(); return this.doc.getLength();
}; };
@ -1177,18 +1177,18 @@ var EditSession = function(text, mode) {
/** /**
* {:Document.getTextRange.desc} * {:Document.getTextRange.desc}
* @param {Range} range The range to work with * @param {Range} range The range to work with
* *
* @returns {Range} * @returns {Range}
**/ **/
this.getTextRange = function(range) { this.getTextRange = function(range) {
return this.doc.getTextRange(range || this.selection.getRange()); return this.doc.getTextRange(range || this.selection.getRange());
}; };
/** /**
* Inserts a block of `text` and the indicated `position`. * 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 * @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`.
* *
* *
**/ **/
@ -2076,7 +2076,7 @@ var EditSession = function(text, mode) {
/** /**
* Returns the position (on screen) for the last character in the provided screen row. * Returns the position (on screen) for the last character in the provided screen row.
* @param {Number} screenRow The screen row to check * @param {Number} screenRow The screen row to check
* *
* *
* @related EditSession.documentToScreenColumn * @related EditSession.documentToScreenColumn
**/ **/