Save changes
This commit is contained in:
parent
0739444f87
commit
eb955fa90d
18 changed files with 15484 additions and 1283 deletions
14365
api/api.json
14365
api/api.json
File diff suppressed because it is too large
Load diff
|
|
@ -2,6 +2,7 @@ var fs = require("fs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var panino = require("panino");
|
var panino = require("panino");
|
||||||
var srcPath = __dirname + "/../lib/ace";
|
var srcPath = __dirname + "/../lib/ace";
|
||||||
|
var buildType = process.argv.splice(2)[0];buildType
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
title : "Ace API",
|
title : "Ace API",
|
||||||
|
|
@ -46,7 +47,7 @@ panino.parse(files, options, function (err, ast) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
panino.render('json', ast, options, function (err) {
|
panino.render(buildType || 'html', ast, options, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
|
||||||
|
|
@ -36,19 +36,19 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
|
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
|
||||||
*
|
*
|
||||||
* @class Anchor
|
* @class Anchor
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new Anchor(doc, row, column)
|
* Creates a new `Anchor` and associates it with a document.
|
||||||
|
*
|
||||||
* @param {Document} doc The document to associate with the anchor
|
* @param {Document} doc The document to associate with the anchor
|
||||||
* @param {Number} row The starting row position
|
* @param {Number} row The starting row position
|
||||||
* @param {Number} column The starting column position
|
* @param {Number} column The starting column position
|
||||||
*
|
*
|
||||||
* Creates a new `Anchor` and associates it with a document.
|
* @constructor
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
var Anchor = exports.Anchor = function(doc, row, column) {
|
var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
|
|
@ -69,7 +69,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an object identifying the `row` and `column` position of the current anchor.
|
* Returns an object identifying the `row` and `column` position of the current anchor.
|
||||||
* @returns Object
|
* @returns {Object}
|
||||||
**/
|
**/
|
||||||
|
|
||||||
this.getPosition = function() {
|
this.getPosition = function() {
|
||||||
|
|
@ -79,7 +79,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Returns the current document.
|
* Returns the current document.
|
||||||
* @returns Document
|
* @returns {Document}
|
||||||
**/
|
**/
|
||||||
|
|
||||||
this.getDocument = function() {
|
this.getDocument = function() {
|
||||||
|
|
@ -87,15 +87,17 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @event change
|
|
||||||
* @param {Object} e An object containing information about the anchor position. It has two properties:
|
|
||||||
- `old`: An object describing the old Anchor position
|
|
||||||
- `value`: An object describing the new Anchor position
|
|
||||||
* Both of these objects have a `row` and `column` property corresponding to the position.
|
|
||||||
*
|
|
||||||
* Fires whenever the anchor position changes.
|
* Fires whenever the anchor position changes.
|
||||||
*
|
*
|
||||||
|
* Both of these objects have a `row` and `column` property corresponding to the position.
|
||||||
|
*
|
||||||
* Events that can trigger this function include [[Anchor.setPosition `setPosition()`]].
|
* Events that can trigger this function include [[Anchor.setPosition `setPosition()`]].
|
||||||
|
*
|
||||||
|
* @event change
|
||||||
|
* @param {Object} e An object containing information about the anchor position. It has two properties:
|
||||||
|
* - `old`: An object describing the old Anchor position
|
||||||
|
* - `value`: An object describing the new Anchor position
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
@ -165,12 +167,12 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Anchor.setPosition(row, column, noClip)
|
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
|
||||||
* @param {Number} row The row index to move the anchor to
|
* @param {Number} row The row index to move the anchor to
|
||||||
* @param {Number} column The column index to move the anchor to
|
* @param {Number} column The column index to move the anchor to
|
||||||
* @param {Boolean} noClip Identifies if you want the position to be clipped
|
* @param {Boolean} noClip Identifies if you want the position to be clipped
|
||||||
*
|
*
|
||||||
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
@ -212,11 +214,11 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Anchor.clipPositionToDocument(row, column)
|
* Clips the anchor position to the specified row and column.
|
||||||
* @param {Number} row The row index to clip the anchor to
|
* @param {Number} row The row index to clip the anchor to
|
||||||
* @param {Number} column The column index to clip the anchor to
|
* @param {Number} column The column index to clip the anchor to
|
||||||
*
|
*
|
||||||
* Clips the anchor position to the specified row and column.
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.$clipPositionToDocument = function(row, column) {
|
this.$clipPositionToDocument = function(row, column) {
|
||||||
|
|
|
||||||
|
|
@ -38,22 +38,23 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||||
var MAX_LINE_LENGTH = 5000;
|
var MAX_LINE_LENGTH = 5000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class BackgroundTokenizer
|
*
|
||||||
*
|
*
|
||||||
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
|
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
|
||||||
*
|
*
|
||||||
* If a certain row is changed, everything below that row is re-tokenized.
|
* If a certain row is changed, everything below that row is re-tokenized.
|
||||||
*
|
*
|
||||||
|
* @class BackgroundTokenizer
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new BackgroundTokenizer(tokenizer, editor)
|
* Creates a new `BackgroundTokenizer` object.
|
||||||
* @param {Tokenizer} tokenizer The tokenizer to use
|
* @param {Tokenizer} tokenizer The tokenizer to use
|
||||||
* @param {Editor} editor The editor to associate with
|
* @param {Editor} editor The editor to associate with
|
||||||
*
|
*
|
||||||
* Creates a new `BackgroundTokenizer` object.
|
*
|
||||||
*
|
*
|
||||||
*
|
* @constructor
|
||||||
**/
|
**/
|
||||||
|
|
||||||
var BackgroundTokenizer = function(tokenizer, editor) {
|
var BackgroundTokenizer = function(tokenizer, editor) {
|
||||||
|
|
@ -100,10 +101,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Tokenizer} tokenizer The new tokenizer to use
|
|
||||||
*
|
|
||||||
* Sets a new tokenizer for this object.
|
* Sets a new tokenizer for this object.
|
||||||
*
|
*
|
||||||
|
* @param {Tokenizer} tokenizer The new tokenizer to use
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.setTokenizer = function(tokenizer) {
|
this.setTokenizer = function(tokenizer) {
|
||||||
this.tokenizer = tokenizer;
|
this.tokenizer = tokenizer;
|
||||||
|
|
@ -114,10 +115,8 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Document} doc The new document to associate with
|
|
||||||
*
|
|
||||||
* Sets a new document to associate with this object.
|
* Sets a new document to associate with this object.
|
||||||
*
|
* @param {Document} doc The new document to associate with
|
||||||
**/
|
**/
|
||||||
this.setDocument = function(doc) {
|
this.setDocument = function(doc) {
|
||||||
this.doc = doc;
|
this.doc = doc;
|
||||||
|
|
@ -128,18 +127,17 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Fires whenever the background tokeniziers between a range of rows are going to be updated.
|
||||||
|
*
|
||||||
* @event update
|
* @event update
|
||||||
* @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated.
|
* @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated.
|
||||||
*
|
*
|
||||||
* Fires whenever the background tokeniziers between a range of rows are going to be updated.
|
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
/**
|
/**
|
||||||
|
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
|
||||||
* @param {Number} firstRow The starting row region
|
* @param {Number} firstRow The starting row region
|
||||||
* @param {Number} lastRow The final row region
|
* @param {Number} lastRow The final row region
|
||||||
*
|
*
|
||||||
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
|
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
this.fireUpdateEvent = function(firstRow, lastRow) {
|
this.fireUpdateEvent = function(firstRow, lastRow) {
|
||||||
var data = {
|
var data = {
|
||||||
|
|
@ -150,10 +148,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Number} startRow The row to start at
|
|
||||||
*
|
|
||||||
* Starts tokenizing at the row indicated.
|
* Starts tokenizing at the row indicated.
|
||||||
*
|
*
|
||||||
|
* @param {Number} startRow The row to start at
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.start = function(startRow) {
|
this.start = function(startRow) {
|
||||||
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
|
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
|
||||||
|
|
@ -202,9 +200,11 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gives list of tokens of the row. (tokens are cached)
|
||||||
|
*
|
||||||
* @param {Number} row The row to get tokens at
|
* @param {Number} row The row to get tokens at
|
||||||
*
|
*
|
||||||
* Gives list of tokens of the row. (tokens are cached)
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.getTokens = function(row) {
|
this.getTokens = function(row) {
|
||||||
|
|
@ -212,9 +212,9 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Number} row The row to get state at
|
|
||||||
*
|
|
||||||
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
|
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
|
||||||
|
*
|
||||||
|
* @param {Number} row The row to get state at
|
||||||
**/
|
**/
|
||||||
this.getState = function(row) {
|
this.getState = function(row) {
|
||||||
if (this.currentLine == row)
|
if (this.currentLine == row)
|
||||||
|
|
|
||||||
|
|
@ -37,21 +37,18 @@ var Range = require("./range").Range;
|
||||||
var Anchor = require("./anchor").Anchor;
|
var Anchor = require("./anchor").Anchor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Document
|
|
||||||
*
|
|
||||||
* Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s.
|
* 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.
|
* 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
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new Document([text])
|
*
|
||||||
* @param {String | Array} text The starting text
|
|
||||||
*
|
|
||||||
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
|
* 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
|
||||||
**/
|
**/
|
||||||
|
|
||||||
var Document = function(text) {
|
var Document = function(text) {
|
||||||
|
|
@ -73,9 +70,9 @@ var Document = function(text) {
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} text 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`.
|
||||||
|
*
|
||||||
|
* @param {String} text The text to use
|
||||||
**/
|
**/
|
||||||
this.setValue = function(text) {
|
this.setValue = function(text) {
|
||||||
var len = this.getLength();
|
var len = this.getLength();
|
||||||
|
|
@ -91,21 +88,23 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Creates a new `Anchor` to define a floating point in the document.
|
||||||
* @param {Number} row The row number to use
|
* @param {Number} row The row number to use
|
||||||
* @param {Number} column The column number to use
|
* @param {Number} column The column number to use
|
||||||
*
|
*
|
||||||
* 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);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} text The text to work with
|
|
||||||
* @returns 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.
|
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
|
||||||
|
*
|
||||||
* @method $split
|
* @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.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
@ -131,12 +130,12 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document.getNewLineCharacter() -> String
|
* Returns the newline character that's being used, depending on the value of `newLineMode`.
|
||||||
* @returns {String} If `newLineMode == windows`, `\r\n` is returned.
|
* @returns {String} If `newLineMode == windows`, `\r\n` is returned.
|
||||||
* If `newLineMode == unix`, `\n` is returned.
|
* If `newLineMode == unix`, `\n` is returned.
|
||||||
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
||||||
*
|
*
|
||||||
* Returns the newline character that's being used, depending on the value of `newLineMode`.
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
@ -156,9 +155,10 @@ var Document = function(text) {
|
||||||
this.$autoNewLine = "\n";
|
this.$autoNewLine = "\n";
|
||||||
this.$newLineMode = "auto";
|
this.$newLineMode = "auto";
|
||||||
/**
|
/**
|
||||||
|
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
|
||||||
* @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
|
* @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
|
||||||
*
|
*
|
||||||
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
|
*
|
||||||
**/
|
**/
|
||||||
this.setNewLineMode = function(newLineMode) {
|
this.setNewLineMode = function(newLineMode) {
|
||||||
if (this.$newLineMode === newLineMode)
|
if (this.$newLineMode === newLineMode)
|
||||||
|
|
@ -169,16 +169,17 @@ var Document = function(text) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
|
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
|
||||||
*
|
* @returns String
|
||||||
**/
|
**/
|
||||||
this.getNewLineMode = function() {
|
this.getNewLineMode = function() {
|
||||||
return this.$newLineMode;
|
return this.$newLineMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
|
||||||
* @param {String} text The text to check
|
* @param {String} text The text to check
|
||||||
*
|
*
|
||||||
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.isNewLine = function(text) {
|
this.isNewLine = function(text) {
|
||||||
|
|
@ -186,9 +187,10 @@ 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
|
* @param {Number} row The row index to retrieve
|
||||||
*
|
*
|
||||||
* Returns a verbatim copy of the given line as it is in the document
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.getLine = function(row) {
|
this.getLine = function(row) {
|
||||||
|
|
@ -196,10 +198,11 @@ 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} 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 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) {
|
||||||
|
|
@ -221,9 +224,10 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
|
||||||
* @param {Range} range The range to work with
|
* @param {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}
|
*
|
||||||
**/
|
**/
|
||||||
this.getTextRange = function(range) {
|
this.getTextRange = function(range) {
|
||||||
if (range.start.row == range.end.row) {
|
if (range.start.row == range.end.row) {
|
||||||
|
|
@ -248,11 +252,12 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Inserts a block of `text` and the indicated `position`.
|
||||||
* @param {Number} position The position to start inserting at
|
* @param {Number} 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 {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`.
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.insert = function(position, text) {
|
this.insert = function(position, text) {
|
||||||
|
|
@ -279,9 +284,6 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @event change
|
|
||||||
* @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties.
|
|
||||||
*
|
|
||||||
* Fires whenever the document changes.
|
* Fires whenever the document changes.
|
||||||
*
|
*
|
||||||
* Several methods trigger different `"change"` events. Below is a list of each action type, followed by each property that's also available:
|
* Several methods trigger different `"change"` events. Below is a list of each action type, followed by each property that's also available:
|
||||||
|
|
@ -300,11 +302,15 @@ var Document = function(text) {
|
||||||
* * `range`: the [[Range]] of the change within the document
|
* * `range`: the [[Range]] of the change within the document
|
||||||
* * `text`: the text that's being removed
|
* * `text`: the text that's being removed
|
||||||
*
|
*
|
||||||
|
* @event change
|
||||||
|
* @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties.
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
/**
|
/**
|
||||||
|
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
|
||||||
* @param {Number} row The index of the row to insert at
|
* @param {Number} row The index of the row to insert at
|
||||||
* @param {Array} lines An array of strings
|
* @param {Array} lines An array of strings
|
||||||
* @returns Object Contains the final row and column, like this:
|
* @returns {Object} Contains the final row and column, like this:
|
||||||
* ```
|
* ```
|
||||||
* {row: endRow, column: 0}
|
* {row: endRow, column: 0}
|
||||||
* ```
|
* ```
|
||||||
|
|
@ -313,7 +319,7 @@ var Document = function(text) {
|
||||||
* {row: row, column: 0}
|
* {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.
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
@ -343,16 +349,13 @@ 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 {String} 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}
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* 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);
|
||||||
|
|
@ -377,6 +380,7 @@ 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 {Number} 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:
|
||||||
|
|
@ -385,10 +389,7 @@ var Document = function(text) {
|
||||||
* ```
|
* ```
|
||||||
* @returns {Number} If `text` is empty, this function returns the value of `position`
|
* @returns {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.
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
this.insertInLine = function(position, text) {
|
this.insertInLine = function(position, text) {
|
||||||
if (text.length == 0)
|
if (text.length == 0)
|
||||||
|
|
@ -415,11 +416,10 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Removes the `range` from the document.
|
||||||
* @param {Range} range A specified Range to remove
|
* @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`.
|
* @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`.
|
||||||
*
|
*
|
||||||
* Removes the `range` from the document.
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.remove = function(range) {
|
this.remove = function(range) {
|
||||||
|
|
@ -455,13 +455,12 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
|
||||||
* @param {Number} row The row to remove from
|
* @param {Number} row The row to remove from
|
||||||
* @param {Number} startColumn The column to start removing at
|
* @param {Number} startColumn The column to start removing at
|
||||||
* @param {Number} endColumn The column to stop removing at
|
* @param {Number} endColumn The column to stop removing at
|
||||||
* @returns {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.
|
* @returns {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.
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.removeInLine = function(row, startColumn, endColumn) {
|
this.removeInLine = function(row, startColumn, endColumn) {
|
||||||
|
|
@ -484,12 +483,11 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Removes a range of full lines. This method also triggers the `'change'` event.
|
||||||
* @param {Number} firstRow The first row to be removed
|
* @param {Number} firstRow The first row to be removed
|
||||||
* @param {Number} lastRow The last row to be removed
|
* @param {Number} lastRow The last row to be removed
|
||||||
* @returns {[String]} Returns all the removed lines.
|
* @returns {[String]} Returns all the removed lines.
|
||||||
*
|
*
|
||||||
* Removes a range of full lines. This method also triggers the `'change'` event.
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.removeLines = function(firstRow, lastRow) {
|
this.removeLines = function(firstRow, lastRow) {
|
||||||
|
|
@ -507,10 +505,9 @@ 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
|
* @param {Number} row The row to check
|
||||||
*
|
*
|
||||||
* 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);
|
||||||
|
|
@ -530,6 +527,7 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Replaces a range in the document with the new `text`.
|
||||||
* @param {Range} range A specified Range to replace
|
* @param {Range} range A specified Range to replace
|
||||||
* @param {String} text The new text to use as a replacement
|
* @param {String} text The new text to use as a replacement
|
||||||
* @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:
|
||||||
|
|
@ -537,7 +535,6 @@ var Document = function(text) {
|
||||||
* 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.
|
||||||
* If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` 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`.
|
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.replace = function(range, text) {
|
this.replace = function(range, text) {
|
||||||
|
|
@ -561,7 +558,7 @@ var Document = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* =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++) {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -35,14 +35,12 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||||
var oop = require("./lib/oop");
|
var oop = require("./lib/oop");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class PlaceHolder
|
* @class PlaceHolder
|
||||||
*
|
|
||||||
* TODO
|
|
||||||
*
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new PlaceHolder(session, length, pos, others, mainClass, othersClass)
|
|
||||||
* - session (Document): The document to associate with the anchor
|
* - session (Document): The document to associate with the anchor
|
||||||
* - length (Number): The starting row position
|
* - length (Number): The starting row position
|
||||||
* - pos (Number): The starting column position
|
* - pos (Number): The starting column position
|
||||||
|
|
@ -50,8 +48,8 @@ var oop = require("./lib/oop");
|
||||||
* - mainClass (String):
|
* - mainClass (String):
|
||||||
* - othersClass (String):
|
* - othersClass (String):
|
||||||
*
|
*
|
||||||
* TODO
|
*
|
||||||
*
|
* @constructor
|
||||||
**/
|
**/
|
||||||
|
|
||||||
var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
|
var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
|
||||||
|
|
|
||||||
334
lib/ace/range.js
334
lib/ace/range.js
|
|
@ -32,21 +32,21 @@ define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class Range
|
*
|
||||||
*
|
*
|
||||||
* This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogus to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.
|
* This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogus to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.
|
||||||
*
|
* @class Range
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new Range(startRow, startColumn, endRow, endColumn)
|
|
||||||
* - startRow (Number): The starting row
|
|
||||||
* - startColumn (Number): The starting column
|
|
||||||
* - endRow (Number): The ending row
|
|
||||||
* - endColumn (Number): The ending column
|
|
||||||
*
|
|
||||||
* Creates a new `Range` object with the given starting and ending row and column points.
|
* Creates a new `Range` object with the given starting and ending row and column points.
|
||||||
|
* @param {Number} startRow The starting row
|
||||||
|
* @param {Number} startColumn The starting column
|
||||||
|
* @param {Number} endRow The ending row
|
||||||
|
* @param {Number} endColumn The ending column
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
**/
|
**/
|
||||||
var Range = function(startRow, startColumn, endRow, endColumn) {
|
var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
this.start = {
|
this.start = {
|
||||||
|
|
@ -62,11 +62,11 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
/**
|
/**
|
||||||
* Range.isEqual(range) -> Boolean
|
|
||||||
* - range (Range): A range to check against
|
|
||||||
*
|
|
||||||
* Returns `true` if and only if the starting row and column, and ending tow and column, are equivalent to those given by `range`.
|
* Returns `true` if and only if the starting row and column, and ending tow and column, are equivalent to those given by `range`.
|
||||||
|
* @param {Range} range A range to check against
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @return Boolean
|
||||||
**/
|
**/
|
||||||
this.isEqual = function(range) {
|
this.isEqual = function(range) {
|
||||||
return this.start.row == range.start.row &&
|
return this.start.row == range.start.row &&
|
||||||
|
|
@ -76,38 +76,42 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.toString() -> String
|
*
|
||||||
*
|
|
||||||
* Returns a string containing the range's row and column information, given like this:
|
* Returns a string containing the range's row and column information, given like this:
|
||||||
*
|
* ```
|
||||||
* [start.row/start.column] -> [end.row/end.column]
|
* [start.row/start.column] -> [end.row/end.column]
|
||||||
*
|
* ```
|
||||||
|
* @return String
|
||||||
**/
|
**/
|
||||||
this.toString = function() {
|
this.toString = function() {
|
||||||
return ("Range: [" + this.start.row + "/" + this.start.column +
|
return ("Range: [" + this.start.row + "/" + this.start.column +
|
||||||
"] -> [" + this.end.row + "/" + this.end.column + "]");
|
"] -> [" + this.end.row + "/" + this.end.column + "]");
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Range.compare
|
/**
|
||||||
* Range.contains(row, column) -> Boolean
|
|
||||||
* - row (Number): A row to check for
|
|
||||||
* - column (Number): A column to check for
|
|
||||||
*
|
*
|
||||||
* Returns `true` if the `row` and `column` provided are within the given range. This can better be expressed as returning `true` if:
|
* Returns `true` if the `row` and `column` provided are within the given range. This can better be expressed as returning `true` if:
|
||||||
*
|
* ```javascript
|
||||||
* this.start.row <= row <= this.end.row &&
|
* this.start.row <= row <= this.end.row &&
|
||||||
* this.start.column <= column <= this.end.column
|
* this.start.column <= column <= this.end.column
|
||||||
*
|
* ```
|
||||||
|
* @param {Number} row A row to check for
|
||||||
|
* @param {Number} column A column to check for
|
||||||
|
* @returns {Boolean}
|
||||||
|
* @related Range.compare
|
||||||
**/
|
**/
|
||||||
|
|
||||||
this.contains = function(row, column) {
|
this.contains = function(row, column) {
|
||||||
return this.compare(row, column) == 0;
|
return this.compare(row, column) == 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Range.compare
|
/**
|
||||||
* Range.compareRange(range) -> Number
|
* Compares `this` range (A) with another range (B).
|
||||||
* - range (Range): A range to compare with
|
* @param {Range} range A range to compare with
|
||||||
* + (Number): This method returns one of the following numbers:<br/>
|
*
|
||||||
|
*
|
||||||
|
* @related Range.compare
|
||||||
|
* @returns {Number} This method returns one of the following numbers:<br/>
|
||||||
* <br/>
|
* <br/>
|
||||||
* * `-2`: (B) is in front of (A), and doesn't intersect with (A)<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/>
|
* * `-1`: (B) begins before (A) but ends inside of (A)<br/>
|
||||||
|
|
@ -115,9 +119,6 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
* * `+1`: (B) begins inside of (A) but ends outside of (A)<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/>
|
* * `+2`: (B) is after (A) and doesn't intersect with (A)<br/>
|
||||||
* * `42`: FTW state: (B) ends in (A) but starts outside of (A)
|
* * `42`: FTW state: (B) ends in (A) but starts outside of (A)
|
||||||
*
|
|
||||||
* Compares `this` range (A) with another range (B).
|
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
this.compareRange = function(range) {
|
this.compareRange = function(range) {
|
||||||
var cmp,
|
var cmp,
|
||||||
|
|
@ -146,12 +147,16 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/** related to: Range.compare
|
/**
|
||||||
* Range.comparePoint(p) -> Number
|
*
|
||||||
* - p (Range): A point to compare with
|
* Checks the row and column points of `p` with the row and column points of the calling range.
|
||||||
* + (Number): This method returns one of the following numbers:<br/>
|
*
|
||||||
|
* @param {Range} p A point to compare with
|
||||||
|
*
|
||||||
|
* @related Range.compare
|
||||||
|
* @returns {Number} This method returns one of the following numbers:<br/>
|
||||||
* * `0` if the two points are exactly equal<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 less then the calling range<br/>
|
||||||
* * `1` if `p.row` is greater than the calling range<br/>
|
* * `1` if `p.row` is greater than the calling range<br/>
|
||||||
|
|
@ -163,70 +168,66 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
* If the ending row of the calling range is equal to `p.row`, and:<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/>
|
* * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
|
||||||
* * Otherwise, it returns 1<br/>
|
* * Otherwise, it returns 1<br/>
|
||||||
*
|
|
||||||
* Checks the row and column points of `p` with the row and column points of the calling range.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
this.comparePoint = function(p) {
|
this.comparePoint = function(p) {
|
||||||
return this.compare(p.row, p.column);
|
return this.compare(p.row, p.column);
|
||||||
}
|
};
|
||||||
|
|
||||||
/** related to: Range.comparePoint
|
/**
|
||||||
* Range.containsRange(range) -> Boolean
|
|
||||||
* - range (Range): A range to compare with
|
|
||||||
*
|
|
||||||
* Checks the start and end points of `range` and compares them to the calling range. Returns `true` if the `range` is contained within the caller's range.
|
* Checks the start and end points of `range` and compares them to the calling range. Returns `true` if the `range` is contained within the caller's range.
|
||||||
|
* @param {Range} range A range to compare with
|
||||||
*
|
*
|
||||||
|
* @returns {Boolean}
|
||||||
|
* @related Range.comparePoint
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.containsRange = function(range) {
|
this.containsRange = function(range) {
|
||||||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.intersects(range) -> Boolean
|
|
||||||
* - range (Range): A range to compare with
|
|
||||||
*
|
|
||||||
* Returns `true` if passed in `range` intersects with the one calling this method.
|
* Returns `true` if passed in `range` intersects with the one calling this method.
|
||||||
|
* @param {Range} range A range to compare with
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.intersects = function(range) {
|
this.intersects = function(range) {
|
||||||
var cmp = this.compareRange(range);
|
var cmp = this.compareRange(range);
|
||||||
return (cmp == -1 || cmp == 0 || cmp == 1);
|
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.isEnd(row, column) -> Boolean
|
|
||||||
* - row (Number): A row point to compare with
|
|
||||||
* - column (Number): A column point to compare with
|
|
||||||
*
|
|
||||||
* Returns `true` if the caller's ending row point is the same as `row`, and if the caller's ending column is the same as `column`.
|
* Returns `true` if the caller's ending row point is the same as `row`, and if the caller's ending column is the same as `column`.
|
||||||
|
* @param {Number} row A row point to compare with
|
||||||
|
* @param {Number} column A column point to compare with
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.isEnd = function(row, column) {
|
this.isEnd = function(row, column) {
|
||||||
return this.end.row == row && this.end.column == column;
|
return this.end.row == row && this.end.column == column;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.isStart(row, column) -> Boolean
|
|
||||||
* - row (Number): A row point to compare with
|
|
||||||
* - column (Number): A column point to compare with
|
|
||||||
*
|
|
||||||
* Returns `true` if the caller's starting row point is the same as `row`, and if the caller's starting column is the same as `column`.
|
* Returns `true` if the caller's starting row point is the same as `row`, and if the caller's starting column is the same as `column`.
|
||||||
|
* @param {Number} row A row point to compare with
|
||||||
|
* @param {Number} column A column point to compare with
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.isStart = function(row, column) {
|
this.isStart = function(row, column) {
|
||||||
return this.start.row == row && this.start.column == column;
|
return this.start.row == row && this.start.column == column;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.setStart(row, column)
|
|
||||||
* - row (Number): A row point to set
|
|
||||||
* - column (Number): A column point to set
|
|
||||||
*
|
|
||||||
* Sets the starting row and column for the range.
|
* Sets the starting row and column for the range.
|
||||||
|
* @param {Number} row A row point to set
|
||||||
|
* @param {Number} column A column point to set
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.setStart = function(row, column) {
|
this.setStart = function(row, column) {
|
||||||
if (typeof row == "object") {
|
if (typeof row == "object") {
|
||||||
|
|
@ -236,14 +237,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
this.start.row = row;
|
this.start.row = row;
|
||||||
this.start.column = column;
|
this.start.column = column;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.setEnd(row, column)
|
|
||||||
* - row (Number): A row point to set
|
|
||||||
* - column (Number): A column point to set
|
|
||||||
*
|
|
||||||
* Sets the starting row and column for the range.
|
* Sets the starting row and column for the range.
|
||||||
|
* @param {Number} row A row point to set
|
||||||
|
* @param {Number} column A column point to set
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setEnd = function(row, column) {
|
this.setEnd = function(row, column) {
|
||||||
|
|
@ -254,15 +255,16 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
this.end.row = row;
|
this.end.row = row;
|
||||||
this.end.column = column;
|
this.end.column = column;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/** related to: Range.compare
|
/**
|
||||||
* Range.inside(row, column) -> Boolean
|
|
||||||
* - row (Number): A row point to compare with
|
|
||||||
* - column (Number): A column point to compare with
|
|
||||||
*
|
|
||||||
* Returns `true` if the `row` and `column` are within the given range.
|
* Returns `true` if the `row` and `column` are within the given range.
|
||||||
|
* @param {Number} row A row point to compare with
|
||||||
|
* @param {Number} column A column point to compare with
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Boolean}
|
||||||
|
* @related Range.compare
|
||||||
**/
|
**/
|
||||||
this.inside = function(row, column) {
|
this.inside = function(row, column) {
|
||||||
if (this.compare(row, column) == 0) {
|
if (this.compare(row, column) == 0) {
|
||||||
|
|
@ -273,15 +275,16 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** related to: Range.compare
|
/**
|
||||||
* Range.insideStart(row, column) -> Boolean
|
|
||||||
* - row (Number): A row point to compare with
|
|
||||||
* - column (Number): A column point to compare with
|
|
||||||
*
|
|
||||||
* Returns `true` if the `row` and `column` are within the given range's starting points.
|
* Returns `true` if the `row` and `column` are within the given range's starting points.
|
||||||
|
* @param {Number} row A row point to compare with
|
||||||
|
* @param {Number} column A column point to compare with
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Boolean}
|
||||||
|
* @related Range.compare
|
||||||
**/
|
**/
|
||||||
this.insideStart = function(row, column) {
|
this.insideStart = function(row, column) {
|
||||||
if (this.compare(row, column) == 0) {
|
if (this.compare(row, column) == 0) {
|
||||||
|
|
@ -292,15 +295,17 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** related to: Range.compare
|
/**
|
||||||
* Range.insideEnd(row, column) -> Boolean
|
|
||||||
* - row (Number): A row point to compare with
|
|
||||||
* - column (Number): A column point to compare with
|
|
||||||
*
|
|
||||||
* Returns `true` if the `row` and `column` are within the given range's ending points.
|
* Returns `true` if the `row` and `column` are within the given range's ending points.
|
||||||
|
* @param {Number} row A row point to compare with
|
||||||
|
* @param {Number} column A column point to compare with
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Boolean}
|
||||||
|
* @related Range.compare
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.insideEnd = function(row, column) {
|
this.insideEnd = function(row, column) {
|
||||||
if (this.compare(row, column) == 0) {
|
if (this.compare(row, column) == 0) {
|
||||||
|
|
@ -311,28 +316,26 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.compare(row, column) -> Number
|
* Checks the row and column points with the row and column points of the calling range.
|
||||||
* - row (Number): A row point to compare with
|
* @param {Number} row A row point to compare with
|
||||||
* - column (Number): A column point to compare with
|
* @param {Number} column 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/>
|
* @returns {Number} This method returns one of the following numbers:<br/>
|
||||||
* * `1` if `p.row` is greater than the calling range <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/>
|
* <br/>
|
||||||
* If the starting row of the calling range is equal to `p.row`, and: <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/>
|
* `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
|
||||||
* * Otherwise, it returns -1<br/>
|
* Otherwise, it returns -1<br/>
|
||||||
* <br/>
|
* <br/>
|
||||||
* If the ending row of the calling range is equal to `p.row`, and: <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/>
|
* `p.column` is less than or equal to the calling range's ending column, this returns `0` <br/>
|
||||||
* * Otherwise, it returns 1
|
* Otherwise, it returns 1
|
||||||
*
|
|
||||||
* Checks the row and column points with the row and column points of the calling range.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
this.compare = function(row, column) {
|
this.compare = function(row, column) {
|
||||||
if (!this.isMultiLine()) {
|
if (!this.isMultiLine()) {
|
||||||
|
|
@ -357,26 +360,25 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.compareStart(row, column) -> Number
|
* Checks the row and column points with the row and column points of the calling range.
|
||||||
* - row (Number): A row point to compare with
|
* @param {Number} row A row point to compare with
|
||||||
* - column (Number): A column point to compare with
|
* @param {Number} column A column point to compare with
|
||||||
* + (Number): This method returns one of the following numbers:<br/>
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @returns {Number} This method returns one of the following numbers:<br/>
|
||||||
* <br/>
|
* <br/>
|
||||||
* * `0` if the two points are exactly equal<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 less then the calling range<br/>
|
||||||
* * `1` if `p.row` is greater than the calling range, or if `isStart` is `true`.<br/>
|
* `1` if `p.row` is greater than the calling range, or if `isStart` is `true`.<br/>
|
||||||
* <br/>
|
* <br/>
|
||||||
* If the starting row of the calling range is equal to `p.row`, and:<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/>
|
* `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
|
||||||
* * Otherwise, it returns -1<br/>
|
* Otherwise, it returns -1<br/>
|
||||||
* <br/>
|
* <br/>
|
||||||
* If the ending row of the calling range is equal to `p.row`, and:<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/>
|
* `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
|
||||||
* * Otherwise, it returns 1
|
* Otherwise, it returns 1
|
||||||
*
|
|
||||||
* Checks the row and column points with the row and column points of the calling range.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.compareStart = function(row, column) {
|
this.compareStart = function(row, column) {
|
||||||
|
|
@ -385,51 +387,47 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
} else {
|
} else {
|
||||||
return this.compare(row, column);
|
return this.compare(row, column);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.compareEnd(row, column) -> Number
|
* Checks the row and column points with the row and column points of the calling range.
|
||||||
* - row (Number): A row point to compare with
|
* @param {Number} row A row point to compare with
|
||||||
* - column (Number): A column point to compare with
|
* @param {Number} column 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/>
|
* @returns {Number} This method returns one of the following numbers:<br/>
|
||||||
* * `1` if `p.row` is greater than the calling range, or if `isEnd` is `true.<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/>
|
* <br/>
|
||||||
* If the starting row of the calling range is equal to `p.row`, and:<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/>
|
* `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
|
||||||
* * Otherwise, it returns -1<br/>
|
* Otherwise, it returns -1<br/>
|
||||||
*<br/>
|
*<br/>
|
||||||
* If the ending row of the calling range is equal to `p.row`, and:<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/>
|
* `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
|
||||||
* * Otherwise, it returns 1
|
* Otherwise, it returns 1
|
||||||
*
|
*/
|
||||||
* Checks the row and column points with the row and column points of the calling range.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
this.compareEnd = function(row, column) {
|
this.compareEnd = function(row, column) {
|
||||||
if (this.end.row == row && this.end.column == column) {
|
if (this.end.row == row && this.end.column == column) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return this.compare(row, column);
|
return this.compare(row, column);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.compareInside(row, column) -> Number
|
* Checks the row and column points with the row and column points of the calling range.
|
||||||
* - row (Number): A row point to compare with
|
* @param {Number} row A row point to compare with
|
||||||
* - column (Number): A column point to compare with
|
* @param {Number} column A column point to compare with
|
||||||
* + (Number): This method returns one of the following numbers:<br/>
|
*
|
||||||
|
*
|
||||||
|
* @returns {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 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/>
|
* * `-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/>
|
* <br/>
|
||||||
* Otherwise, it returns the value after calling [[Range.compare `compare()`]].
|
* 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
this.compareInside = function(row, column) {
|
this.compareInside = function(row, column) {
|
||||||
if (this.end.row == row && this.end.column == column) {
|
if (this.end.row == row && this.end.column == column) {
|
||||||
|
|
@ -439,15 +437,15 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
} else {
|
} else {
|
||||||
return this.compare(row, column);
|
return this.compare(row, column);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.clipRows(firstRow, lastRow) -> Range
|
|
||||||
* - firstRow (Number): The starting row
|
|
||||||
* - lastRow (Number): The ending row
|
|
||||||
*
|
|
||||||
* Returns the part of the current `Range` that occurs within the boundaries of `firstRow` and `lastRow` as a new `Range` object.
|
* Returns the part of the current `Range` that occurs within the boundaries of `firstRow` and `lastRow` as a new `Range` object.
|
||||||
|
* @param {Number} firstRow The starting row
|
||||||
|
* @param {Number} lastRow The ending row
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Range}
|
||||||
**/
|
**/
|
||||||
this.clipRows = function(firstRow, lastRow) {
|
this.clipRows = function(firstRow, lastRow) {
|
||||||
if (this.end.row > lastRow) {
|
if (this.end.row > lastRow) {
|
||||||
|
|
@ -481,12 +479,12 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.extend(row, column) -> Range
|
* Changes the row and column points for the calling range for both the starting and ending points.
|
||||||
* - row (Number): A new row to extend to
|
* @param {Number} row A new row to extend to
|
||||||
* - column (Number): A new column to extend to
|
* @param {Number} column A new column to extend to
|
||||||
*
|
|
||||||
* Changes the row and column points for the calling range for both the starting and ending points. This method returns that range with a new row.
|
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Range} The original range with the new row
|
||||||
**/
|
**/
|
||||||
this.extend = function(row, column) {
|
this.extend = function(row, column) {
|
||||||
var cmp = this.compare(row, column);
|
var cmp = this.compare(row, column);
|
||||||
|
|
@ -506,30 +504,27 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.isMultiLine() -> Boolean
|
*
|
||||||
*
|
* Returns `true` if the range spans across multiple lines.
|
||||||
* Returns true if the range spans across multiple lines.
|
* @returns {Boolean}
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
this.isMultiLine = function() {
|
this.isMultiLine = function() {
|
||||||
return (this.start.row !== this.end.row);
|
return (this.start.row !== this.end.row);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.clone() -> Range
|
*
|
||||||
*
|
|
||||||
* Returns a duplicate of the calling range.
|
* Returns a duplicate of the calling range.
|
||||||
*
|
* @returns {Range}
|
||||||
**/
|
**/
|
||||||
this.clone = function() {
|
this.clone = function() {
|
||||||
return Range.fromPoints(this.start, this.end);
|
return Range.fromPoints(this.start, this.end);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.collapseRows() -> Range
|
|
||||||
*
|
*
|
||||||
* Returns a range containing the starting and ending rows of the original range, but with a column value of `0`.
|
* Returns a range containing the starting and ending rows of the original range, but with a column value of `0`.
|
||||||
*
|
* @returns {Range}
|
||||||
**/
|
**/
|
||||||
this.collapseRows = function() {
|
this.collapseRows = function() {
|
||||||
if (this.end.column == 0)
|
if (this.end.column == 0)
|
||||||
|
|
@ -539,10 +534,11 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.toScreenRange(session) -> Range
|
|
||||||
* - session (EditSession): The `EditSession` to retrieve coordinates from
|
|
||||||
*
|
|
||||||
* Given the current `Range`, this function converts those starting and ending points into screen positions, and then returns a new `Range` object.
|
* Given the current `Range`, this function converts those starting and ending points into screen positions, and then returns a new `Range` object.
|
||||||
|
* @param {EditSession} session The `EditSession` to retrieve coordinates from
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @returns {Range}
|
||||||
**/
|
**/
|
||||||
this.toScreenRange = function(session) {
|
this.toScreenRange = function(session) {
|
||||||
var screenPosStart =
|
var screenPosStart =
|
||||||
|
|
@ -559,12 +555,12 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
}).call(Range.prototype);
|
}).call(Range.prototype);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Range.fromPoints(start, end) -> Range
|
|
||||||
* - start (Range): A starting point to use
|
|
||||||
* - end (Range): An ending point to use
|
|
||||||
*
|
|
||||||
* Creates and returns a new `Range` based on the row and column of the given parameters.
|
* Creates and returns a new `Range` based on the row and column of the given parameters.
|
||||||
*
|
* @param {Range} start A starting point to use
|
||||||
|
* @param {Range} end An ending point to use
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @returns {Range}
|
||||||
**/
|
**/
|
||||||
Range.fromPoints = function(start, end) {
|
Range.fromPoints = function(start, end) {
|
||||||
return new Range(start.row, start.column, end.row, end.column);
|
return new Range(start.row, start.column, end.row, end.column);
|
||||||
|
|
|
||||||
|
|
@ -33,19 +33,14 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var event = require("./lib/event");
|
var event = require("./lib/event");
|
||||||
|
|
||||||
/** internal, hide
|
/**
|
||||||
* class RenderLoop
|
*
|
||||||
*
|
*
|
||||||
* Batches changes (that force something to be redrawn) in the background.
|
* Batches changes (that force something to be redrawn) in the background.
|
||||||
*
|
* @class RenderLoop
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/** internal, hide
|
|
||||||
* new RenderLoop(onRender, win)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
var RenderLoop = function(onRender, win) {
|
var RenderLoop = function(onRender, win) {
|
||||||
this.onRender = onRender;
|
this.onRender = onRender;
|
||||||
this.pending = false;
|
this.pending = false;
|
||||||
|
|
@ -55,12 +50,7 @@ var RenderLoop = function(onRender, win) {
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
/** internal, hide
|
|
||||||
* RenderLoop.schedule(change)
|
|
||||||
* - change (Array):
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
this.schedule = function(change) {
|
this.schedule = function(change) {
|
||||||
//this.onRender(change);
|
//this.onRender(change);
|
||||||
//return;
|
//return;
|
||||||
|
|
|
||||||
|
|
@ -37,18 +37,20 @@ var event = require("./lib/event");
|
||||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class ScrollBar
|
*
|
||||||
*
|
*
|
||||||
* A set of methods for setting and retrieving the editor's scrollbar.
|
* A set of methods for setting and retrieving the editor's scrollbar.
|
||||||
*
|
* @class ScrollBar
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new ScrollBar(parent)
|
|
||||||
* - parent (DOMElement): A DOM element
|
|
||||||
*
|
|
||||||
* Creates a new `ScrollBar`. `parent` is the owner of the scroll bar.
|
* Creates a new `ScrollBar`. `parent` is the owner of the scroll bar.
|
||||||
|
* @param {DOMElement} parent A DOM element
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
**/
|
**/
|
||||||
var ScrollBar = function(parent) {
|
var ScrollBar = function(parent) {
|
||||||
this.element = dom.createElement("div");
|
this.element = dom.createElement("div");
|
||||||
|
|
@ -75,10 +77,11 @@ var ScrollBar = function(parent) {
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ScrollBar@scroll(e)
|
|
||||||
* - e (Object): Contains one property, `"data"`, which indicates the current scroll top position
|
|
||||||
*
|
|
||||||
* Emitted when the scroll bar, well, scrolls.
|
* Emitted when the scroll bar, well, scrolls.
|
||||||
|
* @event scroll
|
||||||
|
* @param {Object} e Contains one property, `"data"`, which indicates the current scroll top position
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.onScroll = function() {
|
this.onScroll = function() {
|
||||||
|
|
@ -86,20 +89,19 @@ var ScrollBar = function(parent) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ScrollBar.getWidth() -> Number
|
*
|
||||||
*
|
|
||||||
* Returns the width of the scroll bar.
|
* Returns the width of the scroll bar.
|
||||||
*
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getWidth = function() {
|
this.getWidth = function() {
|
||||||
return this.width;
|
return this.width;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ScrollBar.setHeight(height)
|
|
||||||
* - height (Number): The new height
|
|
||||||
*
|
|
||||||
* Sets the height of the scroll bar, in pixels.
|
* Sets the height of the scroll bar, in pixels.
|
||||||
|
* @param {Number} height The new height
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setHeight = function(height) {
|
this.setHeight = function(height) {
|
||||||
|
|
@ -107,25 +109,26 @@ var ScrollBar = function(parent) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ScrollBar.setInnerHeight(height)
|
|
||||||
* - height (Number): The new inner height
|
|
||||||
*
|
|
||||||
* Sets the inner height of the scroll bar, in pixels.
|
* Sets the inner height of the scroll bar, in pixels.
|
||||||
|
* @param {Number} height The new inner height
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setInnerHeight = function(height) {
|
this.setInnerHeight = function(height) {
|
||||||
this.inner.style.height = height + "px";
|
this.inner.style.height = height + "px";
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* ScrollBar.setScrollTop(scrollTop)
|
|
||||||
* - scrollTop (Number): The new scroll top
|
|
||||||
*
|
|
||||||
* Sets the scroll top of the scroll bar.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
// TODO: on chrome 17+ for small zoom levels after calling this function
|
// TODO: on chrome 17+ for small zoom levels after calling this function
|
||||||
// this.element.scrollTop != scrollTop which makes page to scroll up.
|
// this.element.scrollTop != scrollTop which makes page to scroll up.
|
||||||
|
/**
|
||||||
|
* Sets the scroll top of the scroll bar.
|
||||||
|
* @param {Number} scrollTop The new scroll top
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
**/
|
||||||
this.setScrollTop = function(scrollTop) {
|
this.setScrollTop = function(scrollTop) {
|
||||||
this.element.scrollTop = scrollTop;
|
this.element.scrollTop = scrollTop;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,28 +36,29 @@ var oop = require("./lib/oop");
|
||||||
var Range = require("./range").Range;
|
var Range = require("./range").Range;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class Search
|
* @class Search
|
||||||
*
|
*
|
||||||
* A class designed to handle all sorts of text searches within a [[Document `Document`]].
|
* A class designed to handle all sorts of text searches within a [[Document `Document`]].
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new Search()
|
*
|
||||||
*
|
*
|
||||||
* Creates a new `Search` object. The following search options are avaliable:
|
* Creates a new `Search` object. The following search options are avaliable:
|
||||||
*
|
*
|
||||||
* * `needle`: The string or regular expression you're looking for
|
* - `needle`: The string or regular expression you're looking for
|
||||||
* * `backwards`: Whether to search backwards from where cursor currently is. Defaults to `false`.
|
* - `backwards`: Whether to search backwards from where cursor currently is. Defaults to `false`.
|
||||||
* * `wrap`: Whether to wrap the search back to the beginning when it hits the end. Defaults to `false`.
|
* - `wrap`: Whether to wrap the search back to the beginning when it hits the end. Defaults to `false`.
|
||||||
* * `caseSensitive`: Whether the search ought to be case-sensitive. Defaults to `false`.
|
* - `caseSensitive`: Whether the search ought to be case-sensitive. Defaults to `false`.
|
||||||
* * `wholeWord`: Whether the search matches only on whole words. Defaults to `false`.
|
* - `wholeWord`: Whether the search matches only on whole words. Defaults to `false`.
|
||||||
* * `range`: The [[Range]] to search within. Set this to `null` for the whole document
|
* - `range`: The [[Range]] to search within. Set this to `null` for the whole document
|
||||||
* * `regExp`: Whether the search is a regular expression or not. Defaults to `false`.
|
* - `regExp`: Whether the search is a regular expression or not. Defaults to `false`.
|
||||||
* * `start`: The starting [[Range]] or cursor position to begin the search
|
* - `start`: The starting [[Range]] or cursor position to begin the search
|
||||||
* * `skipCurrent`: Whether or not to include the current line in the search. Default to `false`.
|
* - `skipCurrent`: Whether or not to include the current line in the search. Default to `false`.
|
||||||
*
|
*
|
||||||
**/
|
* @constructor
|
||||||
|
**/
|
||||||
|
|
||||||
var Search = function() {
|
var Search = function() {
|
||||||
this.$options = {};
|
this.$options = {};
|
||||||
|
|
@ -65,11 +66,12 @@ var Search = function() {
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
/**
|
/**
|
||||||
* Search.set(options) -> Search
|
|
||||||
* - options (Object): An object containing all the new search properties
|
|
||||||
*
|
|
||||||
* Sets the search options via the `options` parameter.
|
* Sets the search options via the `options` parameter.
|
||||||
|
* @param {Object} options An object containing all the new search properties
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Search}
|
||||||
|
* @chainable
|
||||||
**/
|
**/
|
||||||
this.set = function(options) {
|
this.set = function(options) {
|
||||||
oop.mixin(this.$options, options);
|
oop.mixin(this.$options, options);
|
||||||
|
|
@ -77,24 +79,27 @@ var Search = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search.getOptions() -> Object
|
|
||||||
*
|
|
||||||
* [Returns an object containing all the search options.]{: #Search.getOptions}
|
* [Returns an object containing all the search options.]{: #Search.getOptions}
|
||||||
*
|
* @returns {Object}
|
||||||
**/
|
**/
|
||||||
this.getOptions = function() {
|
this.getOptions = function() {
|
||||||
return lang.copyObject(this.$options);
|
return lang.copyObject(this.$options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the search options via the `options` parameter.
|
||||||
|
* @param {Object} An object containing all the search propertie
|
||||||
|
* @related Search.set
|
||||||
|
**/
|
||||||
this.setOptions = function(options) {
|
this.setOptions = function(options) {
|
||||||
this.$options = options;
|
this.$options = options;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Search.find(session) -> Range
|
|
||||||
* - session (EditSession): The session to search with
|
|
||||||
*
|
|
||||||
* Searches for `options.needle`. If found, this method returns the [[Range `Range`]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session.
|
* Searches for `options.needle`. If found, this method returns the [[Range `Range`]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session.
|
||||||
|
* @param {EditSession} session The session to search with
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Range}
|
||||||
**/
|
**/
|
||||||
this.find = function(session) {
|
this.find = function(session) {
|
||||||
var iterator = this.$matchIterator(session, this.$options);
|
var iterator = this.$matchIterator(session, this.$options);
|
||||||
|
|
@ -116,11 +121,11 @@ var Search = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search.findAll(session) -> [Range]
|
|
||||||
* - 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.
|
* 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.
|
||||||
|
* @param {EditSession} session The session to search with
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns [Range]
|
||||||
**/
|
**/
|
||||||
this.findAll = function(session) {
|
this.findAll = function(session) {
|
||||||
var options = this.$options;
|
var options = this.$options;
|
||||||
|
|
@ -179,14 +184,14 @@ var Search = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search.replace(input, replacement) -> String
|
* Searches for `options.needle` in `input`, and, if found, replaces it with `replacement`.
|
||||||
* - input (String): The text to search in
|
* @param {String} input The text to search in
|
||||||
* - replacement (String): The replacing text
|
* @param {String} replacement 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/>
|
* + (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`.
|
* If `options.needle` was not found, this function returns `null`.
|
||||||
*
|
*
|
||||||
* Searches for `options.needle` in `input`, and, if found, replaces it with `replacement`.
|
*
|
||||||
*
|
* @returns {String}
|
||||||
**/
|
**/
|
||||||
this.replace = function(input, replacement) {
|
this.replace = function(input, replacement) {
|
||||||
var options = this.$options;
|
var options = this.$options;
|
||||||
|
|
@ -218,11 +223,6 @@ var Search = function() {
|
||||||
return replacement;
|
return replacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** internal, hide
|
|
||||||
* Search.$matchIterator(session) -> String | Boolean
|
|
||||||
* - session (EditSession): The session to search with
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
this.$matchIterator = function(session, options) {
|
this.$matchIterator = function(session, options) {
|
||||||
var re = this.$assembleRegExp(options);
|
var re = this.$assembleRegExp(options);
|
||||||
if (!re)
|
if (!re)
|
||||||
|
|
|
||||||
|
|
@ -37,32 +37,37 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||||
var Range = require("./range").Range;
|
var Range = require("./range").Range;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class Selection
|
*
|
||||||
*
|
*
|
||||||
* Contains the cursor position and the text selection of an edit session.
|
* Contains the cursor position and the text selection of an edit session.
|
||||||
*
|
*
|
||||||
* The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.
|
* The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.
|
||||||
|
* @class Selection
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new Selection(session)
|
|
||||||
* - session (EditSession): The session to use
|
|
||||||
*
|
|
||||||
* Creates a new `Selection` object.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
/**
|
|
||||||
* Selection@changeCursor()
|
|
||||||
*
|
|
||||||
* Emitted when the cursor position changes.
|
* Emitted when the cursor position changes.
|
||||||
|
* @event changeCursor
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
/**
|
/**
|
||||||
* Selection@changeSelection()
|
|
||||||
*
|
|
||||||
* Emitted when the cursor selection changes.
|
* Emitted when the cursor selection changes.
|
||||||
|
* @event changeSelection
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
/**
|
||||||
|
* Creates a new `Selection` object.
|
||||||
|
* @param {EditSession} session The session to use
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
**/
|
||||||
var Selection = function(session) {
|
var Selection = function(session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.doc = session.getDocument();
|
this.doc = session.getDocument();
|
||||||
|
|
@ -91,9 +96,9 @@ var Selection = function(session) {
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.isEmpty() -> Boolean
|
*
|
||||||
*
|
|
||||||
* Returns `true` if the selection is empty.
|
* Returns `true` if the selection is empty.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
return (this.$isEmpty || (
|
return (this.$isEmpty || (
|
||||||
|
|
@ -102,10 +107,9 @@ var Selection = function(session) {
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
/** extension
|
/**
|
||||||
* Selection.isMultiLine() -> Boolean
|
|
||||||
*
|
|
||||||
* Returns `true` if the selection is a multi-line.
|
* Returns `true` if the selection is a multi-line.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.isMultiLine = function() {
|
this.isMultiLine = function() {
|
||||||
if (this.isEmpty()) {
|
if (this.isEmpty()) {
|
||||||
|
|
@ -115,21 +119,20 @@ var Selection = function(session) {
|
||||||
return this.getRange().isMultiLine();
|
return this.getRange().isMultiLine();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** extension
|
/**
|
||||||
* Selection.getCursor() -> Number
|
|
||||||
*
|
|
||||||
* Gets the current position of the cursor.
|
* Gets the current position of the cursor.
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getCursor = function() {
|
this.getCursor = function() {
|
||||||
return this.lead.getPosition();
|
return this.lead.getPosition();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.setSelectionAnchor(row, column)
|
|
||||||
* - row (Number): The new row
|
|
||||||
* - 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.
|
||||||
|
* @param {Number} row The new row
|
||||||
|
* @param {Number} column The new column
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.setSelectionAnchor = function(row, column) {
|
this.setSelectionAnchor = function(row, column) {
|
||||||
this.anchor.setPosition(row, column);
|
this.anchor.setPosition(row, column);
|
||||||
|
|
@ -140,11 +143,9 @@ var Selection = function(session) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Anchor.getPosition
|
/**
|
||||||
* 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.
|
||||||
*
|
* @related Anchor.getPosition
|
||||||
**/
|
**/
|
||||||
this.getSelectionAnchor = function() {
|
this.getSelectionAnchor = function() {
|
||||||
if (this.$isEmpty)
|
if (this.$isEmpty)
|
||||||
|
|
@ -154,19 +155,19 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
* @returns {Object}
|
||||||
**/
|
**/
|
||||||
this.getSelectionLead = function() {
|
this.getSelectionLead = function() {
|
||||||
return this.lead.getPosition();
|
return this.lead.getPosition();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.shiftSelection(columns)
|
|
||||||
* - 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.
|
||||||
|
* @param {Number} columns The number of columns to shift by
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.shiftSelection = function(columns) {
|
this.shiftSelection = function(columns) {
|
||||||
|
|
@ -191,9 +192,8 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.isBackwards = function() {
|
this.isBackwards = function() {
|
||||||
var anchor = this.anchor;
|
var anchor = this.anchor;
|
||||||
|
|
@ -202,9 +202,8 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.getRange() -> Range
|
|
||||||
*
|
|
||||||
* [Returns the [[Range]] for the selected text.]{: #Selection.getRange}
|
* [Returns the [[Range]] for the selected text.]{: #Selection.getRange}
|
||||||
|
* @returns {Range}
|
||||||
**/
|
**/
|
||||||
this.getRange = function() {
|
this.getRange = function() {
|
||||||
var anchor = this.anchor;
|
var anchor = this.anchor;
|
||||||
|
|
@ -222,8 +221,6 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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() {
|
||||||
|
|
@ -234,8 +231,6 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectAll()
|
|
||||||
*
|
|
||||||
* Selects all the text in the document.
|
* Selects all the text in the document.
|
||||||
**/
|
**/
|
||||||
this.selectAll = function() {
|
this.selectAll = function() {
|
||||||
|
|
@ -245,12 +240,12 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.setSelectionRange(range, reverse)
|
|
||||||
* - range (Range): The range of text to select
|
|
||||||
* - 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.
|
||||||
|
* @param {Range} range The range of text to select
|
||||||
|
* @param {Boolean} reverse Indicates if the range should go backwards (`true`) or not
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @method setSelectionRange
|
||||||
**/
|
**/
|
||||||
this.setRange =
|
this.setRange =
|
||||||
this.setSelectionRange = function(range, reverse) {
|
this.setSelectionRange = function(range, reverse) {
|
||||||
|
|
@ -273,11 +268,11 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectTo(row, column)
|
|
||||||
* - row (Number): The row 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.
|
||||||
|
* @param {Number} row The row to select to
|
||||||
|
* @param {Number} column The column to select to
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.selectTo = function(row, column) {
|
this.selectTo = function(row, column) {
|
||||||
|
|
@ -287,10 +282,10 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectToPosition(pos)
|
|
||||||
* - 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`.
|
||||||
|
* @param {Object} pos An object containing the row and column
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.selectToPosition = function(pos) {
|
this.selectToPosition = function(pos) {
|
||||||
|
|
@ -300,8 +295,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectUp()
|
*
|
||||||
*
|
|
||||||
* Moves the selection up one row.
|
* Moves the selection up one row.
|
||||||
**/
|
**/
|
||||||
this.selectUp = function() {
|
this.selectUp = function() {
|
||||||
|
|
@ -309,8 +303,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectDown()
|
*
|
||||||
*
|
|
||||||
* Moves the selection down one row.
|
* Moves the selection down one row.
|
||||||
**/
|
**/
|
||||||
this.selectDown = function() {
|
this.selectDown = function() {
|
||||||
|
|
@ -318,7 +311,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectRight()
|
*
|
||||||
*
|
*
|
||||||
* Moves the selection right one column.
|
* Moves the selection right one column.
|
||||||
**/
|
**/
|
||||||
|
|
@ -327,8 +320,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectLeft()
|
*
|
||||||
*
|
|
||||||
* Moves the selection left one column.
|
* Moves the selection left one column.
|
||||||
**/
|
**/
|
||||||
this.selectLeft = function() {
|
this.selectLeft = function() {
|
||||||
|
|
@ -336,8 +328,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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() {
|
||||||
|
|
@ -345,8 +336,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectLineEnd()
|
*
|
||||||
*
|
|
||||||
* Moves the selection to the end of the current line.
|
* Moves the selection to the end of the current line.
|
||||||
**/
|
**/
|
||||||
this.selectLineEnd = function() {
|
this.selectLineEnd = function() {
|
||||||
|
|
@ -354,8 +344,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectFileEnd()
|
*
|
||||||
*
|
|
||||||
* Moves the selection to the end of the file.
|
* Moves the selection to the end of the file.
|
||||||
**/
|
**/
|
||||||
this.selectFileEnd = function() {
|
this.selectFileEnd = function() {
|
||||||
|
|
@ -363,8 +352,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectFileStart()
|
*
|
||||||
*
|
|
||||||
* Moves the selection to the start of the file.
|
* Moves the selection to the start of the file.
|
||||||
**/
|
**/
|
||||||
this.selectFileStart = function() {
|
this.selectFileStart = function() {
|
||||||
|
|
@ -372,8 +360,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectWordRight()
|
*
|
||||||
*
|
|
||||||
* Moves the selection to the first word on the right.
|
* Moves the selection to the first word on the right.
|
||||||
**/
|
**/
|
||||||
this.selectWordRight = function() {
|
this.selectWordRight = function() {
|
||||||
|
|
@ -381,18 +368,16 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectWordLeft()
|
*
|
||||||
*
|
|
||||||
* Moves the selection to the first word on the left.
|
* Moves the selection to the first word on the left.
|
||||||
**/
|
**/
|
||||||
this.selectWordLeft = function() {
|
this.selectWordLeft = function() {
|
||||||
this.$moveSelection(this.moveCursorWordLeft);
|
this.$moveSelection(this.moveCursorWordLeft);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: EditSession.getWordRange
|
/**
|
||||||
* Selection.selectWord()
|
|
||||||
*
|
|
||||||
* Moves the selection to highlight the entire word.
|
* Moves the selection to highlight the entire word.
|
||||||
|
* @related EditSession.getWordRange
|
||||||
**/
|
**/
|
||||||
this.getWordRange = function(row, column) {
|
this.getWordRange = function(row, column) {
|
||||||
if (typeof column == "undefined") {
|
if (typeof column == "undefined") {
|
||||||
|
|
@ -402,15 +387,18 @@ var Selection = function(session) {
|
||||||
}
|
}
|
||||||
return this.session.getWordRange(row, column);
|
return this.session.getWordRange(row, column);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Selects an entire word boundary.
|
||||||
|
**/
|
||||||
this.selectWord = function() {
|
this.selectWord = function() {
|
||||||
this.setSelectionRange(this.getWordRange());
|
this.setSelectionRange(this.getWordRange());
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: EditSession.getAWordRange
|
/**
|
||||||
* Selection.selectAWord()
|
|
||||||
*
|
|
||||||
* Selects a word, including its right whitespace.
|
* Selects a word, including its right whitespace.
|
||||||
|
* @related EditSession.getAWordRange
|
||||||
**/
|
**/
|
||||||
this.selectAWord = function() {
|
this.selectAWord = function() {
|
||||||
var cursor = this.getCursor();
|
var cursor = this.getCursor();
|
||||||
|
|
@ -436,8 +424,6 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.selectLine()
|
|
||||||
*
|
|
||||||
* Selects the entire line.
|
* Selects the entire line.
|
||||||
**/
|
**/
|
||||||
this.selectLine = function() {
|
this.selectLine = function() {
|
||||||
|
|
@ -445,8 +431,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorUp()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor up one row.
|
* Moves the cursor up one row.
|
||||||
**/
|
**/
|
||||||
this.moveCursorUp = function() {
|
this.moveCursorUp = function() {
|
||||||
|
|
@ -454,8 +439,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorDown()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor down one row.
|
* Moves the cursor down one row.
|
||||||
**/
|
**/
|
||||||
this.moveCursorDown = function() {
|
this.moveCursorDown = function() {
|
||||||
|
|
@ -463,8 +447,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorLeft()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor left one column.
|
* Moves the cursor left one column.
|
||||||
**/
|
**/
|
||||||
this.moveCursorLeft = function() {
|
this.moveCursorLeft = function() {
|
||||||
|
|
@ -489,8 +472,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorRight()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor right one column.
|
* Moves the cursor right one column.
|
||||||
**/
|
**/
|
||||||
this.moveCursorRight = function() {
|
this.moveCursorRight = function() {
|
||||||
|
|
@ -515,8 +497,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorLineStart()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor to the start of the line.
|
* Moves the cursor to the start of the line.
|
||||||
**/
|
**/
|
||||||
this.moveCursorLineStart = function() {
|
this.moveCursorLineStart = function() {
|
||||||
|
|
@ -548,8 +529,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorLineEnd()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor to the end of the line.
|
* Moves the cursor to the end of the line.
|
||||||
**/
|
**/
|
||||||
this.moveCursorLineEnd = function() {
|
this.moveCursorLineEnd = function() {
|
||||||
|
|
@ -568,8 +548,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorFileEnd()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor to the end of the file.
|
* Moves the cursor to the end of the file.
|
||||||
**/
|
**/
|
||||||
this.moveCursorFileEnd = function() {
|
this.moveCursorFileEnd = function() {
|
||||||
|
|
@ -579,8 +558,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorFileStart()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor to the start of the file.
|
* Moves the cursor to the start of the file.
|
||||||
**/
|
**/
|
||||||
this.moveCursorFileStart = function() {
|
this.moveCursorFileStart = function() {
|
||||||
|
|
@ -588,8 +566,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorLongWordRight()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor to the word on the right.
|
* Moves the cursor to the word on the right.
|
||||||
**/
|
**/
|
||||||
this.moveCursorLongWordRight = function() {
|
this.moveCursorLongWordRight = function() {
|
||||||
|
|
@ -635,8 +612,7 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorLongWordLeft()
|
*
|
||||||
*
|
|
||||||
* Moves the cursor to the word on the left.
|
* Moves the cursor to the word on the left.
|
||||||
**/
|
**/
|
||||||
this.moveCursorLongWordLeft = function() {
|
this.moveCursorLongWordLeft = function() {
|
||||||
|
|
@ -788,12 +764,13 @@ var Selection = function(session) {
|
||||||
this.moveCursorShortWordLeft();
|
this.moveCursorShortWordLeft();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: EditSession.documentToScreenPosition
|
/**
|
||||||
* Selection.moveCursorBy(rows, chars)
|
* Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.
|
||||||
* - rows (Number): The number of rows to move by
|
* @param {Number} rows The number of rows to move by
|
||||||
* - chars (Number): The number of characters to move by
|
* @param {Number} chars The number of characters to move by
|
||||||
*
|
*
|
||||||
* Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.
|
*
|
||||||
|
* @related EditSession.documentToScreenPosition
|
||||||
**/
|
**/
|
||||||
this.moveCursorBy = function(rows, chars) {
|
this.moveCursorBy = function(rows, chars) {
|
||||||
var screenPos = this.session.documentToScreenPosition(
|
var screenPos = this.session.documentToScreenPosition(
|
||||||
|
|
@ -815,22 +792,22 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorToPosition(position)
|
|
||||||
* - 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`.
|
||||||
|
* @param {Object} position The position to move to
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
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)
|
|
||||||
* - row (Number): The row to move to
|
|
||||||
* - column (Number): The column to move to
|
|
||||||
* - 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}
|
||||||
|
* @param {Number} row The row to move to
|
||||||
|
* @param {Number} column The column to move to
|
||||||
|
* @param {Boolean} keepDesiredColumn [If `true`, the cursor move does not respect the previous column]{: #preventUpdateBool}
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
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.
|
||||||
|
|
@ -849,12 +826,12 @@ var Selection = function(session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection.moveCursorToScreen(row, column, keepDesiredColumn)
|
|
||||||
* - row (Number): The row to move to
|
|
||||||
* - column (Number): The column to move to
|
|
||||||
* - 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}
|
||||||
|
* @param {Number} row The row to move to
|
||||||
|
* @param {Number} column The column to move to
|
||||||
|
* @param {Boolean} keepDesiredColumn {:preventUpdateBool}
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
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);
|
||||||
|
|
|
||||||
109
lib/ace/split.js
109
lib/ace/split.js
|
|
@ -39,22 +39,13 @@ var Editor = require("./editor").Editor;
|
||||||
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
||||||
var EditSession = require("./edit_session").EditSession;
|
var EditSession = require("./edit_session").EditSession;
|
||||||
|
|
||||||
/** internal, hide
|
/**
|
||||||
* class Split
|
* @class Split
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/** internal, hide
|
|
||||||
* new Split(container, theme, splits)
|
|
||||||
* - container (Document): The document to associate with the split
|
|
||||||
* - theme (String): The name of the initial theme
|
|
||||||
* - splits (Number): The number of initial splits
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
|
|
||||||
var Split = function(container, theme, splits) {
|
var Split = function(container, theme, splits) {
|
||||||
this.BELOW = 1;
|
this.BELOW = 1;
|
||||||
|
|
@ -96,13 +87,6 @@ var Split = function(container, theme, splits) {
|
||||||
return editor;
|
return editor;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** internal, hide
|
|
||||||
* Split.setSplits(splits) -> Void
|
|
||||||
* - splits (Number): The new number of splits
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
this.setSplits = function(splits) {
|
this.setSplits = function(splits) {
|
||||||
var editor;
|
var editor;
|
||||||
if (splits < 1) {
|
if (splits < 1) {
|
||||||
|
|
@ -133,18 +117,16 @@ var Split = function(container, theme, splits) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split.getSplits() -> Number
|
*
|
||||||
*
|
|
||||||
* Returns the number of splits.
|
* Returns the number of splits.
|
||||||
*
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getSplits = function() {
|
this.getSplits = function() {
|
||||||
return this.$splits;
|
return this.$splits;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split.getEditor(idx) -> Editor
|
* @param {Number} idx The index of the editor you want
|
||||||
* -idx (Number): The index of the editor you want
|
|
||||||
*
|
*
|
||||||
* Returns the editor identified by the index `idx`.
|
* Returns the editor identified by the index `idx`.
|
||||||
*
|
*
|
||||||
|
|
@ -154,40 +136,36 @@ var Split = function(container, theme, splits) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split.getCurrentEditor() -> Editor
|
*
|
||||||
*
|
|
||||||
* Returns the current editor.
|
* Returns the current editor.
|
||||||
*
|
* @returns {Editor}
|
||||||
**/
|
**/
|
||||||
this.getCurrentEditor = function() {
|
this.getCurrentEditor = function() {
|
||||||
return this.$cEditor;
|
return this.$cEditor;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Editor.focus
|
/**
|
||||||
* Split.focus() -> Void
|
|
||||||
*
|
|
||||||
* Focuses the current editor.
|
* Focuses the current editor.
|
||||||
*
|
* @related Editor.focus
|
||||||
**/
|
**/
|
||||||
this.focus = function() {
|
this.focus = function() {
|
||||||
this.$cEditor.focus();
|
this.$cEditor.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Editor.blur
|
/**
|
||||||
* Split.blur() -> Void
|
|
||||||
*
|
|
||||||
* Blurs the current editor.
|
* Blurs the current editor.
|
||||||
*
|
* @related Editor.blur
|
||||||
**/
|
**/
|
||||||
this.blur = function() {
|
this.blur = function() {
|
||||||
this.$cEditor.blur();
|
this.$cEditor.blur();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Editor.setTheme
|
/**
|
||||||
* Split.setTheme(theme) -> Void
|
*
|
||||||
* - theme (String): The name of the theme to set
|
* @param {String} theme The name of the theme to set
|
||||||
*
|
*
|
||||||
* Sets a theme for each of the available editors.
|
* Sets a theme for each of the available editors.
|
||||||
|
* @related Editor.setTheme
|
||||||
**/
|
**/
|
||||||
this.setTheme = function(theme) {
|
this.setTheme = function(theme) {
|
||||||
this.$editors.forEach(function(editor) {
|
this.$editors.forEach(function(editor) {
|
||||||
|
|
@ -195,11 +173,12 @@ var Split = function(container, theme, splits) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** internal, hide
|
/**
|
||||||
* Split.setKeyboardHandler(keybinding) -> Void
|
|
||||||
* - keybinding (String):
|
|
||||||
*
|
*
|
||||||
*
|
* @param {String} keybinding
|
||||||
|
*
|
||||||
|
* Sets the keyboard handler for the editor.
|
||||||
|
* @related editor.setKeyboardHandler
|
||||||
**/
|
**/
|
||||||
this.setKeyboardHandler = function(keybinding) {
|
this.setKeyboardHandler = function(keybinding) {
|
||||||
this.$editors.forEach(function(editor) {
|
this.$editors.forEach(function(editor) {
|
||||||
|
|
@ -207,10 +186,10 @@ var Split = function(container, theme, splits) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** internal, hide
|
/**
|
||||||
* Split.forEach(callback, scope) -> Void
|
*
|
||||||
* - callback (Function): A callback function to execute
|
* @param {Function} callback A callback function to execute
|
||||||
* - scope (String):
|
* @param {String} scope The default scope for the callback
|
||||||
*
|
*
|
||||||
* Executes `callback` on all of the available editors.
|
* Executes `callback` on all of the available editors.
|
||||||
*
|
*
|
||||||
|
|
@ -219,14 +198,14 @@ var Split = function(container, theme, splits) {
|
||||||
this.$editors.forEach(callback, scope);
|
this.$editors.forEach(callback, scope);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Editor.setFontSize
|
|
||||||
* Split.setFontSize(size) -> Void
|
this.$fontSize = "";
|
||||||
* - size (Number): The new font size
|
/**
|
||||||
|
* @param {Number} size The new font size
|
||||||
*
|
*
|
||||||
* Sets the font size, in pixels, for all the available editors.
|
* Sets the font size, in pixels, for all the available editors.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.$fontSize = "";
|
|
||||||
this.setFontSize = function(size) {
|
this.setFontSize = function(size) {
|
||||||
this.$fontSize = size;
|
this.$fontSize = size;
|
||||||
this.forEach(function(editor) {
|
this.forEach(function(editor) {
|
||||||
|
|
@ -261,13 +240,13 @@ var Split = function(container, theme, splits) {
|
||||||
return s;
|
return s;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Editor.setSession
|
/**
|
||||||
* Split.setSession(session, idx) -> Void
|
*
|
||||||
* - session (EditSession): The new edit session
|
* @param {EditSession} session The new edit session
|
||||||
* - idx (Number): The editor's index you're interested in
|
* @param {Number} idx The editor's index you're interested in
|
||||||
*
|
*
|
||||||
* Sets a new [[EditSession `EditSession`]] for the indicated editor.
|
* Sets a new [[EditSession `EditSession`]] for the indicated editor.
|
||||||
*
|
* @related Editor.setSession
|
||||||
**/
|
**/
|
||||||
this.setSession = function(session, idx) {
|
this.setSession = function(session, idx) {
|
||||||
var editor;
|
var editor;
|
||||||
|
|
@ -295,19 +274,18 @@ var Split = function(container, theme, splits) {
|
||||||
return session;
|
return session;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** internal, hide
|
/**
|
||||||
* Split.getOrientation() -> Number
|
|
||||||
*
|
*
|
||||||
* Returns the orientation.
|
* Returns the orientation.
|
||||||
*
|
* @returns Number
|
||||||
**/
|
**/
|
||||||
this.getOrientation = function() {
|
this.getOrientation = function() {
|
||||||
return this.$orientation;
|
return this.$orientation;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** internal, hide
|
/**
|
||||||
* Split.setOrientation(oriantation) -> Void
|
*
|
||||||
* - oriantation (Number):
|
* @param {Number} orientation The new orientation value
|
||||||
*
|
*
|
||||||
* Sets the orientation.
|
* Sets the orientation.
|
||||||
*
|
*
|
||||||
|
|
@ -320,11 +298,11 @@ var Split = function(container, theme, splits) {
|
||||||
this.resize();
|
this.resize();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** internal
|
/**
|
||||||
* Split.resize() -> Void
|
* Split.resize() -> Void
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
* Resizes the editor.
|
||||||
**/
|
**/
|
||||||
this.resize = function() {
|
this.resize = function() {
|
||||||
var width = this.$container.clientWidth;
|
var width = this.$container.clientWidth;
|
||||||
|
|
@ -356,12 +334,7 @@ var Split = function(container, theme, splits) {
|
||||||
|
|
||||||
}).call(Split.prototype);
|
}).call(Split.prototype);
|
||||||
|
|
||||||
/** internal
|
|
||||||
* Split.UndoManagerProxy() -> Void
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
function UndoManagerProxy(undoManager, session) {
|
function UndoManagerProxy(undoManager, session) {
|
||||||
this.$u = undoManager;
|
this.$u = undoManager;
|
||||||
this.$doc = session;
|
this.$doc = session;
|
||||||
|
|
|
||||||
|
|
@ -32,20 +32,19 @@ define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class TokenIterator
|
*
|
||||||
*
|
*
|
||||||
* This class provides an essay way to treat the document as a stream of tokens, and provides methods to iterate over these tokens.
|
* This class provides an essay way to treat the document as a stream of tokens, and provides methods to iterate over these tokens.
|
||||||
*
|
* @class TokenIterator
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new TokenIterator(session, initialRow, initialColumn)
|
|
||||||
* - session (EditSession): The session to associate with
|
|
||||||
* - initialRow (Number): The row to start the tokenizing at
|
|
||||||
* - initialColumn (Number): The column to start the tokenizing at
|
|
||||||
*
|
|
||||||
* Creates a new token iterator object. The inital token index is set to the provided row and column coordinates.
|
* Creates a new token iterator object. The inital token index is set to the provided row and column coordinates.
|
||||||
|
* @param {EditSession} session The session to associate with
|
||||||
|
* @param {Number} initialRow The row to start the tokenizing at
|
||||||
|
* @param {Number} initialColumn The column to start the tokenizing at
|
||||||
*
|
*
|
||||||
|
* @constructor
|
||||||
**/
|
**/
|
||||||
var TokenIterator = function(session, initialRow, initialColumn) {
|
var TokenIterator = function(session, initialRow, initialColumn) {
|
||||||
this.$session = session;
|
this.$session = session;
|
||||||
|
|
@ -59,10 +58,9 @@ var TokenIterator = function(session, initialRow, initialColumn) {
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* Tokenizes all the items from the current point to the row prior in the document.
|
||||||
|
* @returns [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.
|
||||||
**/
|
**/
|
||||||
this.stepBackward = function() {
|
this.stepBackward = function() {
|
||||||
this.$tokenIndex -= 1;
|
this.$tokenIndex -= 1;
|
||||||
|
|
@ -82,9 +80,9 @@ var TokenIterator = function(session, initialRow, initialColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* 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.
|
||||||
|
* @returns {String}
|
||||||
**/
|
**/
|
||||||
this.stepForward = function() {
|
this.stepForward = function() {
|
||||||
var rowCount = this.$session.getLength();
|
var rowCount = this.$session.getLength();
|
||||||
|
|
@ -105,30 +103,27 @@ var TokenIterator = function(session, initialRow, initialColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TokenIterator.getCurrentToken() -> String
|
|
||||||
*
|
*
|
||||||
* Returns the current tokenized string.
|
* Returns the current tokenized string.
|
||||||
*
|
* @returns {String}
|
||||||
**/
|
**/
|
||||||
this.getCurrentToken = function () {
|
this.getCurrentToken = function () {
|
||||||
return this.$rowTokens[this.$tokenIndex];
|
return this.$rowTokens[this.$tokenIndex];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TokenIterator.getCurrentTokenRow() -> Number
|
|
||||||
*
|
*
|
||||||
* Returns the current row.
|
* Returns the current row.
|
||||||
*
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getCurrentTokenRow = function () {
|
this.getCurrentTokenRow = function () {
|
||||||
return this.$row;
|
return this.$row;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TokenIterator.getCurrentTokenColumn() -> Number
|
|
||||||
*
|
*
|
||||||
* Returns the current column.
|
* Returns the current column.
|
||||||
*
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getCurrentTokenColumn = function() {
|
this.getCurrentTokenColumn = function() {
|
||||||
var rowTokens = this.$rowTokens;
|
var rowTokens = this.$rowTokens;
|
||||||
|
|
|
||||||
|
|
@ -32,19 +32,21 @@ define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class Tokenizer
|
*
|
||||||
*
|
*
|
||||||
* This class takes a set of highlighting rules, and creates a tokenizer out of them. For more information, see [the wiki on extending highlighters](https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode#wiki-extendingTheHighlighter).
|
* This class takes a set of highlighting rules, and creates a tokenizer out of them. For more information, see [the wiki on extending highlighters](https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode#wiki-extendingTheHighlighter).
|
||||||
*
|
* @class Tokenizer
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new Tokenizer(rules, flag)
|
|
||||||
* - rules (Object): The highlighting rules
|
|
||||||
* - flag (String): Any additional regular expression flags to pass (like "i" for case insensitive)
|
|
||||||
*
|
|
||||||
* Constructs a new tokenizer based on the given rules and flags.
|
* Constructs a new tokenizer based on the given rules and flags.
|
||||||
|
* @param {Object} rules The highlighting rules
|
||||||
|
* @param {String} flag Any additional regular expression flags to pass (like "i" for case insensitive)
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
**/
|
**/
|
||||||
var Tokenizer = function(rules, flag) {
|
var Tokenizer = function(rules, flag) {
|
||||||
flag = flag ? "g" + flag : "g";
|
flag = flag ? "g" + flag : "g";
|
||||||
|
|
@ -92,9 +94,8 @@ var Tokenizer = function(rules, flag) {
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tokenizer.getLineTokens() -> Object
|
|
||||||
*
|
|
||||||
* Returns an object containing two properties: `tokens`, which contains all the tokens; and `state`, the current state.
|
* Returns an object containing two properties: `tokens`, which contains all the tokens; and `state`, the current state.
|
||||||
|
* @returns {Object}
|
||||||
**/
|
**/
|
||||||
this.getLineTokens = function(line, startState) {
|
this.getLineTokens = function(line, startState) {
|
||||||
var currentState = startState || "start";
|
var currentState = startState || "start";
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,18 @@ define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class UndoManager
|
*
|
||||||
*
|
*
|
||||||
* This object maintains the undo stack for an [[EditSession `EditSession`]].
|
* This object maintains the undo stack for an [[EditSession `EditSession`]].
|
||||||
*
|
* @class UndoManager
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new UndoManager()
|
*
|
||||||
*
|
*
|
||||||
* Resets the current undo state and creates a new `UndoManager`.
|
* Resets the current undo state and creates a new `UndoManager`.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
**/
|
**/
|
||||||
var UndoManager = function() {
|
var UndoManager = function() {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
@ -50,13 +52,12 @@ var UndoManager = function() {
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UndoManager.execute(options) -> Void
|
|
||||||
* - options (Object): Contains additional properties
|
|
||||||
*
|
|
||||||
* Provides a means for implementing your own undo manager. `options` has one property, `args`, an [[Array `Array`]], with two elements:
|
* Provides a means for implementing your own undo manager. `options` has one property, `args`, an [[Array `Array`]], with two elements:
|
||||||
*
|
*
|
||||||
* * `args[0]` is an array of deltas
|
* - `args[0]` is an array of deltas
|
||||||
* * `args[1]` is the document to associate with
|
* - `args[1]` is the document to associate with
|
||||||
|
*
|
||||||
|
* @param {Object} options Contains additional properties
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.execute = function(options) {
|
this.execute = function(options) {
|
||||||
|
|
@ -67,10 +68,11 @@ var UndoManager = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UndoManager.undo(dontSelect) -> Range
|
* [Perform an undo operation on the document, reverting the last change.]{: #UndoManager.undo}
|
||||||
* - dontSelect (Boolean): {:dontSelect}
|
* @param {Boolean} dontSelect {:dontSelect}
|
||||||
*
|
*
|
||||||
* [Perform an undo operation on the document, reverting the last change. Returns the range of the undo.]{: #UndoManager.undo}
|
*
|
||||||
|
* @returns {Range} The range of the undo.
|
||||||
**/
|
**/
|
||||||
this.undo = function(dontSelect) {
|
this.undo = function(dontSelect) {
|
||||||
var deltas = this.$undoStack.pop();
|
var deltas = this.$undoStack.pop();
|
||||||
|
|
@ -84,10 +86,10 @@ var UndoManager = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UndoManager.redo(dontSelect) -> Void
|
|
||||||
* - dontSelect (Boolean): {:dontSelect}
|
|
||||||
*
|
|
||||||
* [Perform a redo operation on the document, reimplementing the last change.]{: #UndoManager.redo}
|
* [Perform a redo operation on the document, reimplementing the last change.]{: #UndoManager.redo}
|
||||||
|
* @param {Boolean} dontSelect {:dontSelect}
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.redo = function(dontSelect) {
|
this.redo = function(dontSelect) {
|
||||||
var deltas = this.$redoStack.pop();
|
var deltas = this.$redoStack.pop();
|
||||||
|
|
@ -101,8 +103,7 @@ var UndoManager = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UndoManager.reset() -> Void
|
*
|
||||||
*
|
|
||||||
* Destroys the stack of undo and redo redo operations.
|
* Destroys the stack of undo and redo redo operations.
|
||||||
**/
|
**/
|
||||||
this.reset = function() {
|
this.reset = function() {
|
||||||
|
|
@ -111,18 +112,18 @@ var UndoManager = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UndoManager.hasUndo() -> Boolean
|
*
|
||||||
*
|
|
||||||
* Returns `true` if there are undo operations left to perform.
|
* Returns `true` if there are undo operations left to perform.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.hasUndo = function() {
|
this.hasUndo = function() {
|
||||||
return this.$undoStack.length > 0;
|
return this.$undoStack.length > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UndoManager.hasRedo() -> Boolean
|
*
|
||||||
*
|
|
||||||
* Returns `true` if there are redo operations left to perform.
|
* Returns `true` if there are redo operations left to perform.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.hasRedo = function() {
|
this.hasRedo = function() {
|
||||||
return this.$redoStack.length > 0;
|
return this.$redoStack.length > 0;
|
||||||
|
|
|
||||||
|
|
@ -49,19 +49,21 @@ var editorCss = require("./requirejs/text!./css/editor.css");
|
||||||
dom.importCssString(editorCss, "ace_editor");
|
dom.importCssString(editorCss, "ace_editor");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class VirtualRenderer
|
*
|
||||||
*
|
*
|
||||||
* The class that is responsible for drawing everything you see on the screen!
|
* The class that is responsible for drawing everything you see on the screen!
|
||||||
*
|
* @class VirtualRenderer
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new VirtualRenderer(container, theme)
|
|
||||||
* - container (DOMElement): The root element of the editor
|
|
||||||
* - theme (String): The starting theme
|
|
||||||
*
|
|
||||||
* Constructs a new `VirtualRenderer` within the `container` specified, applying the given `theme`.
|
* Constructs a new `VirtualRenderer` within the `container` specified, applying the given `theme`.
|
||||||
|
* @param {DOMElement} container The root element of the editor
|
||||||
|
* @param {String} theme The starting theme
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
**/
|
**/
|
||||||
|
|
||||||
var VirtualRenderer = function(container, theme) {
|
var VirtualRenderer = function(container, theme) {
|
||||||
|
|
@ -196,9 +198,8 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setSession(session)
|
|
||||||
*
|
*
|
||||||
* Associates an [[EditSession `EditSession`]].
|
* Associates the renderer with an [[EditSession `EditSession`]].
|
||||||
**/
|
**/
|
||||||
this.setSession = function(session) {
|
this.setSession = function(session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
|
|
@ -215,11 +216,11 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.updateLines(firstRow, lastRow)
|
|
||||||
* - firstRow (Number): The first row to update
|
|
||||||
* - lastRow (Number): The last row to update
|
|
||||||
*
|
|
||||||
* Triggers a partial update of the text, from the range given by the two parameters.
|
* Triggers a partial update of the text, from the range given by the two parameters.
|
||||||
|
* @param {Number} firstRow The first row to update
|
||||||
|
* @param {Number} lastRow The last row to update
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.updateLines = function(firstRow, lastRow) {
|
this.updateLines = function(firstRow, lastRow) {
|
||||||
if (lastRow === undefined)
|
if (lastRow === undefined)
|
||||||
|
|
@ -248,8 +249,6 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.updateText()
|
|
||||||
*
|
|
||||||
* Triggers a full update of the text, for all the rows.
|
* Triggers a full update of the text, for all the rows.
|
||||||
**/
|
**/
|
||||||
this.updateText = function() {
|
this.updateText = function() {
|
||||||
|
|
@ -257,10 +256,10 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.updateFull(force)
|
|
||||||
* - force (Boolean): If `true`, forces the changes through
|
|
||||||
*
|
|
||||||
* Triggers a full update of all the layers, for all the rows.
|
* Triggers a full update of all the layers, for all the rows.
|
||||||
|
* @param {Boolean} force If `true`, forces the changes through
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.updateFull = function(force) {
|
this.updateFull = function(force) {
|
||||||
if (force){
|
if (force){
|
||||||
|
|
@ -272,8 +271,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.updateFontSize()
|
*
|
||||||
*
|
|
||||||
* Updates the font size.
|
* Updates the font size.
|
||||||
**/
|
**/
|
||||||
this.updateFontSize = function() {
|
this.updateFontSize = function() {
|
||||||
|
|
@ -281,13 +279,13 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.onResize(force, gutterWidth, width, height)
|
|
||||||
* - force (Boolean): If `true`, recomputes the size, even if the height and width haven't changed
|
|
||||||
* - gutterWidth (Number): The width of the gutter in pixels
|
|
||||||
* - width (Number): The width of the editor in pixels
|
|
||||||
* - height (Number): The hiehgt of the editor, in pixels
|
|
||||||
*
|
|
||||||
* [Triggers a resize of the editor.]{: #VirtualRenderer.onResize}
|
* [Triggers a resize of the editor.]{: #VirtualRenderer.onResize}
|
||||||
|
* @param {Boolean} force If `true`, recomputes the size, even if the height and width haven't changed
|
||||||
|
* @param {Number} gutterWidth The width of the gutter in pixels
|
||||||
|
* @param {Number} width The width of the editor in pixels
|
||||||
|
* @param {Number} height The hiehgt of the editor, in pixels
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.onResize = function(force, gutterWidth, width, height) {
|
this.onResize = function(force, gutterWidth, width, height) {
|
||||||
var changes = this.CHANGE_SIZE;
|
var changes = this.CHANGE_SIZE;
|
||||||
|
|
@ -339,8 +337,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.adjustWrapLimit()
|
*
|
||||||
*
|
|
||||||
* Adjusts the wrap limit, which is the number of characters that can fit within the width of the edit area on screen.
|
* Adjusts the wrap limit, which is the number of characters that can fit within the width of the edit area on screen.
|
||||||
**/
|
**/
|
||||||
this.adjustWrapLimit = function() {
|
this.adjustWrapLimit = function() {
|
||||||
|
|
@ -350,10 +347,10 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setAnimatedScroll(shouldAnimate)
|
|
||||||
* - shouldAnimate (Boolean): Set to `true` to show animated scrolls
|
|
||||||
*
|
|
||||||
* Identifies whether you want to have an animated scroll or not.
|
* Identifies whether you want to have an animated scroll or not.
|
||||||
|
* @param {Boolean} shouldAnimate Set to `true` to show animated scrolls
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setAnimatedScroll = function(shouldAnimate){
|
this.setAnimatedScroll = function(shouldAnimate){
|
||||||
|
|
@ -361,19 +358,19 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getAnimatedScroll() -> Boolean
|
*
|
||||||
*
|
|
||||||
* Returns whether an animated scroll happens or not.
|
* Returns whether an animated scroll happens or not.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.getAnimatedScroll = function() {
|
this.getAnimatedScroll = function() {
|
||||||
return this.$animatedScroll;
|
return this.$animatedScroll;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setShowInvisibles(showInvisibles)
|
|
||||||
* - showInvisibles (Boolean): Set to `true` to show invisibles
|
|
||||||
*
|
|
||||||
* Identifies whether you want to show invisible characters or not.
|
* Identifies whether you want to show invisible characters or not.
|
||||||
|
* @param {Boolean} showInvisibles Set to `true` to show invisibles
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setShowInvisibles = function(showInvisibles) {
|
this.setShowInvisibles = function(showInvisibles) {
|
||||||
|
|
@ -382,9 +379,9 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getShowInvisibles() -> Boolean
|
*
|
||||||
*
|
|
||||||
* Returns whether invisible characters are being shown or not.
|
* Returns whether invisible characters are being shown or not.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.getShowInvisibles = function() {
|
this.getShowInvisibles = function() {
|
||||||
return this.$textLayer.showInvisibles;
|
return this.$textLayer.showInvisibles;
|
||||||
|
|
@ -402,10 +399,10 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.$showPrintMargin = true;
|
this.$showPrintMargin = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setShowPrintMargin(showPrintMargin)
|
|
||||||
* - showPrintMargin (Boolean): Set to `true` to show the print margin
|
|
||||||
*
|
|
||||||
* Identifies whether you want to show the print margin or not.
|
* Identifies whether you want to show the print margin or not.
|
||||||
|
* @param {Boolean} showPrintMargin Set to `true` to show the print margin
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setShowPrintMargin = function(showPrintMargin) {
|
this.setShowPrintMargin = function(showPrintMargin) {
|
||||||
|
|
@ -414,9 +411,8 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getShowPrintMargin() -> Boolean
|
* Returns whether the print margin is being shown or not.
|
||||||
*
|
* @returns {Boolean}
|
||||||
* Returns whetherthe print margin is being shown or not.
|
|
||||||
**/
|
**/
|
||||||
this.getShowPrintMargin = function() {
|
this.getShowPrintMargin = function() {
|
||||||
return this.$showPrintMargin;
|
return this.$showPrintMargin;
|
||||||
|
|
@ -425,10 +421,10 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.$printMarginColumn = 80;
|
this.$printMarginColumn = 80;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setPrintMarginColumn(showPrintMargin)
|
|
||||||
* - showPrintMargin (Boolean): Set to `true` to show the print margin column
|
|
||||||
*
|
|
||||||
* Identifies whether you want to show the print margin column or not.
|
* Identifies whether you want to show the print margin column or not.
|
||||||
|
* @param {Boolean} showPrintMargin Set to `true` to show the print margin column
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setPrintMarginColumn = function(showPrintMargin) {
|
this.setPrintMarginColumn = function(showPrintMargin) {
|
||||||
|
|
@ -437,28 +433,28 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getPrintMarginColumn() -> Boolean
|
*
|
||||||
*
|
|
||||||
* Returns whether the print margin column is being shown or not.
|
* Returns whether the print margin column is being shown or not.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.getPrintMarginColumn = function() {
|
this.getPrintMarginColumn = function() {
|
||||||
return this.$printMarginColumn;
|
return this.$printMarginColumn;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getShowGutter() -> Boolean
|
*
|
||||||
*
|
|
||||||
* Returns `true` if the gutter is being shown.
|
* Returns `true` if the gutter is being shown.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.getShowGutter = function(){
|
this.getShowGutter = function(){
|
||||||
return this.showGutter;
|
return this.showGutter;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setShowGutter(show)
|
|
||||||
* - show (Boolean): Set to `true` to show the gutter
|
|
||||||
*
|
|
||||||
* Identifies whether you want to show the gutter or not.
|
* Identifies whether you want to show the gutter or not.
|
||||||
|
* @param {Boolean} show Set to `true` to show the gutter
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.setShowGutter = function(show){
|
this.setShowGutter = function(show){
|
||||||
if(this.showGutter === show)
|
if(this.showGutter === show)
|
||||||
|
|
@ -526,27 +522,27 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getContainerElement() -> DOMElement
|
*
|
||||||
*
|
|
||||||
* Returns the root element containing this renderer.
|
* Returns the root element containing this renderer.
|
||||||
|
* @returns {DOMElement}
|
||||||
**/
|
**/
|
||||||
this.getContainerElement = function() {
|
this.getContainerElement = function() {
|
||||||
return this.container;
|
return this.container;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getMouseEventTarget() -> DOMElement
|
*
|
||||||
*
|
|
||||||
* Returns the element that the mouse events are attached to
|
* Returns the element that the mouse events are attached to
|
||||||
|
* @returns {DOMElement}
|
||||||
**/
|
**/
|
||||||
this.getMouseEventTarget = function() {
|
this.getMouseEventTarget = function() {
|
||||||
return this.content;
|
return this.content;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getTextAreaContainer() -> DOMElement
|
*
|
||||||
*
|
|
||||||
* Returns the element to which the hidden text area is added.
|
* Returns the element to which the hidden text area is added.
|
||||||
|
* @returns {DOMElement}
|
||||||
**/
|
**/
|
||||||
this.getTextAreaContainer = function() {
|
this.getTextAreaContainer = function() {
|
||||||
return this.container;
|
return this.container;
|
||||||
|
|
@ -582,27 +578,27 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getFirstVisibleRow() -> Number
|
*
|
||||||
*
|
|
||||||
* [Returns the index of the first visible row.]{: #VirtualRenderer.getFirstVisibleRow}
|
* [Returns the index of the first visible row.]{: #VirtualRenderer.getFirstVisibleRow}
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getFirstVisibleRow = function() {
|
this.getFirstVisibleRow = function() {
|
||||||
return this.layerConfig.firstRow;
|
return this.layerConfig.firstRow;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getFirstFullyVisibleRow() -> Number
|
*
|
||||||
*
|
|
||||||
* Returns the index of the first fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.
|
* Returns the index of the first fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getFirstFullyVisibleRow = function() {
|
this.getFirstFullyVisibleRow = function() {
|
||||||
return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
|
return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getLastFullyVisibleRow() -> Number
|
*
|
||||||
*
|
|
||||||
* Returns the index of the last fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.
|
* Returns the index of the last fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getLastFullyVisibleRow = function() {
|
this.getLastFullyVisibleRow = function() {
|
||||||
var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
|
var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
|
||||||
|
|
@ -610,9 +606,9 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getLastVisibleRow() -> Number
|
*
|
||||||
*
|
|
||||||
* [Returns the index of the last visible row.]{: #VirtualRenderer.getLastVisibleRow}
|
* [Returns the index of the last visible row.]{: #VirtualRenderer.getLastVisibleRow}
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getLastVisibleRow = function() {
|
this.getLastVisibleRow = function() {
|
||||||
return this.layerConfig.lastRow;
|
return this.layerConfig.lastRow;
|
||||||
|
|
@ -621,10 +617,10 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.$padding = null;
|
this.$padding = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setPadding(padding)
|
|
||||||
* - padding (Number): A new padding value (in pixels)
|
|
||||||
*
|
|
||||||
* Sets the padding for all the layers.
|
* Sets the padding for all the layers.
|
||||||
|
* @param {Number} padding A new padding value (in pixels)
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setPadding = function(padding) {
|
this.setPadding = function(padding) {
|
||||||
|
|
@ -638,19 +634,19 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getHScrollBarAlwaysVisible() -> Boolean
|
*
|
||||||
*
|
|
||||||
* Returns whether the horizontal scrollbar is set to be always visible.
|
* Returns whether the horizontal scrollbar is set to be always visible.
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.getHScrollBarAlwaysVisible = function() {
|
this.getHScrollBarAlwaysVisible = function() {
|
||||||
return this.$horizScrollAlwaysVisible;
|
return this.$horizScrollAlwaysVisible;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setHScrollBarAlwaysVisible(alwaysVisible)
|
|
||||||
* - alwaysVisible (Boolean): Set to `true` to make the horizontal scroll bar visible
|
|
||||||
*
|
|
||||||
* Identifies whether you want to show the horizontal scrollbar or not.
|
* Identifies whether you want to show the horizontal scrollbar or not.
|
||||||
|
* @param {Boolean} alwaysVisible Set to `true` to make the horizontal scroll bar visible
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
|
this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
|
||||||
if (this.$horizScrollAlwaysVisible != alwaysVisible) {
|
if (this.$horizScrollAlwaysVisible != alwaysVisible) {
|
||||||
|
|
@ -862,8 +858,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.updateFrontMarkers()
|
*
|
||||||
*
|
|
||||||
* Schedules an update to all the front markers in the document.
|
* Schedules an update to all the front markers in the document.
|
||||||
**/
|
**/
|
||||||
this.updateFrontMarkers = function() {
|
this.updateFrontMarkers = function() {
|
||||||
|
|
@ -872,8 +867,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.updateBackMarkers()
|
*
|
||||||
*
|
|
||||||
* Schedules an update to all the back markers in the document.
|
* Schedules an update to all the back markers in the document.
|
||||||
**/
|
**/
|
||||||
this.updateBackMarkers = function() {
|
this.updateBackMarkers = function() {
|
||||||
|
|
@ -881,27 +875,25 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.$loop.schedule(this.CHANGE_MARKER_BACK);
|
this.$loop.schedule(this.CHANGE_MARKER_BACK);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** deprecated
|
/**
|
||||||
* VirtualRenderer.addGutterDecoration(row, className)
|
*
|
||||||
*
|
|
||||||
* Deprecated; (moved to [[EditSession]])
|
* Deprecated; (moved to [[EditSession]])
|
||||||
|
* @deprecated
|
||||||
**/
|
**/
|
||||||
this.addGutterDecoration = function(row, className){
|
this.addGutterDecoration = function(row, className){
|
||||||
this.$gutterLayer.addGutterDecoration(row, className);
|
this.$gutterLayer.addGutterDecoration(row, className);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** deprecated
|
/**
|
||||||
* VirtualRenderer.removeGutterDecoration(row, className)-> Void
|
|
||||||
*
|
|
||||||
* Deprecated; (moved to [[EditSession]])
|
* Deprecated; (moved to [[EditSession]])
|
||||||
|
* @deprecated
|
||||||
**/
|
**/
|
||||||
this.removeGutterDecoration = function(row, className){
|
this.removeGutterDecoration = function(row, className){
|
||||||
this.$gutterLayer.removeGutterDecoration(row, className);
|
this.$gutterLayer.removeGutterDecoration(row, className);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.updateBreakpoints()
|
*
|
||||||
*
|
|
||||||
* Redraw breakpoints.
|
* Redraw breakpoints.
|
||||||
**/
|
**/
|
||||||
this.updateBreakpoints = function(rows) {
|
this.updateBreakpoints = function(rows) {
|
||||||
|
|
@ -909,10 +901,11 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setAnnotations(annotations)
|
*
|
||||||
* - annotations (Array): An array containing annotations
|
|
||||||
*
|
|
||||||
* Sets annotations for the gutter.
|
* Sets annotations for the gutter.
|
||||||
|
* @param {Array} annotations An array containing annotations
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.setAnnotations = function(annotations) {
|
this.setAnnotations = function(annotations) {
|
||||||
this.$gutterLayer.setAnnotations(annotations);
|
this.$gutterLayer.setAnnotations(annotations);
|
||||||
|
|
@ -920,8 +913,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.updateCursor()
|
*
|
||||||
*
|
|
||||||
* Updates the cursor icon.
|
* Updates the cursor icon.
|
||||||
**/
|
**/
|
||||||
this.updateCursor = function() {
|
this.updateCursor = function() {
|
||||||
|
|
@ -929,8 +921,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.hideCursor()
|
*
|
||||||
*
|
|
||||||
* Hides the cursor icon.
|
* Hides the cursor icon.
|
||||||
**/
|
**/
|
||||||
this.hideCursor = function() {
|
this.hideCursor = function() {
|
||||||
|
|
@ -938,8 +929,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.showCursor()
|
*
|
||||||
*
|
|
||||||
* Shows the cursor icon.
|
* Shows the cursor icon.
|
||||||
**/
|
**/
|
||||||
this.showCursor = function() {
|
this.showCursor = function() {
|
||||||
|
|
@ -953,8 +943,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.scrollCursorIntoView(cursor, offset)
|
*
|
||||||
*
|
|
||||||
* Scrolls the cursor into the first visibile area of the editor
|
* Scrolls the cursor into the first visibile area of the editor
|
||||||
**/
|
**/
|
||||||
this.scrollCursorIntoView = function(cursor, offset) {
|
this.scrollCursorIntoView = function(cursor, offset) {
|
||||||
|
|
@ -988,47 +977,48 @@ var VirtualRenderer = function(container, theme) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: EditSession.getScrollTop
|
/**
|
||||||
* VirtualRenderer.getScrollTop() -> Number
|
|
||||||
*
|
|
||||||
* {:EditSession.getScrollTop}
|
* {:EditSession.getScrollTop}
|
||||||
|
* @related EditSession.getScrollTop
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getScrollTop = function() {
|
this.getScrollTop = function() {
|
||||||
return this.session.getScrollTop();
|
return this.session.getScrollTop();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: EditSession.getScrollLeft
|
/**
|
||||||
* VirtualRenderer.getScrollLeft() -> Number
|
|
||||||
*
|
|
||||||
* {:EditSession.getScrollLeft}
|
* {:EditSession.getScrollLeft}
|
||||||
|
* @related EditSession.getScrollLeft
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getScrollLeft = function() {
|
this.getScrollLeft = function() {
|
||||||
return this.session.getScrollLeft();
|
return this.session.getScrollLeft();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getScrollTopRow() -> Number
|
*
|
||||||
*
|
|
||||||
* Returns the first visible row, regardless of whether it's fully visible or not.
|
* Returns the first visible row, regardless of whether it's fully visible or not.
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getScrollTopRow = function() {
|
this.getScrollTopRow = function() {
|
||||||
return this.scrollTop / this.lineHeight;
|
return this.scrollTop / this.lineHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getScrollBottomRow() -> Number
|
*
|
||||||
*
|
|
||||||
* Returns the last visible row, regardless of whether it's fully visible or not.
|
* Returns the last visible row, regardless of whether it's fully visible or not.
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.getScrollBottomRow = function() {
|
this.getScrollBottomRow = function() {
|
||||||
return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
|
return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: EditSession.setScrollTop
|
/**
|
||||||
* VirtualRenderer.scrollToRow(row)
|
* Gracefully scrolls from the top of the editor to the row indicated.
|
||||||
* - row (Number): A row id
|
* @param {Number} row A row id
|
||||||
*
|
*
|
||||||
* Gracefully scrolls the top of the editor to the row indicated.
|
*
|
||||||
|
* @related EditSession.setScrollTop
|
||||||
**/
|
**/
|
||||||
this.scrollToRow = function(row) {
|
this.scrollToRow = function(row) {
|
||||||
this.session.setScrollTop(row * this.lineHeight);
|
this.session.setScrollTop(row * this.lineHeight);
|
||||||
|
|
@ -1063,13 +1053,13 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.scrollToLine(line, center, animate, callback)
|
|
||||||
* - line (Number): A line number
|
|
||||||
* - center (Boolean): If `true`, centers the editor the to indicated line
|
|
||||||
* - animate (Boolean): If `true` animates scrolling
|
|
||||||
* - callback (Function): Function to be called after the animation has finished
|
|
||||||
*
|
|
||||||
* Gracefully scrolls the editor to the row indicated.
|
* Gracefully scrolls the editor to the row indicated.
|
||||||
|
* @param {Number} line A line number
|
||||||
|
* @param {Boolean} center If `true`, centers the editor the to indicated line
|
||||||
|
* @param {Boolean} animate If `true` animates scrolling
|
||||||
|
* @param {Function} callback Function to be called after the animation has finished
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.scrollToLine = function(line, center, animate, callback) {
|
this.scrollToLine = function(line, center, animate, callback) {
|
||||||
var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
|
var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
|
||||||
|
|
@ -1113,11 +1103,11 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.scrollToY(scrollTop) -> Number
|
|
||||||
* - scrollTop (Number): The position to scroll to
|
|
||||||
*
|
|
||||||
* Scrolls the editor to the y pixel indicated.
|
* Scrolls the editor to the y pixel indicated.
|
||||||
|
* @param {Number} scrollTop The position to scroll to
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.scrollToY = function(scrollTop) {
|
this.scrollToY = function(scrollTop) {
|
||||||
// after calling scrollBar.setScrollTop
|
// after calling scrollBar.setScrollTop
|
||||||
|
|
@ -1129,11 +1119,11 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.scrollToX(scrollLeft) -> Number
|
* Scrolls the editor across the x-axis to the pixel indicated.
|
||||||
* - scrollLeft (Number): The position to scroll to
|
* @param {Number} scrollLeft The position to scroll to
|
||||||
*
|
|
||||||
* Scrolls the editor to the x pixel indicated.
|
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @returns {Number}
|
||||||
**/
|
**/
|
||||||
this.scrollToX = function(scrollLeft) {
|
this.scrollToX = function(scrollLeft) {
|
||||||
if (scrollLeft < 0)
|
if (scrollLeft < 0)
|
||||||
|
|
@ -1145,11 +1135,11 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.scrollBy(deltaX, deltaY)
|
|
||||||
* - deltaX (Number): The x value to scroll by
|
|
||||||
* - deltaY (Number): The y value to scroll by
|
|
||||||
*
|
|
||||||
* Scrolls the editor across both x- and y-axes.
|
* Scrolls the editor across both x- and y-axes.
|
||||||
|
* @param {Number} deltaX The x value to scroll by
|
||||||
|
* @param {Number} deltaY The y value to scroll by
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.scrollBy = function(deltaX, deltaY) {
|
this.scrollBy = function(deltaX, deltaY) {
|
||||||
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
|
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
|
||||||
|
|
@ -1157,11 +1147,12 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.isScrollableBy(deltaX, deltaY) -> Boolean
|
|
||||||
* - deltaX (Number): The x value to scroll by
|
|
||||||
* - deltaY (Number): The y value to scroll by
|
|
||||||
*
|
|
||||||
* Returns `true` if you can still scroll by either parameter; in other words, you haven't reached the end of the file or line.
|
* Returns `true` if you can still scroll by either parameter; in other words, you haven't reached the end of the file or line.
|
||||||
|
* @param {Number} deltaX The x value to scroll by
|
||||||
|
* @param {Number} deltaY The y value to scroll by
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @returns {Boolean}
|
||||||
**/
|
**/
|
||||||
this.isScrollableBy = function(deltaX, deltaY) {
|
this.isScrollableBy = function(deltaX, deltaY) {
|
||||||
if (deltaY < 0 && this.session.getScrollTop() > 0)
|
if (deltaY < 0 && this.session.getScrollTop() > 0)
|
||||||
|
|
@ -1195,13 +1186,13 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.textToScreenCoordinates(row, column) -> Object
|
|
||||||
* - row (Number): The document row position
|
|
||||||
* - column (Number): The document column position
|
|
||||||
*
|
|
||||||
* Returns an object containing the `pageX` and `pageY` coordinates of the document position.
|
* Returns an object containing the `pageX` and `pageY` coordinates of the document position.
|
||||||
|
* @param {Number} row The document row position
|
||||||
|
* @param {Number} column The document column position
|
||||||
*
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
|
* @returns {Object}
|
||||||
**/
|
**/
|
||||||
this.textToScreenCoordinates = function(row, column) {
|
this.textToScreenCoordinates = function(row, column) {
|
||||||
var canvasPos = this.scroller.getBoundingClientRect();
|
var canvasPos = this.scroller.getBoundingClientRect();
|
||||||
|
|
@ -1217,8 +1208,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.visualizeFocus()
|
*
|
||||||
*
|
|
||||||
* Focuses the current container.
|
* Focuses the current container.
|
||||||
**/
|
**/
|
||||||
this.visualizeFocus = function() {
|
this.visualizeFocus = function() {
|
||||||
|
|
@ -1226,18 +1216,17 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.visualizeBlur()
|
*
|
||||||
*
|
|
||||||
* Blurs the current container.
|
* Blurs the current container.
|
||||||
**/
|
**/
|
||||||
this.visualizeBlur = function() {
|
this.visualizeBlur = function() {
|
||||||
dom.removeCssClass(this.container, "ace_focus");
|
dom.removeCssClass(this.container, "ace_focus");
|
||||||
};
|
};
|
||||||
|
|
||||||
/** internal, hide
|
/**
|
||||||
* VirtualRenderer.showComposition(position)
|
* @param {Number} position
|
||||||
* - position (Number):
|
|
||||||
*
|
*
|
||||||
|
* @private
|
||||||
**/
|
**/
|
||||||
this.showComposition = function(position) {
|
this.showComposition = function(position) {
|
||||||
if (!this.$composition)
|
if (!this.$composition)
|
||||||
|
|
@ -1253,8 +1242,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setCompositionText(text)
|
* @param {String} text A string of text to use
|
||||||
* - text (String): A string of text to use
|
|
||||||
*
|
*
|
||||||
* Sets the inner text of the current composition to `text`.
|
* Sets the inner text of the current composition to `text`.
|
||||||
**/
|
**/
|
||||||
|
|
@ -1263,8 +1251,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.hideComposition()
|
*
|
||||||
*
|
|
||||||
* Hides the current composition.
|
* Hides the current composition.
|
||||||
**/
|
**/
|
||||||
this.hideComposition = function() {
|
this.hideComposition = function() {
|
||||||
|
|
@ -1285,10 +1272,10 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setTheme(theme)
|
|
||||||
* - theme (String): The path to a theme
|
|
||||||
*
|
|
||||||
* [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme}
|
* [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme}
|
||||||
|
* @param {String} theme The path to a theme
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.setTheme = function(theme) {
|
this.setTheme = function(theme) {
|
||||||
var _self = this;
|
var _self = this;
|
||||||
|
|
@ -1346,9 +1333,8 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.getTheme() -> String
|
|
||||||
*
|
|
||||||
* [Returns the path of the current theme.]{: #VirtualRenderer.getTheme}
|
* [Returns the path of the current theme.]{: #VirtualRenderer.getTheme}
|
||||||
|
* @returns {String}
|
||||||
**/
|
**/
|
||||||
this.getTheme = function() {
|
this.getTheme = function() {
|
||||||
return this.$themeValue;
|
return this.$themeValue;
|
||||||
|
|
@ -1359,28 +1345,27 @@ var VirtualRenderer = function(container, theme) {
|
||||||
// a certain mode that editor is in.
|
// a certain mode that editor is in.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.setStyle(style)
|
|
||||||
* - style (String): A class name
|
|
||||||
*
|
|
||||||
* [Adds a new class, `style`, to the editor.]{: #VirtualRenderer.setStyle}
|
* [Adds a new class, `style`, to the editor.]{: #VirtualRenderer.setStyle}
|
||||||
|
* @param {String} style A class name
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.setStyle = function setStyle(style, include) {
|
this.setStyle = function setStyle(style, include) {
|
||||||
dom.setCssClass(this.container, style, include != false);
|
dom.setCssClass(this.container, style, include != false);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.unsetStyle(style)
|
|
||||||
* - style (String): A class name
|
|
||||||
*
|
|
||||||
* [Removes the class `style` from the editor.]{: #VirtualRenderer.unsetStyle}
|
* [Removes the class `style` from the editor.]{: #VirtualRenderer.unsetStyle}
|
||||||
|
* @param {String} style A class name
|
||||||
|
*
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
this.unsetStyle = function unsetStyle(style) {
|
this.unsetStyle = function unsetStyle(style) {
|
||||||
dom.removeCssClass(this.container, style);
|
dom.removeCssClass(this.container, style);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VirtualRenderer.destroy()
|
*
|
||||||
*
|
|
||||||
* Destroys the text and cursor layers for this renderer.
|
* Destroys the text and cursor layers for this renderer.
|
||||||
**/
|
**/
|
||||||
this.destroy = function() {
|
this.destroy = function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue