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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue