a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,unknownElems:!!a.getElementsByTagName("nav").length,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",enctype:!!c.createElement("form").enctype,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.lastChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-999px",top:"-999px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;f(function(){var a,b,d,e,g,h,i=1,j="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",l="visibility:hidden;border:0;",n="style='"+j+"border:5px solid #000;padding:0;'",p="
")
+ if (html.match(warningORegex))
+ -html = html.replace(warningORegex, "
")
+
+ if (html.match(noteCRegex))
+ -html = html.replace(noteCRegex, "
")
+ if (html.match(warningCRegex))
+ -html = html.replace(warningCRegex, "
")
+
+ != html
+
+mixin formatGHHref(url, type)
+ url = url.substring(url.indexOf("src/") + 4)
+
+ if type == 'nodejs_ref_guide'
+ url = url.substring(0, url.lastIndexOf("#"))
+ url = 'src/' + url
+ else if type == 'nodejs_dev_guide'
+ url = 'src/' + url
+
+ -url = url.replace(/\/{2,}/g, "/").replace(/\//g,"%2F")
+ [edit]
+
+mixin makeVersionLabel(fullPath, showText)
+ -if (fullPath.indexOf("latest") >= 0)
+ -if (!showText)
+ != '0.6.9'
+ else
+ != 'latest'
+ -else
+ != fullPath.match(/\d\.\d\.\d/)
\ No newline at end of file
diff --git a/doc/resources/landing/layout.jade b/doc/resources/landing/layout.jade
new file mode 100644
index 00000000..3aa2f566
--- /dev/null
+++ b/doc/resources/landing/layout.jade
@@ -0,0 +1,34 @@
+include ../common_layout
+
+mixin identifyBuild('','')
+
+mixin doctype
+
+mixin head('Ace API Reference')
+
+body(onload="styleCode()")
+
+ mixin topBar(whoAmI)
+
+ mixin header
+
+ .container
+ .content
+ .row.container
+ .span5.offset4.sidebarContainer
+ #sidebar
+
+ .span11
+ div.title
+ h1.pageTitle #{title}
+
+ .dev_guide#content
+ mixin markdown(data)
+
+ div#disqus_thread
+
+ mixin footer
+
+ mixin endingScripts
+
+
diff --git a/lib/ace/ace.js b/lib/ace/ace.js
index a33e4240..3e4d85d9 100644
--- a/lib/ace/ace.js
+++ b/lib/ace/ace.js
@@ -35,6 +35,14 @@
*
* ***** END LICENSE BLOCK ***** */
+/**
+ * class Ace
+ *
+ * TODO
+ *
+ *
+ **/
+
define(function(require, exports, module) {
"use strict";
@@ -48,6 +56,13 @@ var EditSession = require("./edit_session").EditSession;
var UndoManager = require("./undomanager").UndoManager;
var Renderer = require("./virtual_renderer").VirtualRenderer;
+ /**
+ * Ace.edit(el) -> Editor
+ * - el (String | Element): Either the id of an element to edit, or the element itself
+ *
+ * Edits an element. TODO.
+ *
+ **/
exports.edit = function(el) {
if (typeof(el) == "string") {
el = document.getElementById(el);
@@ -74,4 +89,4 @@ exports.edit = function(el) {
return editor;
};
-});
\ No newline at end of file
+});
diff --git a/lib/ace/anchor.js b/lib/ace/anchor.js
index 8b13e3be..2f54fdf5 100644
--- a/lib/ace/anchor.js
+++ b/lib/ace/anchor.js
@@ -42,9 +42,22 @@ var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
/**
- * An Anchor is a floating pointer in the document. Whenever text is inserted or
- * deleted before the cursor, the position of the cursor is updated
- */
+ * class Anchor
+ *
+ * Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
+ *
+ **/
+
+/**
+ * new Anchor(doc, row, column)
+ * - doc (Document): The document to associate with the anchor
+ * - row (Number): The starting row position
+ * - column (Number): The starting column position
+ *
+ * Creates a new `Anchor` and associates it with a document.
+ *
+ **/
+
var Anchor = exports.Anchor = function(doc, row, column) {
this.document = doc;
@@ -61,14 +74,36 @@ var Anchor = exports.Anchor = function(doc, row, column) {
oop.implement(this, EventEmitter);
+ /**
+ * Anchor.getPosition() -> Object
+ *
+ * Returns an object identifying the `row` and `column` position of the current anchor.
+ *
+ **/
+
this.getPosition = function() {
return this.$clipPositionToDocument(this.row, this.column);
};
-
+
+ /**
+ * Anchor.getDocument() -> Document
+ *
+ * Returns the current document.
+ *
+ **/
+
this.getDocument = function() {
return this.document;
};
+ /**
+ * Anchor@onChange(e)
+ * - e (Event): TODO
+ *
+ * Fires whenever the anchor position changes.
+ *
+ **/
+
this.onChange = function(e) {
var delta = e.data;
var range = delta.range;
@@ -134,6 +169,16 @@ var Anchor = exports.Anchor = function(doc, row, column) {
this.setPosition(row, column, true);
};
+ /**
+ * Anchor.setPosition(row, column, noClip) -> Void
+ * - row (Number): The row index to move the anchor to
+ * - column (Number): The column index to move the anchor to
+ * - noClip (Boolean): 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.
+ *
+ **/
+
this.setPosition = function(row, column, noClip) {
var pos;
if (noClip) {
@@ -162,10 +207,26 @@ var Anchor = exports.Anchor = function(doc, row, column) {
});
};
+ /**
+ * Anchor.detach()
+ *
+ * When called, the `'change'` event listener is removed.
+ *
+ **/
+
this.detach = function() {
this.document.removeEventListener("change", this.$onChange);
};
+ /**
+ * Anchor.clipPositionToDocument(row, column) -> Void
+ * - row (Number): The row index to clip the anchor to
+ * - column (Number): The column index to clip the anchor to
+ *
+ * Clips the anchor position to the specified row and column. TODO
+ *
+ **/
+
this.$clipPositionToDocument = function(row, column) {
var pos = {};
diff --git a/lib/ace/background_tokenizer.js b/lib/ace/background_tokenizer.js
index 0cfe7941..8dfa11c9 100644
--- a/lib/ace/background_tokenizer.js
+++ b/lib/ace/background_tokenizer.js
@@ -41,6 +41,24 @@ define(function(require, exports, module) {
var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
+/**
+ * class Background_Tokenizer
+ *
+ * Tokenizes items..in the background? TODO
+ *
+ *
+ **/
+
+/**
+ * new Background_Tokenizer(tokenizer, editor)
+ * - tokenizer (Tokenizer): The tokenizer to use
+ * - editor (Editor): The editor to associate with
+ *
+ * Creates a new `BackgroundTokenizer` object.
+ *
+ *
+ **/
+
var BackgroundTokenizer = function(tokenizer, editor) {
this.running = false;
this.lines = [];
@@ -82,6 +100,14 @@ var BackgroundTokenizer = function(tokenizer, editor) {
oop.implement(this, EventEmitter);
+ /**
+ * Background_Tokenizer.setTokenizer(tokenizer) -> Void
+ * - tokenizer (Tokenizier): The new tokenizer to use
+ *
+ * Sets a new tokenizer for this object.
+ *
+ **/
+
this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer;
this.lines = [];
@@ -89,6 +115,14 @@ var BackgroundTokenizer = function(tokenizer, editor) {
this.start(0);
};
+ /**
+ * Background_Tokenizer.setDocument(doc) -> Void
+ * - doc (Document): The new document to associate with
+ *
+ * Sets a new document to associate with this object.
+ *
+ **/
+
this.setDocument = function(doc) {
this.doc = doc;
this.lines = [];
@@ -96,6 +130,15 @@ var BackgroundTokenizer = function(tokenizer, editor) {
this.stop();
};
+ /**
+ * Background_Tokenizer.fireUpdateEvent(firstRow, lastRow) -> Void
+ * - firstRow (Number): The starting row region
+ * - lastRow (Number): 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) {
var data = {
first: firstRow,
@@ -104,6 +147,15 @@ var BackgroundTokenizer = function(tokenizer, editor) {
this._emit("update", {data: data});
};
+ /**
+ * Background_Tokenizer.start(startRow, lastRow) -> Void
+ * - startRow (Number): The row to start at
+ * - lastRow (Number): The row to finish at
+ *
+ * Starts tokenizing at the row indicated. TODO
+ *
+ **/
+
this.start = function(startRow) {
this.currentLine = Math.min(startRow || 0, this.currentLine,
this.doc.getLength());
@@ -116,20 +168,56 @@ var BackgroundTokenizer = function(tokenizer, editor) {
this.running = setTimeout(this.$worker, 700);
};
+ /**
+ * Background_Tokenizer.stop() -> Void
+ *
+ * Stops tokenizing.
+ *
+ **/
+
this.stop = function() {
if (this.running)
clearTimeout(this.running);
this.running = false;
};
+ /** related to: BackgroundTokenizer.$tokenizeRows
+ * Background_Tokenizer.getTokens(firstRow, lastRow) -> Array
+ * - firstRow (Number): The row to start at
+ * - lastRow (Number): The row to finish at
+ *
+ * Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
+ *
+ **/
+
this.getTokens = function(firstRow, lastRow) {
return this.$tokenizeRows(firstRow, lastRow);
};
+ /** related to: BackgroundTokenizer.$tokenizeRows
+ * Background_Tokenizer.getState(row) -> Array
+ * - row (Number): The row to start at
+ *
+ * Retrieves the state of tokenization for a row. Returns the tokenized row.
+ *
+ **/
+
this.getState = function(row) {
return this.$tokenizeRows(row, row)[0].state;
};
+ /**
+ * Background_Tokenizer.$tokenizeRows(firstRow, lastRow) -> Array
+ * - startRow (Number): The row to start at
+ * - lastRow (Number): The row to finish at
+ *
+ * Tokenizes all the rows within the specified region.
+ *
+ * #### Returns
+ *
+ * Returns a list of the tokenized rows. Each item in the list is an object with two properties, `state` and `start`.
+ *
+ **/
this.$tokenizeRows = function(firstRow, lastRow) {
if (!this.doc || isNaN(firstRow) || isNaN(lastRow))
return [{'state':'start','tokens':[]}];
diff --git a/lib/ace/document.js b/lib/ace/document.js
index ee0ce11f..93488c29 100644
--- a/lib/ace/document.js
+++ b/lib/ace/document.js
@@ -43,6 +43,21 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
var Range = require("./range").Range;
var Anchor = require("./anchor").Anchor;
+/**
+ * class Document
+ *
+ * Documentation about Document. Is this recursion? TODO
+ *
+ *
+ **/
+
+ /**
+ * new Document(text)
+ * - text (String | Array): The starting text
+ *
+ * Creates a new `Document`. TODO
+ *
+ **/
var Document = function(text) {
this.$lines = [];
@@ -62,20 +77,48 @@ var Document = function(text) {
oop.implement(this, EventEmitter);
- this.setValue = function(text) {
+ /**
+ * Document.setValue(text) -> Void
+ * - text (String): The value to set
+ *
+ *
+ **/
+ this.setValue = function(text) {
var len = this.getLength();
this.remove(new Range(0, 0, len, this.getLine(len-1).length));
this.insert({row: 0, column:0}, text);
};
- this.getValue = function() {
+ /**
+ * Document.getValue() -> String
+ *
+ * Returns all the lines in the document, split by the new line character.
+ **/
+ this.getValue = function() {
return this.getAllLines().join(this.getNewLineCharacter());
};
- this.createAnchor = function(row, column) {
+ /**
+ * Document.createAnchor(row, column) -> Anchor
+ *
+ *
+ **/
+ this.createAnchor = function(row, column) {
return new Anchor(this, row, column);
};
+ /**
+ * Document.$split(text) -> Array
+ * - text (String): The text to work with
+ *
+ * Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
+ *
+ * #### Returns
+ *
+ * A String array, with each index containing a piece of the original `text` string.
+ *
+ **/
+
// check for IE split bug
if ("aaa".split(/a/).length == 0)
this.$split = function(text) {
@@ -87,7 +130,12 @@ var Document = function(text) {
};
- this.$detectNewLine = function(text) {
+ /**
+ * Document.$detectNewLine(text) -> Void
+ *
+ *
+ **/
+ this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r\n|\r|\n)/m);
if (match) {
this.$autoNewLine = match[1];
@@ -96,7 +144,20 @@ var Document = function(text) {
}
};
- this.getNewLineCharacter = function() {
+ /**
+ * Document.getNewLineCharacter() -> String
+ *
+ * Returns the new line character that's being used, depending on the value of `newLineMode`.
+ *
+ * #### Returns
+ *
+ * If `newLineMode == windows`, `\r\n` is returned.
+ * If `newLineMode == unix`, `\n` is returned.
+ * If `newLineMode == auto`, the value of `autoNewLine` is returned.
+ *
+ *
+ **/
+ this.getNewLineCharacter = function() {
switch (this.$newLineMode) {
case "windows":
return "\r\n";
@@ -111,45 +172,88 @@ var Document = function(text) {
this.$autoNewLine = "\n";
this.$newLineMode = "auto";
- this.setNewLineMode = function(newLineMode) {
+ /**
+ * Document.setNewLineMode(newLineMode) -> Void
+ * - newLineMode(String): The newline mode to use; can be either `windows`, `unix`, or `auto`
+ *
+ * Sets the new line mode.
+ **/
+ this.setNewLineMode = function(newLineMode) {
if (this.$newLineMode === newLineMode)
return;
this.$newLineMode = newLineMode;
};
- this.getNewLineMode = function() {
+ /**
+ * Document.getNewLineMode() -> String
+ *
+ * Returns the type of newlines being used; either `windows`, `unix`, or `auto`
+ *
+ **/
+ this.getNewLineMode = function() {
return this.$newLineMode;
};
- this.isNewLine = function(text) {
+ /**
+ * Document.isNewLine(text) -> Boolean
+ * - text (String): The text to check
+ *
+ * Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
+ *
+ **/
+ this.isNewLine = function(text) {
return (text == "\r\n" || text == "\r" || text == "\n");
};
/**
- * Get a verbatim copy of the given line as it is in the document
- */
- this.getLine = function(row) {
+ * Document.getLine(row) -> String
+ * - row (Number): The row index to retrieve
+ *
+ * Returns a verbatim copy of the given line as it is in the document
+ *
+ **/
+ this.getLine = function(row) {
return this.$lines[row] || "";
};
- this.getLines = function(firstRow, lastRow) {
+ /**
+ * Document.getLines(firstRow, lastRow) -> Array
+ * - firstRow (Number): The first row index to retrieve
+ * - lastRow (Number): 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) {
return this.$lines.slice(firstRow, lastRow + 1);
};
/**
- * Returns all lines in the document as string array. Warning: The caller
- * should not modify this array!
- */
- this.getAllLines = function() {
+ * Document.getAllLines() -> Array
+ *
+ * Returns all lines in the document as string array. The caller should not modify this array!
+ **/
+ this.getAllLines = function() {
return this.getLines(0, this.getLength());
};
- this.getLength = function() {
+ /**
+ * Document.getLength() -> Number
+ *
+ * Returns the number of rows in the document.
+ **/
+ this.getLength = function() {
return this.$lines.length;
};
- this.getTextRange = function(range) {
+ /**
+ * Document.getTextRange(range) -> Array
+ * - range (String): blah
+ *
+ * TODO
+ **/
+ this.getTextRange = function(range) {
if (range.start.row == range.end.row) {
return this.$lines[range.start.row].substring(range.start.column,
range.end.column);
@@ -163,7 +267,13 @@ var Document = function(text) {
}
};
- this.$clipPosition = function(position) {
+ /**
+ * Document.$clipPosition(position) -> Number
+ * - position (Number): blah
+ *
+ * TODO
+ **/
+ this.$clipPosition = function(position) {
var length = this.getLength();
if (position.row >= length) {
position.row = Math.max(0, length - 1);
@@ -172,7 +282,19 @@ var Document = function(text) {
return position;
};
- this.insert = function(position, text) {
+ /**
+ * Document.insert(position, text) -> Number
+ * - position (Number): The position to start inserting at
+ * - text (String): A chunk of text to insert
+ *
+ * Inserts a block of `text` and the indicated `position`.
+ *
+ * #### Returns
+ *
+ * Returns the position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
+ *
+ **/
+ this.insert = function(position, text) {
if (text.length == 0)
return position;
@@ -194,7 +316,25 @@ var Document = function(text) {
return position;
};
- this.insertLines = function(row, lines) {
+ /**
+ * Document.insertLines(row, lines) -> Object
+ * - row (Number): The index of the row to insert at
+ * - lines (Array): An array of strings
+ *
+ * Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
+ *
+ * #### Returns
+ *
+ * Returns an object containing the final row and column, like this:
+ *
+ * {row: endRow, column: 0}
+ *
+ * If `lines` is empty, this function returns an object containing the current row, and column, like this:
+ *
+ * {row: row, column: 0}
+ *
+ **/
+ this.insertLines = function(row, lines) {
if (lines.length == 0)
return {row: row, column: 0};
@@ -212,7 +352,20 @@ var Document = function(text) {
return range.end;
};
- this.insertNewLine = function(position) {
+ /**
+ * Document.insertNewLine(position) -> Object
+ * - position (String): The position to insert at
+ *
+ * Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
+ *
+ * #### Returns
+ *
+ * Returns an object containing the final row and column, like this:
+ *
+ * {row: endRow, column: 0}
+ *
+ **/
+ this.insertNewLine = function(position) {
position = this.$clipPosition(position);
var line = this.$lines[position.row] || "";
@@ -234,7 +387,23 @@ var Document = function(text) {
return end;
};
- this.insertInLine = function(position, text) {
+ /**
+ * Document.insertInLine(position, text) -> Object | Integer
+ * - position (Number): The position to insert at
+ * - text (String): A chunk of text
+ *
+ * Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
+ *
+ * #### Returns
+ *
+ * Returns an object containing the final row and column, like this:
+ *
+ * {row: endRow, column: 0}
+ *
+ * If `text` is empty, this function returns the value of `position`.
+ *
+ **/
+ this.insertInLine = function(position, text) {
if (text.length == 0)
return position;
@@ -258,7 +427,17 @@ var Document = function(text) {
return end;
};
- this.remove = function(range) {
+ /**
+ * Document.remove(range) -> Object
+ * - range (Range): A specified Range to remove
+ *
+ * Removes the `range` from the document.
+ *
+ * #### Returns
+ *
+ * Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
+ **/
+ this.remove = function(range) {
// clip to document
range.start = this.$clipPosition(range.start);
range.end = this.$clipPosition(range.end);
@@ -290,7 +469,19 @@ var Document = function(text) {
return range.start;
};
- this.removeInLine = function(row, startColumn, endColumn) {
+ /**
+ * Document.removeInLine(row, startColumn, endColumn) -> Object | Void
+ * - row (Number): The row to remove from
+ * - startColumn (Number): The column to start removing at
+ * - endColumn (Number): The column to stop removing at
+ *
+ * Removes the specified columns from the `row`. This method also triggers the `'change'` event.
+ *
+ * #### Returns
+ *
+ * Returns an object containing `startRow` and `startColumn`, indicating the new row and column values. If `startColumn` is equal to `endColumn`, this function returns nothing.
+ **/
+ this.removeInLine = function(row, startColumn, endColumn) {
if (startColumn == endColumn)
return;
@@ -310,13 +501,19 @@ var Document = function(text) {
};
/**
- * Removes a range of full lines
- *
- * @param firstRow {Integer} The first row to be removed
- * @param lastRow {Integer} The last row to be removed
- * @return {String[]} The removed lines
- */
- this.removeLines = function(firstRow, lastRow) {
+ * Document.removeLines(firstRow, lastRow) -> Array
+ * - firstRow (Number): The first row to be removed
+ * - lastRow (Number): The last row to be removed
+ *
+ * Removes a range of full lines. This method also triggers the `'change'` event.
+ *
+ *
+ * #### Returns
+ *
+ * Returns all the removed lines.
+ *
+ **/
+ this.removeLines = function(firstRow, lastRow) {
var range = new Range(firstRow, 0, lastRow + 1, 0);
var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
@@ -330,7 +527,14 @@ var Document = function(text) {
return removed;
};
- this.removeNewLine = function(row) {
+ /**
+ * Document.removeNewLine(row) -> Void
+ * - row (Number): The row to be removed
+ *
+ * TODO Removes the row from the document. This method also triggers the `'change'` event.
+ *
+ **/
+ this.removeNewLine = function(row) {
var firstLine = this.getLine(row);
var secondLine = this.getLine(row+1);
@@ -347,7 +551,25 @@ var Document = function(text) {
this._emit("change", { data: delta });
};
- this.replace = function(range, text) {
+ /**
+ * Document.replace(range, text) -> Object
+ * - range (Range): A specified Range to replace
+ * - text (String): The new text to use as a replacement
+ *
+ * Replaces a range in the document with the new `text`.
+ *
+ * #### Returns
+ *
+ * Returns an object containing the final row and column, like this:
+ *
+ * {row: endRow, column: 0}
+ *
+ * If the text and range are empty, this function returns an object containing the current `range.start` value.
+ *
+ * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
+ *
+ **/
+ this.replace = function(range, text) {
if (text.length == 0 && range.isEmpty())
return range.start;
@@ -367,7 +589,12 @@ var Document = function(text) {
return end;
};
- this.applyDeltas = function(deltas) {
+ /**
+ * Document.applyDeltas(deltas) -> Void
+ *
+ * TODO
+ **/
+ this.applyDeltas = function(deltas) {
for (var i=0; i Void
+ *
+ * TODO
+ **/
+ this.revertDeltas = function(deltas) {
for (var i=deltas.length-1; i>=0; i--) {
var delta = deltas[i];
diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js
index 6aa21896..feb82194 100644
--- a/lib/ace/edit_session.js
+++ b/lib/ace/edit_session.js
@@ -50,6 +50,22 @@ var Range = require("./range").Range;
var Document = require("./document").Document;
var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer;
+/**
+ * class Edit_Session
+ *
+ * Some sessions stuff.
+ *
+ **/
+
+/**
+ * new Edit_Session(text, mode)
+ * - text (String): Some text
+ * - mode (Boolean): A boolean
+ *
+ * TODO
+ *
+ **/
+
var EditSession = function(text, mode) {
this.$modified = true;
this.$breakpoints = [];
@@ -86,7 +102,14 @@ var EditSession = function(text, mode) {
oop.implement(this, EventEmitter);
- this.setDocument = function(doc) {
+ /**
+ * Edit_Session.setDocument(doc) -> Void
+ * - doc (Document): Some text
+ *
+ * TODO Does some stuff.
+ *
+ **/
+ this.setDocument = function(doc) {
if (this.doc)
throw new Error("Document is already set");
@@ -100,11 +123,24 @@ var EditSession = function(text, mode) {
}
};
- this.getDocument = function() {
+ /**
+ * Edit_Session.getDocument() -> Document
+ *
+ * Returns the `Document` associated with this session.
+ *
+ **/
+ this.getDocument = function() {
return this.doc;
};
- this.$resetRowCache = function(row) {
+ /**
+ * Edit_Session.$resetRowCache(row) -> Void
+ * - row (Number): The row to work with
+ *
+ * TODO Does some stuff.
+ *
+ **/
+ this.$resetRowCache = function(row) {
if (row == 0) {
this.$rowCache = [];
return;
@@ -118,12 +154,24 @@ var EditSession = function(text, mode) {
}
};
- this.onChangeFold = function(e) {
+ /**
+ * Edit_Session@onChangeFold(e)
+ *
+ *
+ * This event triggers when code folds change their state. TODO
+ *
+ **/
+ this.onChangeFold = function(e) {
var fold = e.data;
this.$resetRowCache(fold.start.row);
};
- this.onChange = function(e) {
+ /**
+ * Edit_Session@onChange(e)
+ *
+ * This changes TODO
+ **/
+ this.onChange = function(e) {
var delta = e.data;
this.$modified = true;
@@ -146,7 +194,14 @@ var EditSession = function(text, mode) {
this._emit("change", e);
};
- this.setValue = function(text) {
+ /**
+ * Edit_Session.setValue(text) -> Void
+ * - text (String): The new text to place
+ *
+ * Sets the session text.
+ *
+ **/
+ this.setValue = function(text) {
this.doc.setValue(text);
this.selection.moveCursorTo(0, 0);
this.selection.clearSelection();
@@ -159,23 +214,56 @@ var EditSession = function(text, mode) {
};
this.getValue =
- this.toString = function() {
+ /**
+ * Edit_Session.toString() -> String
+ *
+ * Returns the current [[Document `Document`]] as a string.
+ *
+ **/
+ this.toString = function() {
return this.doc.getValue();
};
- this.getSelection = function() {
+ /**
+ * Edit_Session.getSelection() -> String
+ *
+ * Returns the string of the current selection.
+ **/
+ this.getSelection = function() {
return this.selection;
};
- this.getState = function(row) {
+ /** related to: BackgroundTokenizer.getState
+ * Edit_Session.getState(row) -> Array
+ * - row (Number): The row to start at
+ *
+ * Retrieves the state of tokenization for a row. Returns the tokenized row. TODO
+ *
+ **/
+ this.getState = function(row) {
return this.bgTokenizer.getState(row);
};
- this.getTokens = function(firstRow, lastRow) {
+ /** related to: BackgroundTokenizer.getTokens
+ * Edit_Session.getTokens(firstRow, lastRow) -> Array
+ * - firstRow (Number): The row to start at
+ * - lastRow (Number): The row to finish at
+ *
+ * Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
+ *
+ **/
+ this.getTokens = function(firstRow, lastRow) {
return this.bgTokenizer.getTokens(firstRow, lastRow);
};
- this.getTokenAt = function(row, column) {
+ /**
+ * Edit_Session.getTokenAt(row, column) -> Array
+ * - row (Number): The row number to retrieve from
+ * - column (Number): The column number to retrieve from
+ *
+ * Returns an array of tokens at the indicated row and column.
+ **/
+ this.getTokenAt = function(row, column) {
var tokens = this.bgTokenizer.getTokens(row, row)[0].tokens;
var token, c = 0;
if (column == null) {
@@ -196,7 +284,13 @@ var EditSession = function(text, mode) {
return token;
};
- this.setUndoManager = function(undoManager) {
+ /**
+ * Edit_Session.setUndoManager(undoManager) -> Void
+ * - undoManager (UndoManager): The new undo manager
+ *
+ * Sets the undo manager.
+ **/
+ this.setUndoManager = function(undoManager) {
this.$undoManager = undoManager;
this.$resetRowCache(0);
this.$deltas = [];
@@ -208,7 +302,12 @@ var EditSession = function(text, mode) {
if (undoManager) {
var self = this;
- this.$syncInformUndoManager = function() {
+ /**
+ * Edit_Session.$syncInformUndoManager() -> Void
+ *
+ * TODO
+ **/
+ this.$syncInformUndoManager = function() {
self.$informUndoManager.cancel();
if (self.$deltasFold.length) {
@@ -247,11 +346,21 @@ var EditSession = function(text, mode) {
reset: function() {}
};
- this.getUndoManager = function() {
+ /**
+ * Edit_Session.getUndoManager() -> UndoManager
+ *
+ * Returns the current undo manager.
+ **/
+ this.getUndoManager = function() {
return this.$undoManager || this.$defaultUndoManager;
},
- this.getTabString = function() {
+ /**
+ * Edit_Session.getTabString() -> String
+ *
+ * Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[getTabSize `getTabSize()`]]); otherwise it's simply `'\t'`.
+ **/
+ this.getTabString = function() {
if (this.getUseSoftTabs()) {
return lang.stringRepeat(" ", this.getTabSize());
} else {
@@ -260,18 +369,37 @@ var EditSession = function(text, mode) {
};
this.$useSoftTabs = true;
- this.setUseSoftTabs = function(useSoftTabs) {
+ /**
+ * Edit_Session.setUseSoftTabs(useSoftTabs) -> Void
+ * - useSoftTabs (Boolean): Value indicating whether or not to use soft tabs
+ *
+ * Pass `true` to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character (`'\t'`).
+ *
+ **/
+ this.setUseSoftTabs = function(useSoftTabs) {
if (this.$useSoftTabs === useSoftTabs) return;
this.$useSoftTabs = useSoftTabs;
};
- this.getUseSoftTabs = function() {
+ /**
+ * Edit_Session.getUseSoftTabs() -> Boolean
+ *
+ * Returns `true` if soft tabs are being used, `false` otherwise.
+ *
+ **/
+ this.getUseSoftTabs = function() {
return this.$useSoftTabs;
};
this.$tabSize = 4;
- this.setTabSize = function(tabSize) {
+ /**
+ * Edit_Session.setTabSize(tabSize) -> Void
+ * - tabSize (Number): The new tab size
+ *
+ * Set the number of spaces that define a soft tab; for example, passing in `4` transforms the soft tabs to be equivalent to four spaces. This function also emits the `changeTabSize` event.
+ **/
+ this.setTabSize = function(tabSize) {
if (isNaN(tabSize) || this.$tabSize === tabSize) return;
this.$modified = true;
@@ -279,35 +407,75 @@ var EditSession = function(text, mode) {
this._emit("changeTabSize");
};
- this.getTabSize = function() {
+ /**
+ * Edit_Session.getTabSize() -> Number
+ *
+ * Returns the current tab size.
+ **/
+ this.getTabSize = function() {
return this.$tabSize;
};
- this.isTabStop = function(position) {
+ /**
+ * Edit_Session.isTabStop(position) -> Boolean
+ * - position (Number): The position to check
+ *
+ * Returns `true` if the character at the position is a soft tab. TODO
+ **/
+ this.isTabStop = function(position) {
return this.$useSoftTabs && (position.column % this.$tabSize == 0);
};
this.$overwrite = false;
- this.setOverwrite = function(overwrite) {
+ /**
+ * Edit_Session.setOverwrite(overwrite) -> Void
+ * - overwrite (Boolean): Defines wheter or not to set overwrites
+ *
+ * Pass in `true` to enable overwrites in your session, or `false` to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event.
+ *
+ **/
+ this.setOverwrite = function(overwrite) {
if (this.$overwrite == overwrite) return;
this.$overwrite = overwrite;
this._emit("changeOverwrite");
};
- this.getOverwrite = function() {
+ /**
+ * Edit_Session.getOverwrite() -> Boolean
+ *
+ * Returns `true` if overwrites are enabled; `false` otherwise.
+ **/
+ this.getOverwrite = function() {
return this.$overwrite;
};
- this.toggleOverwrite = function() {
+ /**
+ * Edit_Session.toggleOverwrite() -> Void
+ *
+ * Sets the value of overwrite to the opposite of whatever it currently is.
+ **/
+ this.toggleOverwrite = function() {
this.setOverwrite(!this.$overwrite);
};
- this.getBreakpoints = function() {
+ /**
+ * Edit_Session.getBreakpoints() -> Array
+ *
+ * Returns an array of numbers, indicating which rows have breakpoints.
+ **/
+ this.getBreakpoints = function() {
return this.$breakpoints;
};
- this.setBreakpoints = function(rows) {
+ /**
+ * Edit_Session.setBreakpoints(rows) -> Void
+ * - rows (Array): An array of row indicies
+ *
+ * Sets a breakpoint on every row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
+ *
+ **/
+ this.setBreakpoints = function(rows) {
this.$breakpoints = [];
for (var i=0; i Void
+ *
+ * Removes all breakpoints on the rows. This function also emites the `'changeBreakpoint'` event.
+ **/
+ this.clearBreakpoints = function() {
this.$breakpoints = [];
this._emit("changeBreakpoint", {});
};
- this.setBreakpoint = function(row) {
+ /**
+ * Edit_Session.setBreakpoint(row) -> Void
+ * - row (Number): A row index
+ *
+ * Sets a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
+ **/
+ this.setBreakpoint = function(row) {
this.$breakpoints[row] = true;
this._emit("changeBreakpoint", {});
};
- this.clearBreakpoint = function(row) {
+ /**
+ * Edit_Session.clearBreakpoint(row) -> Void
+ * - row (Number): A row index
+ *
+ * Removes a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
+ **/
+ this.clearBreakpoint = function(row) {
delete this.$breakpoints[row];
this._emit("changeBreakpoint", {});
};
- this.getBreakpoints = function() {
- return this.$breakpoints;
- };
-
- this.addMarker = function(range, clazz, type, inFront) {
+ /**
+ * Edit_Session.addMarker(range, clazz, type, inFront) -> Number
+ * - range (Range):
+ * - clazz (String):
+ * - type (String):
+ * - inFront (Boolean):
+ *
+ * TODO
+ **/
+ this.addMarker = function(range, clazz, type, inFront) {
var id = this.$markerId++;
var marker = {
@@ -356,7 +546,14 @@ var EditSession = function(text, mode) {
return id;
};
- this.removeMarker = function(markerId) {
+ /**
+ * Edit_Session.removeMarker(markerId) -> Void
+ * - markerId (Number): A number representing a marker
+ *
+ * Removes the marker with the specified ID. If this marker was in front, the `'changeFrontMarker'` event is emitted. If the marker was in the back, the `'changeBackMarker'` event is emitted.
+ *
+ **/
+ this.removeMarker = function(markerId) {
var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
if (!marker)
return;
@@ -368,11 +565,18 @@ var EditSession = function(text, mode) {
}
};
- this.getMarkers = function(inFront) {
+ /**
+ * Edit_Session.getMarkers(inFront) -> Array
+ * - inFront (Boolean): If `true`, indicates you only want front markers; `false` indicates only back markers
+ *
+ * Returns an array containing the IDs of all the markers, either front or back.
+ *
+ **/
+ this.getMarkers = function(inFront) {
return inFront ? this.$frontMarkers : this.$backMarkers;
};
- /**
+ /*
* Error:
* {
* row: 12,
@@ -381,7 +585,13 @@ var EditSession = function(text, mode) {
* type: "error" // or "warning" or "info"
* }
*/
- this.setAnnotations = function(annotations) {
+ /**
+ * Edit_Session.setAnnotations(annotations) -> Void
+ * - annotations (Array):
+ *
+ * This functions emits the `'changeAnnotation'` event. TODO
+ **/
+ this.setAnnotations = function(annotations) {
this.$annotations = {};
for (var i=0; i Array
+ *
+ * TODO
+ **/
+ this.getAnnotations = function() {
return this.$annotations || {};
};
- this.clearAnnotations = function() {
+ /**
+ * Edit_Session.clearAnnotations() -> Void
+ *
+ * Clears all the annotations for this session. This function also triggers the `'changeAnnotation'` event.
+ **/
+ this.clearAnnotations = function() {
this.$annotations = {};
this._emit("changeAnnotation", {});
};
- this.$detectNewLine = function(text) {
+ /**
+ * Edit_Session.$detectNewLine(text) -> Void
+ * - text (String): A block of text
+ *
+ * If `text` contains either the newline (`\n`) or carriage-return ('\r') characters, [[autoNewLine `autoNewLine`]] stores that value. TODO
+ *
+ **/
+ this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r?\n)/m);
if (match) {
this.$autoNewLine = match[1];
@@ -412,7 +639,14 @@ var EditSession = function(text, mode) {
}
};
- this.getWordRange = function(row, column) {
+ /**
+ * Edit_Session.getWordRange(row, column) -> Range
+ * - row (Number): The row to check
+ * - column (Number): The column to check
+ *
+ * TODO
+ **/
+ this.getWordRange = function(row, column) {
var line = this.getLine(row);
var inToken = false;
@@ -443,8 +677,14 @@ var EditSession = function(text, mode) {
return new Range(row, start, row, end);
};
- // Gets the range of a word including its right whitespace
- this.getAWordRange = function(row, column) {
+ /**
+ * Edit_Session.getAWordRange(row, column) -> Range
+ * - row (Number): The row number to start from
+ * - column (Number): The column number to start from
+ *
+ * Gets the range of a word, including its right whitespace.
+ **/
+ this.getAWordRange = function(row, column) {
var wordRange = this.getWordRange(row, column);
var line = this.getLine(wordRange.end.row);
@@ -454,16 +694,32 @@ var EditSession = function(text, mode) {
return wordRange;
};
- this.setNewLineMode = function(newLineMode) {
+ /**
+ * Edit_Session.setNewLineMode(newLineMode) -> Void
+ * - newLineMode (String):
+ *
+ * TODO
+ **/
+ this.setNewLineMode = function(newLineMode) {
this.doc.setNewLineMode(newLineMode);
};
- this.getNewLineMode = function() {
+ /**
+ * Edit_Session.getNewLineMode() -> String
+ *
+ * TODO Returns the current new line mode.
+ **/
+ this.getNewLineMode = function() {
return this.doc.getNewLineMode();
};
this.$useWorker = true;
- this.setUseWorker = function(useWorker) {
+ /**
+ * Edit_Session.setUseWorker(useWorker) -> Void
+ *
+ * TODO
+ **/
+ this.setUseWorker = function(useWorker) {
if (this.$useWorker == useWorker)
return;
@@ -474,18 +730,33 @@ var EditSession = function(text, mode) {
this.$startWorker();
};
- this.getUseWorker = function() {
+ /**
+ * Edit_Session.getUseWorker() -> Boolean
+ *
+ * TODO
+ **/
+ this.getUseWorker = function() {
return this.$useWorker;
};
- this.onReloadTokenizer = function(e) {
+ /**
+ * Edit_Session@onReloadTokenizer(e) -> Void
+ *
+ * Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer.start ()`]] to all the rows; it also emits the `'tokenizerUpdate'` event.
+ **/
+ this.onReloadTokenizer = function(e) {
var rows = e.data;
this.bgTokenizer.start(rows.first);
this._emit("tokenizerUpdate", e);
};
this.$mode = null;
- this.setMode = function(mode) {
+ /**
+ * Edit_Session.setMode(mode) -> Void
+ *
+ * TODO
+ **/
+ this.setMode = function(mode) {
if (this.$mode === mode) return;
this.$mode = mode;
@@ -522,14 +793,14 @@ var EditSession = function(text, mode) {
this._emit("changeMode");
};
- this.$stopWorker = function() {
+ this.$stopWorker = function() {
if (this.$worker)
this.$worker.terminate();
this.$worker = null;
};
- this.$startWorker = function() {
+ this.$startWorker = function() {
if (typeof Worker !== "undefined" && !require.noWorker) {
try {
this.$worker = this.$mode.createWorker(this);
@@ -543,12 +814,22 @@ var EditSession = function(text, mode) {
this.$worker = null;
};
- this.getMode = function() {
+ /**
+ * Edit_Session.getMode() -> String
+ *
+ * TODO Returns the current mode.
+ **/
+ this.getMode = function() {
return this.$mode;
};
this.$scrollTop = 0;
- this.setScrollTop = function(scrollTop) {
+ /**
+ * Edit_Session.setScrollTop(scrollTop) -> Void
+ *
+ * This function also emits the `'changeScrollTop'` event. TODO
+ **/
+ this.setScrollTop = function(scrollTop) {
scrollTop = Math.round(Math.max(0, scrollTop));
if (this.$scrollTop === scrollTop)
return;
@@ -557,12 +838,22 @@ var EditSession = function(text, mode) {
this._emit("changeScrollTop", scrollTop);
};
- this.getScrollTop = function() {
+ /**
+ * Edit_Session.getScrollTop() -> Number
+ *
+ * [Returns the value of the distance between the top of the editor and the topmost part of the visible content.](~EditSession.getScrollTop)
+ **/
+ this.getScrollTop = function() {
return this.$scrollTop;
};
this.$scrollLeft = 0;
- this.setScrollLeft = function(scrollLeft) {
+ /**
+ * Edit_Session.setScrollLeft(scrollLeft) -> Void
+ *
+ * [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.](~EditSession.setScrollLeft)
+ **/
+ this.setScrollLeft = function(scrollLeft) {
scrollLeft = Math.round(Math.max(0, scrollLeft));
if (this.$scrollLeft === scrollLeft)
return;
@@ -571,21 +862,36 @@ var EditSession = function(text, mode) {
this._emit("changeScrollLeft", scrollLeft);
};
- this.getScrollLeft = function() {
+ /**
+ * Edit_Session.getScrollLeft() -> Number
+ *
+ * [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.](~EditSession.getScrollLeft)
+ **/
+ this.getScrollLeft = function() {
return this.$scrollLeft;
};
- this.getWidth = function() {
+ /**
+ * Edit_Session.getWidth() -> Number
+ *
+ * Returns the width of the document.
+ **/
+ this.getWidth = function() {
this.$computeWidth();
return this.width;
};
- this.getScreenWidth = function() {
+ /**
+ * Edit_Session.getScreenWidth() -> Number
+ *
+ * Returns the width of the screen.
+ **/
+ this.getScreenWidth = function() {
this.$computeWidth();
return this.screenWidth;
};
- this.$computeWidth = function(force) {
+ this.$computeWidth = function(force) {
if (this.$modified || force) {
this.$modified = false;
@@ -624,34 +930,86 @@ var EditSession = function(text, mode) {
}
};
- /**
- * Get a verbatim copy of the given line as it is in the document
- */
- this.getLine = function(row) {
+ /** related to: Document.getLine
+ * Edit_Session.getLine(row) -> String
+ * - row (Number): The row to retrieve from
+ *
+ * Returns a verbatim copy of the given line as it is in the document
+ *
+ **/
+ this.getLine = function(row) {
return this.doc.getLine(row);
};
- this.getLines = function(firstRow, lastRow) {
+ /** related to: Document.getLines
+ * Edit_Session.getLines(firstRow, lastRow) -> Array
+ * - firstRow (Number): The first row index to retrieve
+ * - lastRow (Number): 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) {
return this.doc.getLines(firstRow, lastRow);
};
- this.getLength = function() {
+ /** related to: Document.getLength
+ * Edit_Session.getLength()-> Number
+ *
+ * Returns the number of rows in the document.
+ **/
+ this.getLength = function() {
return this.doc.getLength();
};
- this.getTextRange = function(range) {
+ /** related to: Document.getTextRange
+ * Edit_Session.getTextRange(range) -> Array
+ * - range (String): blah
+ *
+ * TODO
+ **/
+ this.getTextRange = function(range) {
return this.doc.getTextRange(range);
};
- this.insert = function(position, text) {
+ /** related to: Document.insert
+ * Edit_Session.insert(position, text) -> Number
+ * - position (Number): The position to start inserting at
+ * - text (String): A chunk of text to insert
+ *
+ * Inserts a block of `text` and the indicated `position`.
+ *
+ * #### Returns
+ *
+ * Returns the position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
+ *
+ **/
+ this.insert = function(position, text) {
return this.doc.insert(position, text);
};
- this.remove = function(range) {
+ /** related to: Document.remove
+ * Edit_Session.remove(range) -> Object
+ * - range (Range): A specified Range to remove
+ *
+ * Removes the `range` from the document.
+ *
+ * #### Returns
+ *
+ * Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
+ **/
+ this.remove = function(range) {
return this.doc.remove(range);
};
- this.undoChanges = function(deltas, dontSelect) {
+ /**
+ * Edit_Session.undoChanges(deltas, dontSelect) -> Range
+ * - deltas (Array):
+ * - dontSelect (Boolean):
+ *
+ * TODO
+ **/
+ this.undoChanges = function(deltas, dontSelect) {
if (!deltas.length)
return;
@@ -677,7 +1035,14 @@ var EditSession = function(text, mode) {
return lastUndoRange;
};
- this.redoChanges = function(deltas, dontSelect) {
+ /**
+ * Edit_Session.redoChanges(deltas, dontSelect) -> Range
+ * - deltas (Array):
+ * - dontSelect (Boolean):
+ *
+ * TODO
+ **/
+ this.redoChanges = function(deltas, dontSelect) {
if (!deltas.length)
return;
@@ -699,11 +1064,22 @@ var EditSession = function(text, mode) {
return lastUndoRange;
};
- this.setUndoSelect = function(enable) {
+ /**
+ * Edit_Session.setUndoSelect(enable) -> Void
+ * - enable (Boolean):
+ *
+ * TODO
+ **/
+ this.setUndoSelect = function(enable) {
this.$undoSelect = enable;
};
- this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
+ /**
+ * Edit_Session.$getUndoSelection(deltas, isUndo, lastUndoRange) -> Range
+ *
+ * TODO
+ **/
+ this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
function isInsert(delta) {
var insert =
delta.action == "insertText" || delta.action == "insertLines";
@@ -757,20 +1133,44 @@ var EditSession = function(text, mode) {
return range;
},
- this.replace = function(range, text) {
+ /** related to: Document.replace
+ * Edit_Session.replace(range, text) -> Object
+ * - range (Range): A specified Range to replace
+ * - text (String): The new text to use as a replacement
+ *
+ * Replaces a range in the document with the new `text`.
+ *
+ * #### Returns
+ *
+ * Returns an object containing the final row and column, like this:
+ *
+ * {row: endRow, column: 0}
+ *
+ * If the text and range are empty, this function returns an object containing the current `range.start` value.
+ *
+ * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
+ *
+ **/
+ this.replace = function(range, text) {
return this.doc.replace(range, text);
};
/**
- * Move a range of text from the given range to the given position.
- *
- * @param fromRange {Range} The range of text you want moved within the
- * document.
- * @param toPosition {Object} The location (row and column) where you want
- * to move the text to.
- * @return {Range} The new range where the text was moved to.
- */
- this.moveText = function(fromRange, toPosition) {
+ * Edit_Session.moveText(fromRange, toPosition) -> Range
+ * - fromRange (Range): The range of text you want moved within the document
+ * - toPosition (Object): The location (row and column) where you want to move the text to
+ *
+ * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
+ *
+ * { row: newRowLocation, column: newColumnLocation }
+ *
+ *
+ * #### Returns
+ *
+ * The new range where the text was moved to.
+ *
+ **/
+ this.moveText = function(fromRange, toPosition) {
var text = this.getTextRange(fromRange);
this.remove(fromRange);
@@ -800,12 +1200,30 @@ var EditSession = function(text, mode) {
return toRange;
};
- this.indentRows = function(startRow, endRow, indentString) {
+ /**
+ * Edit_Session.indentRows(startRow, endRow, indentString) -> Void
+ * - startRow (Number): Starting row
+ * - endRow (Number): Ending row
+ * - indentString (String): The indent token
+ *
+ * Indents all the rows, from `startRow` to `endRow` (inclusive), by prefixing each row with the token in `indentString`.
+ *
+ * If `indentString` contains the `'\t'` character, it's replaced by whatever is defined by [[getTabString `getTabString()`]].
+ *
+ **/
+ this.indentRows = function(startRow, endRow, indentString) {
indentString = indentString.replace(/\t/g, this.getTabString());
for (var row=startRow; row<=endRow; row++)
this.insert({row: row, column:0}, indentString);
};
+ /**
+ * Edit_Session.outdentRows(range) -> Void
+ * - range (Range): A range of rows
+ *
+ * Outdents all the rows defined by the `start` and `end` properties of `range`.
+ *
+ **/
this.outdentRows = function (range) {
var rowRange = range.collapseRows();
var deleteRange = new Range(0, 0, 0, 0);
@@ -830,7 +1248,19 @@ var EditSession = function(text, mode) {
}
};
- this.moveLinesUp = function(firstRow, lastRow) {
+ /** related to: Document.insertLines
+ * Edit_Session.moveLinesUp(firstRow, lastRow) -> Number
+ * - firstRow (Number): The starting row to move up
+ * - lastRow (Number): The final row to move up
+ *
+ * Shifts all the lines in the document up one, starting from `firstRow` and ending at `lastRow`.
+ *
+ * #### Returns
+ *
+ * If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
+ *
+ **/
+ this.moveLinesUp = function(firstRow, lastRow) {
if (firstRow <= 0) return 0;
var removed = this.doc.removeLines(firstRow, lastRow);
@@ -838,7 +1268,19 @@ var EditSession = function(text, mode) {
return -1;
};
- this.moveLinesDown = function(firstRow, lastRow) {
+ /** related to: Document.insertLines
+ * Edit_Session.moveLinesDown(firstRow, lastRow) -> Number
+ * - firstRow (Number): The starting row to move down
+ * - lastRow (Number): The final row to move down
+ *
+ * Shifts all the lines in the document down one, starting from `firstRow` and ending at `lastRow`.
+ *
+ * #### Returns
+ *
+ * If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
+ *
+ **/
+ this.moveLinesDown = function(firstRow, lastRow) {
if (lastRow >= this.doc.getLength()-1) return 0;
var removed = this.doc.removeLines(firstRow, lastRow);
@@ -846,7 +1288,19 @@ var EditSession = function(text, mode) {
return 1;
};
- this.duplicateLines = function(firstRow, lastRow) {
+ /**
+ * Edit_Session.duplicateLines(firstRow, lastRow) -> Number
+ * - firstRow (Number): The starting row to duplicate
+ * - lastRow (Number): The final row to duplicate
+ *
+ * Duplicates all the text between `firstRow` and `lastRow`.
+ *
+ * #### Returns
+ *
+ * Returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
+ *
+ **/
+ this.duplicateLines = function(firstRow, lastRow) {
var firstRow = this.$clipRowToDocument(firstRow);
var lastRow = this.$clipRowToDocument(lastRow);
@@ -857,17 +1311,19 @@ var EditSession = function(text, mode) {
return addedRows;
};
- this.$clipRowToDocument = function(row) {
+
+ this.$clipRowToDocument = function(row) {
return Math.max(0, Math.min(row, this.doc.getLength()-1));
};
- this.$clipColumnToRow = function(row, column) {
+ this.$clipColumnToRow = function(row, column) {
if (column < 0)
return 0;
return Math.min(this.doc.getLine(row).length, column);
};
- this.$clipPositionToDocument = function(row, column) {
+
+ this.$clipPositionToDocument = function(row, column) {
column = Math.max(0, column);
if (row < 0) {
@@ -889,7 +1345,7 @@ var EditSession = function(text, mode) {
};
};
- this.$clipRangeToDocument = function(range) {
+ this.$clipRangeToDocument = function(range) {
if (range.start.row < 0) {
range.start.row = 0;
range.start.column = 0
@@ -921,7 +1377,12 @@ var EditSession = function(text, mode) {
max : null
};
- this.setUseWrapMode = function(useWrapMode) {
+ /**
+ * Edit_Session.setUseWrapMode(useWrapMode) -> Void
+ *
+ * TODO line wrapping ?
+ **/
+ this.setUseWrapMode = function(useWrapMode) {
if (useWrapMode != this.$useWrapMode) {
this.$useWrapMode = useWrapMode;
this.$modified = true;
@@ -941,7 +1402,12 @@ var EditSession = function(text, mode) {
}
};
- this.getUseWrapMode = function() {
+ /**
+ * Edit_Session.getUseWrapMode() -> Boolean
+ *
+ * Returns `true` if wrap mode is being used; `false` otherwise.
+ **/
+ this.getUseWrapMode = function() {
return this.$useWrapMode;
};
@@ -949,7 +1415,12 @@ var EditSession = function(text, mode) {
// parameter can be null to allow the wrap limit to be unconstrained
// in that direction. Or set both parameters to the same number to pin
// the limit to that value.
- this.setWrapLimitRange = function(min, max) {
+ /**
+ * Edit_Session.setWrapLimitRange(min, max) -> Void
+ *
+ * TODO At what point to wrap ?
+ **/
+ this.setWrapLimitRange = function(min, max) {
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
this.$wrapLimitRange.min = min;
this.$wrapLimitRange.max = max;
@@ -961,7 +1432,13 @@ var EditSession = function(text, mode) {
// This should generally only be called by the renderer when a resize
// is detected.
- this.adjustWrapLimit = function(desiredLimit) {
+ /**
+ * Edit_Session.adjustWrapLimit(desiredLimit) -> Boolean
+ * - desiredLimit (Number): New limit
+ *
+ * TODO
+ **/
+ this.adjustWrapLimit = function(desiredLimit) {
var wrapLimit = this.$constrainWrapLimit(desiredLimit);
if (wrapLimit != this.$wrapLimit && wrapLimit > 0) {
this.$wrapLimit = wrapLimit;
@@ -976,7 +1453,7 @@ var EditSession = function(text, mode) {
return false;
};
- this.$constrainWrapLimit = function(wrapLimit) {
+ this.$constrainWrapLimit = function(wrapLimit) {
var min = this.$wrapLimitRange.min;
if (min)
wrapLimit = Math.max(min, wrapLimit);
@@ -989,11 +1466,24 @@ var EditSession = function(text, mode) {
return Math.max(1, wrapLimit);
};
- this.getWrapLimit = function() {
+ /**
+ * Edit_Session.getWrapLimit() -> Number
+ *
+ * Returns the value of wrap limit.
+ **/
+ this.getWrapLimit = function() {
return this.$wrapLimit;
};
- this.getWrapLimitRange = function() {
+ /**
+ * Edit_Session.getWrapLimitRange() -> Object
+ *
+ * Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
+ *
+ * { min: wrapLimitRange_min, max: wrapLimitRange_max }
+ *
+ **/
+ this.getWrapLimitRange = function() {
// Avoid unexpected mutation by returning a copy
return {
min : this.$wrapLimitRange.min,
@@ -1001,7 +1491,7 @@ var EditSession = function(text, mode) {
};
};
- this.$updateInternalDataOnChange = function(e) {
+ this.$updateInternalDataOnChange = function(e) {
var useWrapMode = this.$useWrapMode;
var len;
var action = e.data.action;
@@ -1116,7 +1606,7 @@ var EditSession = function(text, mode) {
return removedFolds;
};
- this.$updateWrapData = function(firstRow, lastRow) {
+ this.$updateWrapData = function(firstRow, lastRow) {
var lines = this.doc.getAllLines();
var tabSize = this.getTabSize();
var wrapData = this.$wrapData;
@@ -1175,7 +1665,7 @@ var EditSession = function(text, mode) {
TAB = 11,
TAB_SPACE = 12;
- this.$computeWrapSplits = function(tokens, wrapLimit) {
+ this.$computeWrapSplits = function(tokens, wrapLimit) {
if (tokens.length == 0) {
return [];
}
@@ -1291,12 +1781,7 @@ var EditSession = function(text, mode) {
return splits;
}
- /**
- * @param
- * offset: The offset in screenColumn at which position str starts.
- * Important for calculating the realTabSize.
- */
- this.$getDisplayTokens = function(str, offset) {
+ this.$getDisplayTokens = function(str, offset) {
var arr = [];
var tabSize;
offset = offset || 0;
@@ -1328,15 +1813,19 @@ var EditSession = function(text, mode) {
}
/**
- * Calculates the width of the a string on the screen while assuming that
- * the string starts at the first column on the screen.
- *
- * @param string str String to calculate the screen width of
- * @return array
- * [0]: number of columns for str on screen.
- * [1]: docColumn position that was read until (useful with screenColumn)
- */
- this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
+ * Edit_Session.$getStringScreenWidth(str, maxScreenColumn, screenColumn) -> Array
+ * - str (String): The string to calculate the screen width of
+ * - maxScreenColumn (Integer): TODO
+ * - screenColumn (Integer): TODO
+ *
+ * Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen.
+ *
+ * #### Returns
+ *
+ * Returns an `int[]` array with two elements. The first position indicates the number of columns for `str` on screen. The second value contains the position of the document column that this function read until.
+ *
+ **/
+ this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
if (maxScreenColumn == 0) {
return [0, 0];
}
@@ -1368,9 +1857,13 @@ var EditSession = function(text, mode) {
}
/**
- * Returns the number of rows required to render this row on the screen
- */
- this.getRowLength = function(row) {
+ * Edit_Session.getRowLength(row) -> Number
+ * - row (Number): The row number to check
+ *
+ *
+ * Returns the length of the indicated row.
+ **/
+ this.getRowLength = function(row) {
if (!this.$useWrapMode || !this.$wrapData[row]) {
return 1;
} else {
@@ -1379,28 +1872,53 @@ var EditSession = function(text, mode) {
}
/**
- * Returns the height in pixels required to render this row on the screen
- **/
- this.getRowHeight = function(config, row) {
+ * Edit_Session.getRowHeight(config, row) -> Number
+ * - config (String): TODO
+ * - row (Number): The row number to check
+ *
+ * Returns the height of the indicated row.
+ *
+ **/
+ this.getRowHeight = function(config, row) {
return this.getRowLength(row) * config.lineHeight;
}
- this.getScreenLastRowColumn = function(screenRow) {
+ /**
+ * Edit_Session.getScreenLastRowColumn(screenRow) -> Number
+ *
+ * TODO
+ **/
+ this.getScreenLastRowColumn = function(screenRow) {
//return this.screenToDocumentColumn(screenRow, Number.MAX_VALUE / 10)
return this.documentToScreenColumn(screenRow, this.doc.getLine(screenRow).length);
};
- this.getDocumentLastRowColumn = function(docRow, docColumn) {
+ /**
+ * Edit_Session.getDocumentLastRowColumn(docRow, docColumn) -> Number
+ *
+ * TODO
+ **/
+ this.getDocumentLastRowColumn = function(docRow, docColumn) {
var screenRow = this.documentToScreenRow(docRow, docColumn);
return this.getScreenLastRowColumn(screenRow);
};
- this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
+ /**
+ * Edit_Session.getDocumentLastRowColumnPosition(docRow, docColumn) -> Number
+ *
+ * TODO
+ **/
+ this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
var screenRow = this.documentToScreenRow(docRow, docColumn);
return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
};
- this.getRowSplitData = function(row) {
+ /**
+ * Edit_Session.getRowSplitData(row) -> undefined | String
+ *
+ * TODO
+ **/
+ this.getRowSplitData = function(row) {
if (!this.$useWrapMode) {
return undefined;
} else {
@@ -1409,21 +1927,39 @@ var EditSession = function(text, mode) {
};
/**
- * Returns the width of a tab character at screenColumn.
- */
- this.getScreenTabSize = function(screenColumn) {
+ * Edit_Session.getScreenTabSize(screenColumn) -> Number
+ * - screenColumn (Number): The screen column to check
+ *
+ * TODO Returns the width of a tab character at `screenColumn`.
+ **/
+ this.getScreenTabSize = function(screenColumn) {
return this.$tabSize - screenColumn % this.$tabSize;
};
- this.screenToDocumentRow = function(screenRow, screenColumn) {
+ /**
+ * Edit_Session.screenToDocumentRow(screenRow, screenColumn) -> Number
+ *
+ * TODO
+ **/
+ this.screenToDocumentRow = function(screenRow, screenColumn) {
return this.screenToDocumentPosition(screenRow, screenColumn).row;
};
- this.screenToDocumentColumn = function(screenRow, screenColumn) {
+ /**
+ * Edit_Session.screenToDocumentColumn(screenRow, screenColumn) -> Number
+ *
+ * TODO
+ **/
+ this.screenToDocumentColumn = function(screenRow, screenColumn) {
return this.screenToDocumentPosition(screenRow, screenColumn).column;
};
- this.screenToDocumentPosition = function(screenRow, screenColumn) {
+ /**
+ * Edit_Session.screenToDocumentPosition(screenRow, screenColumn) -> Number
+ *
+ * TODO
+ **/
+ this.screenToDocumentPosition = function(screenRow, screenColumn) {
if (screenRow < 0) {
return {
row: 0,
@@ -1524,7 +2060,12 @@ var EditSession = function(text, mode) {
}
};
- this.documentToScreenPosition = function(docRow, docColumn) {
+ /**
+ * Edit_Session.documentToScreenPosition(docRow, docColumn) -> Number
+ *
+ * TODO
+ **/
+ this.documentToScreenPosition = function(docRow, docColumn) {
// Normalize the passed in arguments.
if (typeof docColumn === "undefined")
var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
@@ -1627,15 +2168,30 @@ var EditSession = function(text, mode) {
};
};
- this.documentToScreenColumn = function(row, docColumn) {
+ /**
+ * Edit_Session.documentToScreenColumn(row, docColumn) -> Number
+ *
+ * TODO
+ **/
+ this.documentToScreenColumn = function(row, docColumn) {
return this.documentToScreenPosition(row, docColumn).column;
};
- this.documentToScreenRow = function(docRow, docColumn) {
+ /**
+ * Edit_Session.documentToScreenRow(docRow, docColumn) -> Number
+ *
+ * TODO
+ **/
+ this.documentToScreenRow = function(docRow, docColumn) {
return this.documentToScreenPosition(docRow, docColumn).row;
};
- this.getScreenLength = function() {
+ /**
+ * Edit_Session.getScreenLength() -> Number
+ *
+ * Returns the length of the screen.
+ **/
+ this.getScreenLength = function() {
var screenRows = 0;
var fold = null;
if (!this.$useWrapMode) {
diff --git a/lib/ace/edit_session/fold.js b/lib/ace/edit_session/fold.js
index d15bc025..ffe8a92a 100644
--- a/lib/ace/edit_session/fold.js
+++ b/lib/ace/edit_session/fold.js
@@ -39,7 +39,7 @@
define(function(require, exports, module) {
"use strict";
-/**
+/*
* Simple fold-data struct.
**/
var Fold = exports.Fold = function(range, placeholder) {
diff --git a/lib/ace/edit_session/fold_line.js b/lib/ace/edit_session/fold_line.js
index e51ec7c4..7676c4a1 100644
--- a/lib/ace/edit_session/fold_line.js
+++ b/lib/ace/edit_session/fold_line.js
@@ -41,7 +41,7 @@ define(function(require, exports, module) {
var Range = require("../range").Range;
-/**
+/*
* If an array is passed in, the folds are expected to be sorted already.
*/
function FoldLine(foldData, folds) {
@@ -64,7 +64,7 @@ function FoldLine(foldData, folds) {
}
(function() {
- /**
+ /*
* Note: This doesn't update wrapData!
*/
this.shiftRow = function(shift) {
diff --git a/lib/ace/edit_session/folding.js b/lib/ace/edit_session/folding.js
index 36565555..71bf60ba 100644
--- a/lib/ace/edit_session/folding.js
+++ b/lib/ace/edit_session/folding.js
@@ -45,7 +45,7 @@ var Fold = require("./fold").Fold;
var TokenIterator = require("../token_iterator").TokenIterator;
function Folding() {
- /**
+ /*
* Looks up a fold at a given row/column. Possible values for side:
* -1: ignore a fold if fold.start = row/column
* +1: ignore a fold if fold.end = row/column
@@ -69,7 +69,7 @@ function Folding() {
}
};
- /**
+ /*
* Returns all folds in the given range. Note, that this will return folds
*
*/
@@ -115,7 +115,7 @@ function Folding() {
return foundFolds;
};
- /**
+ /*
* Returns all folds in the document
*/
this.getAllFolds = function() {
@@ -138,7 +138,7 @@ function Folding() {
return folds;
};
- /**
+ /*
* Returns the string between folds at the given position.
* E.g.
* foob|arwolrd -> "bar"
@@ -257,7 +257,7 @@ function Folding() {
return foldLine;
};
- /**
+ /*
* Adds a new fold.
*
* @returns
@@ -457,7 +457,7 @@ function Folding() {
}
};
- /**
+ /*
* Checks if a given documentRow is folded. This is true if there are some
* folded parts such that some parts of the line is still visible.
**/
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index 11cdda66..666f4c66 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -58,11 +58,32 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
var CommandManager = require("./commands/command_manager").CommandManager;
var defaultCommands = require("./commands/default_commands").commands;
+/**
+ * class Editor
+ *
+ * Some editor stuff. TODO
+ *
+ **/
+
+/**
+ * new Editor(renderer, session)
+ * - renderer (VirtualRenderer):
+ * - session (EditSession):
+ *
+ * Creates a new `Editor`. TODO
+ *
+ **/
var Editor = function(renderer, session) {
var container = renderer.getContainerElement();
this.container = container;
this.renderer = renderer;
+ /**
+ * Editor.textInput -> TextInput
+ *
+ * The current text editable area of the document.
+ *
+ **/
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
this.keyBinding = new KeyBinding(this);
@@ -87,15 +108,31 @@ var Editor = function(renderer, session) {
oop.implement(this, EventEmitter);
- this.setKeyboardHandler = function(keyboardHandler) {
+ /**
+ * Editor.setKeyboardHandler(keyboardHandler) -> Void
+ *
+ * Sets a new keyboard handler.
+ **/
+ this.setKeyboardHandler = function(keyboardHandler) {
this.keyBinding.setKeyboardHandler(keyboardHandler);
};
- this.getKeyboardHandler = function() {
+ /**
+ * Editor.getKeyboardHandler() -> String
+ *
+ * TODO Returns a keyboard handler.
+ **/
+ this.getKeyboardHandler = function() {
return this.keyBinding.getKeyboardHandler();
};
- this.setSession = function(session) {
+ /**
+ * Editor.setSession(session) -> Void
+ * - session (EditSession): The new session to use
+ *
+ * Sets a new session to use. This method also emits the `'changeSession'` event.
+ **/
+ this.setSession = function(session) {
if (this.session == session)
return;
@@ -194,40 +231,86 @@ var Editor = function(renderer, session) {
});
};
- this.getSession = function() {
+ /**
+ * Editor.getSession() -> EditSession
+ *
+ * Returns the current session being used.
+ **/
+ this.getSession = function() {
return this.session;
};
- this.getSelection = function() {
+ /**
+ * Editor.getSelection() -> String
+ *
+ * TODO
+ **/
+ this.getSelection = function() {
return this.selection;
};
- this.resize = function() {
+ /**related to: VirtualRenderer.onResize
+ * Editor.resize() -> Void
+ *
+ *
+ **/
+ this.resize = function() {
this.renderer.onResize();
};
- this.setTheme = function(theme) {
+ /**
+ * Editor.setTheme(theme) -> Void
+ *
+ * (~VirtualRenderer.setTheme)
+ **/
+ this.setTheme = function(theme) {
this.renderer.setTheme(theme);
};
- this.getTheme = function() {
+ /** related to: VirtualRenderer.getTheme
+ * Editor.getTheme() -> String
+ *
+ * (~VirtualRenderer.getTheme)
+ **/
+ this.getTheme = function() {
return this.renderer.getTheme();
};
- this.setStyle = function(style) {
+ /** related to: VirtualRenderer.setStyle
+ * Editor.setStyle(style) -> Void
+ *
+ * (~VirtualRenderer.setStyle)
+ **/
+ this.setStyle = function(style) {
this.renderer.setStyle(style);
};
- this.unsetStyle = function(style) {
+ /** related to: VirtualRenderer.unsetStyle
+ * Editor.unsetStyle(style) -> Void
+ *
+ * (~VirtualRenderer.unsetStyle)
+ **/
+ this.unsetStyle = function(style) {
this.renderer.unsetStyle(style);
};
- this.setFontSize = function(size) {
+ /**
+ * Editor.setFontSize(size) -> Void
+ * - size (Number): A font size
+ *
+ * Set a new font size (in pixels) for the editor text.
+ **/
+ this.setFontSize = function(size) {
this.container.style.fontSize = size;
this.renderer.updateFontSize();
};
- this.$highlightBrackets = function() {
+ /**
+ * Editor.$highlightBrackets() -> Void
+ *
+ * TODO Highlights matching
+ **/
+ this.$highlightBrackets = function() {
if (this.session.$bracketHighlight) {
this.session.removeMarker(this.session.$bracketHighlight);
this.session.$bracketHighlight = null;
@@ -251,7 +334,12 @@ var Editor = function(renderer, session) {
}, 10);
};
- this.focus = function() {
+ /**
+ * Editor.focus() -> Void
+ *
+ * Brings the current [[textInput `textInput`]] into focus.
+ **/
+ this.focus = function() {
// Safari needs the timeout
// iOS and Firefox need it called immediately
// to be on the save side we do both
@@ -262,27 +350,54 @@ var Editor = function(renderer, session) {
this.textInput.focus();
};
- this.isFocused = function() {
+ /**
+ * Editor.isFocused() -> Boolean
+ *
+ * Returns true if the current [[textInput `textInput`]] is in focus.
+ **/
+ this.isFocused = function() {
return this.textInput.isFocused();
};
- this.blur = function() {
+ /**
+ * Editor.blur() -> Void
+ *
+ * Blurs the current [[textInput `textInput`]].
+ **/
+ this.blur = function() {
this.textInput.blur();
};
- this.onFocus = function() {
+ /**
+ * Editor@onFocus()
+ *
+ * Emitted once the editor comes into focus.
+ **/
+ this.onFocus = function() {
this.renderer.showCursor();
this.renderer.visualizeFocus();
this._emit("focus");
};
- this.onBlur = function() {
+ /**
+ * Editor@onBlur()
+ *
+ * Emitted once the editor has been blurred.
+ **/
+ this.onBlur = function() {
this.renderer.hideCursor();
this.renderer.visualizeBlur();
this._emit("blur");
};
- this.onDocumentChange = function(e) {
+ /**
+ * Editor@onDocumentChange(e)
+ * - e (Object): Contains a single property, `data`, which has the delta of changes
+ *
+ * Emitted whenever the document is changed.
+ *
+ **/
+ this.onDocumentChange = function(e) {
var delta = e.data;
var range = delta.range;
var lastRow;
@@ -299,20 +414,41 @@ var Editor = function(renderer, session) {
this.onCursorChange();
};
- this.onTokenizerUpdate = function(e) {
+ /**
+ * Editor@onTokenizerUpdate(e)
+ * - e (Object): Contains a single property, `data`, which indicates the changed rows
+ *
+ * Emitted when the a tokenizer is updated.
+ **/
+ this.onTokenizerUpdate = function(e) {
var rows = e.data;
this.renderer.updateLines(rows.first, rows.last);
};
- this.onScrollTopChange = function() {
+ /**
+ * Editor@onScrollTopChange()
+ *
+ * TODO Emitted when the top
+ **/
+ this.onScrollTopChange = function() {
this.renderer.scrollToY(this.session.getScrollTop());
};
- this.onScrollLeftChange = function() {
+ /**
+ * Editor@onScrollLeftChange()
+ *
+ * TODO Emitted when
+ **/
+ this.onScrollLeftChange = function() {
this.renderer.scrollToX(this.session.getScrollLeft());
};
- this.onCursorChange = function() {
+ /**
+ * Editor@onCursorChange()
+ *
+ * TODO Emitted whenever the cursor changes.
+ **/
+ this.onCursorChange = function() {
this.renderer.updateCursor();
if (!this.$blockScrolling) {
@@ -327,7 +463,7 @@ var Editor = function(renderer, session) {
this.$updateHighlightActiveLine();
};
- this.$updateHighlightActiveLine = function() {
+ this.$updateHighlightActiveLine = function() {
var session = this.getSession();
if (session.$highlightLineMarker) {
@@ -348,7 +484,13 @@ var Editor = function(renderer, session) {
}
};
- this.onSelectionChange = function(e) {
+ /**
+ * Editor@onSelectionChange(e)
+ * - e (Object): Contains a single property, `data`, which has the delta of changes
+ *
+ * Emitted when a selection has changed.
+ **/
+ this.onSelectionChange = function(e) {
var session = this.getSession();
if (session.$selectionMarker) {
@@ -368,35 +510,75 @@ var Editor = function(renderer, session) {
this.session.getMode().highlightSelection(this);
};
- this.onChangeFrontMarker = function() {
+ /**
+ * Editor@onChangeFrontMarker()
+ *
+ * Emitted when a front marker changes.
+ **/
+ this.onChangeFrontMarker = function() {
this.renderer.updateFrontMarkers();
};
- this.onChangeBackMarker = function() {
+ /**
+ * Editor@onChangeBackMarker()
+ *
+ * Emitted when a back marker changes.
+ **/
+ this.onChangeBackMarker = function() {
this.renderer.updateBackMarkers();
};
- this.onChangeBreakpoint = function() {
+ /**
+ * Editor@onChangeBreakpoint()
+ *
+ * Emitted when a breakpoint changes.
+ **/
+ this.onChangeBreakpoint = function() {
this.renderer.setBreakpoints(this.session.getBreakpoints());
};
- this.onChangeAnnotation = function() {
+ /**
+ * Editor@onChangeAnnotation()
+ *
+ * Emitted when an annotation changes.
+ **/
+ this.onChangeAnnotation = function() {
this.renderer.setAnnotations(this.session.getAnnotations());
};
- this.onChangeMode = function() {
+ /**
+ * Editor@onChangeMode()
+ *
+ * Emitted when the mode changes.
+ **/
+ this.onChangeMode = function() {
this.renderer.updateText();
};
- this.onChangeWrapLimit = function() {
+ /**
+ * Editor@onChangeWrapLimit()
+ *
+ * Emitted when the wrap limit changes.
+ **/
+ this.onChangeWrapLimit = function() {
this.renderer.updateFull();
};
- this.onChangeWrapMode = function() {
+ /**
+ * Editor@onChangeWrapMode()
+ *
+ * Emitted when the wrap mode changes.
+ **/
+ this.onChangeWrapMode = function() {
this.renderer.onResize(true);
};
- this.onChangeFold = function() {
+ /**
+ * Editor@onChangeFold()
+ *
+ * Emitted when the code folds change.
+ **/
+ this.onChangeFold = function() {
// Update the active line marker as due to folding changes the current
// line range on the screen might have changed.
this.$updateHighlightActiveLine();
@@ -404,7 +586,12 @@ var Editor = function(renderer, session) {
this.renderer.updateFull();
};
- this.getCopyText = function() {
+ /**
+ * Editor.getCopyText() -> String
+ *
+ * Returns the string of text currently highlighted.
+ **/
+ this.getCopyText = function() {
var text = "";
if (!this.selection.isEmpty())
text = this.session.getTextRange(this.getSelectionRange());
@@ -413,7 +600,12 @@ var Editor = function(renderer, session) {
return text;
};
- this.onCut = function() {
+ /**
+ * Editor@onCut()
+ *
+ * Emitted whenever a text "cut" happens.
+ **/
+ this.onCut = function() {
if (this.$readOnly)
return;
@@ -426,7 +618,13 @@ var Editor = function(renderer, session) {
}
};
- this.insert = function(text) {
+ /**
+ * Editor.insert(text) -> Void
+ * - text (String): The new text to add
+ *
+ * TODO Inserts `text` into wherever the cursor is pointing.
+ **/
+ this.insert = function(text) {
var session = this.session;
var mode = session.getMode();
@@ -518,47 +716,105 @@ var Editor = function(renderer, session) {
mode.autoOutdent(lineState, session, cursor.row);
};
- this.onTextInput = function(text, pasted) {
+ /**
+ * Editor@onTextInput(text, pasted)
+ *
+ * TODO
+ **/
+ this.onTextInput = function(text, pasted) {
if (pasted)
this._emit("paste", text);
this.keyBinding.onTextInput(text, pasted);
};
- this.onCommandKey = function(e, hashId, keyCode) {
+ /**
+ * Editor@onCommandKey(e, hashId, keyCode)
+ *
+ * TODO
+ **/
+ this.onCommandKey = function(e, hashId, keyCode) {
this.keyBinding.onCommandKey(e, hashId, keyCode);
};
- this.setOverwrite = function(overwrite) {
+ /** related to: EditSession.setOverwrite
+ * Editor.setOverwrite(overwrite) -> Void
+ * - overwrite (Boolean): Defines wheter or not to set overwrites
+ *
+ * Pass in `true` to enable overwrites in your session, or `false` to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event.
+ *
+ **/
+ this.setOverwrite = function(overwrite) {
this.session.setOverwrite(overwrite);
};
- this.getOverwrite = function() {
+ /** related to: EditSession.getOverwrite
+ * Editor.getOverwrite() -> Boolean
+ *
+ * Returns `true` if overwrites are enabled; `false` otherwise.
+ **/
+ this.getOverwrite = function() {
return this.session.getOverwrite();
};
- this.toggleOverwrite = function() {
+ /** related to: EditSession.toggleOverwrite
+ * Editor.toggleOverwrite() -> Void
+ *
+ * Sets the value of overwrite to the opposite of whatever it currently is.
+ **/
+ this.toggleOverwrite = function() {
this.session.toggleOverwrite();
};
- this.setScrollSpeed = function(speed) {
+ /**
+ * Editor.setScrollSpeed(speed) -> Void
+ * - speed (Integer): A value indicating the new speed
+ *
+ * Sets how fast the mouse scrolling should do.
+ *
+ **/
+ this.setScrollSpeed = function(speed) {
this.$mouseHandler.setScrollSpeed(speed);
};
- this.getScrollSpeed = function() {
+ /**
+ * Editor.getScrollSpeed() -> Number
+ *
+ * Returns the value indicating how fast the mouse scroll speed is.
+ **/
+ this.getScrollSpeed = function() {
return this.$mouseHandler.getScrollSpeed();
};
- this.setDragDelay = function(dragDelay) {
+ /**
+ * Editor.setDragDelay(dragDelay) -> Void
+ * - dragDelay (Number): A value indicating the new delay
+ *
+ * TODO Sets the delay (in milliseconds) of the mouse drag.
+ *
+ **/
+ this.setDragDelay = function(dragDelay) {
this.$mouseHandler.setDragDelay(dragDelay);
};
- this.getDragDelay = function() {
+ /**
+ * Editor.getDragDelay() -> Number
+ *
+ * Returns the current mouse drag delay.
+ **/
+ this.getDragDelay = function() {
return this.$mouseHandler.getDragDelay();
};
this.$selectionStyle = "line";
- this.setSelectionStyle = function(style) {
+ /**
+ * Editor.setSelectionStyle(style) -> Void
+ * - style (String): The new selection style
+ *
+ * Indicates how selections should occur. By default, selections are set to "line". This function also emits the `'changeSelectionStyle'` event.
+ *
+ **/
+ this.setSelectionStyle = function(style) {
if (this.$selectionStyle == style) return;
this.$selectionStyle = style;
@@ -566,24 +822,48 @@ var Editor = function(renderer, session) {
this._emit("changeSelectionStyle", {data: style});
};
- this.getSelectionStyle = function() {
+ /**
+ * Editor.getSelectionStyle() -> String
+ *
+ * Returns the current selection style.
+ **/
+ this.getSelectionStyle = function() {
return this.$selectionStyle;
};
this.$highlightActiveLine = true;
- this.setHighlightActiveLine = function(shouldHighlight) {
+
+ /**
+ * Editor.setHighlightActiveLine(shouldHighlight) -> Void
+ * - shouldHighlight (Boolean): Set to `true` to highlight the current line
+ *
+ * Determines whether or not the current line should be highlighted.
+ *
+ **/
+ this.setHighlightActiveLine = function(shouldHighlight) {
if (this.$highlightActiveLine == shouldHighlight) return;
this.$highlightActiveLine = shouldHighlight;
this.$updateHighlightActiveLine();
};
- this.getHighlightActiveLine = function() {
+ /**
+ * Editor.getHighlightActiveLine() -> Boolean
+ *
+ * Returns `true` if current lines are always highlighted.
+ **/
+ this.getHighlightActiveLine = function() {
return this.$highlightActiveLine;
};
this.$highlightSelectedWord = true;
- this.setHighlightSelectedWord = function(shouldHighlight) {
+ /**
+ * Editor.setHighlightSelectedWord(shouldHighlight) -> Void
+ * - shouldHighlight (Boolean): Set to `true` to highlight the currently selected word
+ *
+ * Determines if the currently selected word should be highlighted.
+ **/
+ this.setHighlightSelectedWord = function(shouldHighlight) {
if (this.$highlightSelectedWord == shouldHighlight)
return;
@@ -594,56 +874,125 @@ var Editor = function(renderer, session) {
this.session.getMode().clearSelectionHighlight(this);
};
- this.getHighlightSelectedWord = function() {
+ /**
+ * Editor.getHighlightSelectedWord() -> Boolean
+ *
+ * Returns `true` if currently highlighted words are to be highlighted.
+ **/
+ this.getHighlightSelectedWord = function() {
return this.$highlightSelectedWord;
};
- this.setShowInvisibles = function(showInvisibles) {
+ /**
+ * Editor.setShowInvisibles(showInvisibles) -> Void
+ * - showInvisibles (Boolean): Specifies whether or not to show invisible characters
+ *
+ * If `showInvisibiles` is set to `true`, invisible characters—like spaces or new lines—are show in the editor.
+ **/
+ this.setShowInvisibles = function(showInvisibles) {
if (this.getShowInvisibles() == showInvisibles)
return;
this.renderer.setShowInvisibles(showInvisibles);
};
- this.getShowInvisibles = function() {
+ /**
+ * Editor.getShowInvisibles() -> Boolean
+ *
+ * Returns `true` if invisible characters are being shown.
+ **/
+ this.getShowInvisibles = function() {
return this.renderer.getShowInvisibles();
};
- this.setShowPrintMargin = function(showPrintMargin) {
+ /**
+ * Editor.setShowPrintMargin(showPrintMargin) -> Void
+ * - showPrintMargin (Boolean): Specifies whether or not to show the print margin
+ *
+ * If `showPrintMargin` is set to `true`, the print margin is shown in the editor.
+ **/
+ this.setShowPrintMargin = function(showPrintMargin) {
this.renderer.setShowPrintMargin(showPrintMargin);
};
- this.getShowPrintMargin = function() {
+ /**
+ * Editor.getShowPrintMargin() -> Boolean
+ *
+ * Returns `true` if the print margin is being shown.
+ **/
+ this.getShowPrintMargin = function() {
return this.renderer.getShowPrintMargin();
};
- this.setPrintMarginColumn = function(showPrintMargin) {
+ /**
+ * Editor.setPrintMarginColumn(showPrintMargin) -> Void
+ * - showPrintMargin (Number): Specifies the new print margin
+ *
+ * Sets the column defining where the print margin should be.
+ *
+ **/
+ this.setPrintMarginColumn = function(showPrintMargin) {
this.renderer.setPrintMarginColumn(showPrintMargin);
};
- this.getPrintMarginColumn = function() {
+ /**
+ * Editor.getPrintMarginColumn() -> Number
+ *
+ * Returns the column number of where the print margin is.
+ **/
+ this.getPrintMarginColumn = function() {
return this.renderer.getPrintMarginColumn();
};
this.$readOnly = false;
- this.setReadOnly = function(readOnly) {
+ /**
+ * Editor.setReadOnly(readOnly) -> Void
+ * - readOnly (Boolean): Specifies whether the editor can be modified or not
+ *
+ * If `readOnly` is true, then the editor is set to read-only mode, and none of the content can change.
+ **/
+ this.setReadOnly = function(readOnly) {
this.$readOnly = readOnly;
};
- this.getReadOnly = function() {
+ /**
+ * Editor.getReadOnly() -> Boolean
+ *
+ * Returns `true` if the editor is set to read-only mode.
+ **/
+ this.getReadOnly = function() {
return this.$readOnly;
};
this.$modeBehaviours = true;
+
+ /**
+ * Editor.setBehavioursEnabled() -> Void
+ * - enabled (Boolean)
+ *
+ *TODO
+ **/
this.setBehavioursEnabled = function (enabled) {
this.$modeBehaviours = enabled;
};
+ /**
+ * Editor.getBehavioursEnabled() -> Boolean
+ *
+ * TODO Returns `true` if the behaviours are currently enabled.
+ **/
+
this.getBehavioursEnabled = function () {
return this.$modeBehaviours;
};
- this.setShowFoldWidgets = function(show) {
+ /**
+ * Editor.setShowFoldWidgets(show) -> Void
+ * - show (Boolean): Specifies whether the fold widgets are shown
+ *
+ * Indicates whether the fold widgets are shown or not.
+ **/
+ this.setShowFoldWidgets = function(show) {
var gutter = this.renderer.$gutterLayer;
if (gutter.getShowFoldWidgets() == show)
return;
@@ -653,11 +1002,23 @@ var Editor = function(renderer, session) {
this.renderer.updateFull();
};
- this.getShowFoldWidgets = function() {
+ /**
+ * Editor.getShowFoldWidgets() -> Boolean
+ *
+ * Returns `true` if the fold widgets are shown.
+ **/
+ this.getShowFoldWidgets = function() {
return this.renderer.$gutterLayer.getShowFoldWidgets();
};
- this.remove = function(dir) {
+ /**
+ * Editor.remove(dir) -> Void
+ * - dir (String): The direction of the deletion to occur, either "left" or "right"
+ *
+ * Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.
+ *
+ **/
+ this.remove = function(dir) {
if (this.selection.isEmpty()){
if(dir == "left")
this.selection.selectLeft();
@@ -678,7 +1039,12 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
- this.removeWordRight = function() {
+ /**
+ * Editor.removeWordRight() -> Void
+ *
+ * Removes the word directly to the right of the current selection.
+ **/
+ this.removeWordRight = function() {
if (this.selection.isEmpty())
this.selection.selectWordRight();
@@ -686,7 +1052,12 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
- this.removeWordLeft = function() {
+ /**
+ * Editor.removeWordLeft() -> Void
+ *
+ * Removes the word directly to the left of the current selection.
+ **/
+ this.removeWordLeft = function() {
if (this.selection.isEmpty())
this.selection.selectWordLeft();
@@ -694,7 +1065,12 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
- this.removeToLineStart = function() {
+ /**
+ * Editor.removeToLineStart() -> Void
+ *
+ * Removes all the words to the left of the current selection, until the start of the line.
+ **/
+ this.removeToLineStart = function() {
if (this.selection.isEmpty())
this.selection.selectLineStart();
@@ -702,7 +1078,12 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
- this.removeToLineEnd = function() {
+ /**
+ * Editor.removeToLineEnd() -> Void
+ *
+ * Removes all the words to the right of the current selection, until the end of the line.
+ **/
+ this.removeToLineEnd = function() {
if (this.selection.isEmpty())
this.selection.selectLineEnd();
@@ -716,7 +1097,12 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
- this.splitLine = function() {
+ /**
+ * Editor.splitLine() -> Void
+ *
+ * Splits the line at the current selection (by inserting an `'\n'`).
+ **/
+ this.splitLine = function() {
if (!this.selection.isEmpty()) {
this.session.remove(this.getSelectionRange());
this.clearSelection();
@@ -727,7 +1113,12 @@ var Editor = function(renderer, session) {
this.moveCursorToPosition(cursor);
};
- this.transposeLetters = function() {
+ /**
+ * Editor.transposeLetters() -> Void
+ *
+ * Transposes the letters of the entire line . TODO
+ **/
+ this.transposeLetters = function() {
if (!this.selection.isEmpty()) {
return;
}
@@ -750,7 +1141,12 @@ var Editor = function(renderer, session) {
this.session.replace(range, swap);
};
- this.toLowerCase = function() {
+ /**
+ * Editor.toLowerCase() -> Void
+ *
+ * Converts the current selection entirely into lowercase.
+ **/
+ this.toLowerCase = function() {
var originalRange = this.getSelectionRange();
if (this.selection.isEmpty()) {
this.selection.selectWord();
@@ -762,7 +1158,12 @@ var Editor = function(renderer, session) {
this.selection.setSelectionRange(originalRange);
};
- this.toUpperCase = function() {
+ /**
+ * Editor.toUpperCase() -> Void
+ *
+ * Converts the current selection entirely into uppercase.
+ **/
+ this.toUpperCase = function() {
var originalRange = this.getSelectionRange();
if (this.selection.isEmpty()) {
this.selection.selectWord();
@@ -774,7 +1175,12 @@ var Editor = function(renderer, session) {
this.selection.setSelectionRange(originalRange);
};
- this.indent = function() {
+ /** related to: EditSession.indentRows
+ * Editor.indent() -> Void
+ *
+ * Indents the current line.
+ **/
+ this.indent = function() {
var session = this.session;
var range = this.getSelectionRange();
@@ -797,18 +1203,33 @@ var Editor = function(renderer, session) {
}
};
- this.blockOutdent = function() {
+ /** related to: EditSession.outdentRows
+ * Editor.blockOutdent() -> Void
+ *
+ * Outdents the current line.
+ **/
+ this.blockOutdent = function() {
var selection = this.session.getSelection();
this.session.outdentRows(selection.getRange());
};
- this.toggleCommentLines = function() {
+ /**
+ * Editor.toggleCommentLines() -> Void
+ *
+ * TODO
+ **/
+ this.toggleCommentLines = function() {
var state = this.session.getState(this.getCursorPosition().row);
var rows = this.$getSelectedRows();
this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
};
- this.removeLines = function() {
+ /** related to: EditSession.remove
+ * Editor.removeLines() -> Void
+ *
+ * Removes all the lines in the current selection
+ **/
+ this.removeLines = function() {
var rows = this.$getSelectedRows();
var range;
if (rows.first === 0 || rows.last+1 < this.session.getLength())
@@ -822,40 +1243,102 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
- this.moveLinesDown = function() {
+ /** related to: EditSession.moveLinesDown
+ * Editor.moveLinesDown() -> Number
+ *
+ * Shifts all the selected lines down one row.
+ *
+ * #### Returns
+ *
+ * On success, it returns -1.
+ *
+ **/
+ this.moveLinesDown = function() {
this.$moveLines(function(firstRow, lastRow) {
return this.session.moveLinesDown(firstRow, lastRow);
});
};
- this.moveLinesUp = function() {
+ /** related to: EditSession.moveLinesUp
+ * Editor.moveLinesUp() -> Number
+ *
+ * Shifts all the selected lines up one row.
+ *
+ * #### Returns
+ *
+ * On success, it returns -1.
+ *
+ **/
+ this.moveLinesUp = function() {
this.$moveLines(function(firstRow, lastRow) {
return this.session.moveLinesUp(firstRow, lastRow);
});
};
- this.moveText = function(range, toPosition) {
+ /** related to: EditSession.moveText
+ * Editor.moveText(fromRange, toPosition) -> Range
+ * - fromRange (Range): The range of text you want moved within the document
+ * - toPosition (Object): The location (row and column) where you want to move the text to
+ *
+ * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
+ *
+ * { row: newRowLocation, column: newColumnLocation }
+ *
+ *
+ * #### Returns
+ *
+ * The new range where the text was moved to.
+ *
+ **/
+ this.moveText = function(range, toPosition) {
if (this.$readOnly)
return null;
return this.session.moveText(range, toPosition);
};
- this.copyLinesUp = function() {
+ /** related to: EditSession.duplicateLines
+ * Editor.copyLinesUp() -> Number
+ *
+ * Copies all the selected lines up one row.
+ *
+ * #### Returns
+ *
+ * On success, returns 0.
+ *
+ **/
+ this.copyLinesUp = function() {
this.$moveLines(function(firstRow, lastRow) {
this.session.duplicateLines(firstRow, lastRow);
return 0;
});
};
- this.copyLinesDown = function() {
+ /** related to: EditSession.duplicateLines
+ * Editor.copyLinesDown() -> Number
+ *
+ * Copies all the selected lines down one row.
+ *
+ * #### Returns
+ *
+ * On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
+ *
+ **/
+ this.copyLinesDown = function() {
this.$moveLines(function(firstRow, lastRow) {
return this.session.duplicateLines(firstRow, lastRow);
});
};
- this.$moveLines = function(mover) {
+ /**
+ * Editor.$moveLines(mover) -> Void
+ * - mover (Function): A method to call on each selected row
+ *
+ * Executes a specific function, which can be anything that manipulates selected lines, such as copying them, duplicating them, or shifting them.
+ *
+ **/
+ this.$moveLines = function(mover) {
var rows = this.$getSelectedRows();
var selection = this.selection;
if (!selection.isMultiLine()) {
@@ -878,7 +1361,15 @@ var Editor = function(renderer, session) {
}
};
- this.$getSelectedRows = function() {
+ /**
+ * Editor.$getSelectedRows() -> Object
+ *
+ * Returns an object indicating the currently selected rows. The object looks like this:
+ *
+ * { first: range.start.row, last: range.end.row }
+ *
+ **/
+ this.$getSelectedRows = function() {
var range = this.getSelectionRange().collapseRows();
return {
@@ -887,50 +1378,99 @@ var Editor = function(renderer, session) {
};
};
- this.onCompositionStart = function(text) {
+ /**
+ * Editor@onCompositionStart(text)
+ * - text (String): The text being written
+ *
+ * TODO
+ **/
+ this.onCompositionStart = function(text) {
this.renderer.showComposition(this.getCursorPosition());
};
- this.onCompositionUpdate = function(text) {
+ /**
+ * Editor@onCompositionUpdate(text)
+ * - text (String): The text being written
+ *
+ * TODO
+ **/
+ this.onCompositionUpdate = function(text) {
this.renderer.setCompositionText(text);
};
- this.onCompositionEnd = function() {
+ /**
+ * Editor@onCompositionEnd()
+ *
+ * TODO
+ **/
+ this.onCompositionEnd = function() {
this.renderer.hideComposition();
};
- this.getFirstVisibleRow = function() {
+ /** related to: VirtualRenderer.getFirstVisibleRow
+ * Editor.getFirstVisibleRow() -> Number
+ *
+ * (~VirtualRenderer.getFirstVisibleRow)
+ **/
+ this.getFirstVisibleRow = function() {
return this.renderer.getFirstVisibleRow();
};
- this.getLastVisibleRow = function() {
+ /** related to: VirtualRenderer.getLastVisibleRow
+ * Editor.getLastVisibleRow() -> Number
+ *
+ * (~VirtualRenderer.getLastVisibleRow)
+ **/
+ this.getLastVisibleRow = function() {
return this.renderer.getLastVisibleRow();
};
- this.isRowVisible = function(row) {
+ /**
+ * Editor.isRowVisible(row) -> Boolean
+ * - row (Number): The row to check
+ *
+ * TODO Indicates if the row is currently visible.
+ **/
+ this.isRowVisible = function(row) {
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
};
- this.isRowFullyVisible = function(row) {
+ /**
+ * Editor.isRowFullyVisible(row) -> Boolean
+ * - row (Number): The row to check
+ *
+ * TODO Indicates if the row is currently visible.
+ **/
+ this.isRowFullyVisible = function(row) {
return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
};
- this.$getVisibleRowCount = function() {
+ /**
+ * Editor.$getVisibleRowCount() -> Number
+ *
+ * Returns the number of currently visibile rows.
+ **/
+ this.$getVisibleRowCount = function() {
return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
};
- this.$getPageDownRow = function() {
+ this.$getPageDownRow = function() {
return this.renderer.getScrollBottomRow();
};
- this.$getPageUpRow = function() {
+ this.$getPageUpRow = function() {
var firstRow = this.renderer.getScrollTopRow();
var lastRow = this.renderer.getScrollBottomRow();
return firstRow - (lastRow - firstRow);
};
- this.selectPageDown = function() {
+ /**
+ * Editor.selectPageDown() -> Void
+ *
+ * TODO
+ **/
+ this.selectPageDown = function() {
var row = this.$getPageDownRow() + Math.floor(this.$getVisibleRowCount() / 2);
this.scrollPageDown();
@@ -941,7 +1481,12 @@ var Editor = function(renderer, session) {
selection.selectTo(dest.row, dest.column);
};
- this.selectPageUp = function() {
+ /**
+ * Editor.selectPageUp() -> Void
+ *
+ * TODO
+ **/
+ this.selectPageUp = function() {
var visibleRows = this.renderer.getScrollTopRow() - this.renderer.getScrollBottomRow();
var row = this.$getPageUpRow() + Math.round(visibleRows / 2);
@@ -953,7 +1498,12 @@ var Editor = function(renderer, session) {
selection.selectTo(dest.row, dest.column);
};
- this.gotoPageDown = function() {
+ /**
+ * Editor.gotoPageDown() -> Void
+ *
+ * TODO
+ **/
+ this.gotoPageDown = function() {
var row = this.$getPageDownRow();
var column = this.getCursorPositionScreen().column;
@@ -961,7 +1511,12 @@ var Editor = function(renderer, session) {
this.getSelection().moveCursorToScreen(row, column);
};
- this.gotoPageUp = function() {
+ /**
+ * Editor.gotoPageUp() -> Void
+ *
+ * TODO
+ **/
+ this.gotoPageUp = function() {
var row = this.$getPageUpRow();
var column = this.getCursorPositionScreen().column;
@@ -969,60 +1524,142 @@ var Editor = function(renderer, session) {
this.getSelection().moveCursorToScreen(row, column);
};
- this.scrollPageDown = function() {
+ /**
+ * Editor.scrollPageDown() -> Void
+ *
+ * TODO
+ **/
+ this.scrollPageDown = function() {
this.scrollToRow(this.$getPageDownRow());
};
- this.scrollPageUp = function() {
+ /**
+ * Editor.scrollPageUp() -> Void
+ *
+ * TODO
+ **/
+ this.scrollPageUp = function() {
this.renderer.scrollToRow(this.$getPageUpRow());
};
- this.scrollToRow = function(row) {
+ /** related to: VirtualRenderer.scrollToRow
+ * Editor.scrollToRow(row) -> Void
+ * - row (Number): The row to move to
+ *
+ * Moves the editor to the specified row.
+ *
+ **/
+ this.scrollToRow = function(row) {
this.renderer.scrollToRow(row);
};
- this.scrollToLine = function(line, center) {
+ /** related to: VirtualRenderer.scrollToLine
+ * Editor.scrollToLine(line, center) -> Void
+ * - line (Number):
+ * - center (Boolean):
+ *
+ * TODO
+ **/
+ this.scrollToLine = function(line, center) {
this.renderer.scrollToLine(line, center);
};
- this.centerSelection = function() {
+ /**
+ * Editor.centerSelection() -> Void
+ *
+ * Moves the current cursor selection to the center of the line.
+ **/
+ this.centerSelection = function() {
var range = this.getSelectionRange();
var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2);
this.renderer.scrollToLine(line, true);
};
- this.getCursorPosition = function() {
+ /** related to: Selection.getCursor
+ * Editor.getCursorPosition() -> Object
+ *
+ * Gets the current position of the cursor.
+ *
+ * #### Returns
+ *
+ * This returns an object that looks something like this:
+ *
+ * { row: currRow, column: currCol }
+ *
+ **/
+ this.getCursorPosition = function() {
return this.selection.getCursor();
};
- this.getCursorPositionScreen = function() {
+ /** related to: EditSession.documentToScreenPosition
+ * Editor.getCursorPositionScreen() -> Number
+ *
+ * TODO
+ **/
+ this.getCursorPositionScreen = function() {
return this.session.documentToScreenPosition(this.getCursorPosition());
};
- this.getSelectionRange = function() {
+ /** related to: Selection.getRange
+ * Editor.getSelectionRange() -> Range
+ *
+ * (~Selection.getRange)
+ **/
+ this.getSelectionRange = function() {
return this.selection.getRange();
};
- this.selectAll = function() {
+ /** related to: Selection.selectAll
+ * Editor.selectAll() -> Void
+ *
+ * Selects all the text in editor.
+ **/
+ this.selectAll = function() {
this.$blockScrolling += 1;
this.selection.selectAll();
this.$blockScrolling -= 1;
};
- this.clearSelection = function() {
+ /** related to: Selection.clearSelection
+ * Editor.clearSelection() -> Void
+ *
+ * (~Selection.clearSelection)
+ **/
+ this.clearSelection = function() {
this.selection.clearSelection();
};
- this.moveCursorTo = function(row, column) {
+ /** related to: Selection.moveCursorTo
+ * Editor.moveCursorTo(row, column) -> Void
+ * - row (Number): The new row number
+ * - column (Number): The new column number
+ *
+ * Moves the cursor to the specified row and column. Note that this does not de-select the current selection.
+ *
+ **/
+ this.moveCursorTo = function(row, column) {
this.selection.moveCursorTo(row, column);
};
- this.moveCursorToPosition = function(pos) {
+ /** related to: Selection.moveCursorToPosition
+ * Editor.moveCursorToPosition(pos) -> Void
+ * - pos (Object): An object with two properties, row and column
+ *
+ * Moves the cursor to the position indicated by `pos.row` and `pos.column`.
+ *
+ **/
+ this.moveCursorToPosition = function(pos) {
this.selection.moveCursorToPosition(pos);
};
- this.jumpToMatching = function() {
+ /** related to: EditSession.findMatchingBracket
+ * Editor.jumpToMatching() -> Void
+ *
+ * Moves the cursor's row and column to the next matching bracket.
+ *
+ **/
+ this.jumpToMatching = function() {
var cursor = this.getCursorPosition();
var pos = this.session.findMatchingBracket(cursor);
if (!pos) {
@@ -1040,7 +1677,15 @@ var Editor = function(renderer, session) {
}
};
- this.gotoLine = function(lineNumber, column) {
+ /**
+ * Editor.gotoLine(lineNumber, column) -> Void
+ * - lineNumber (Number): The line number to go to
+ * - column (Number): A column number to go to
+ *
+ * Moves the cursor to the specified line number, and also into the indiciated column.
+ *
+ **/
+ this.gotoLine = function(lineNumber, column) {
this.selection.clearSelection();
this.session.unfold({row: lineNumber - 1, column: column || 0});
@@ -1051,24 +1696,50 @@ var Editor = function(renderer, session) {
this.scrollToLine(lineNumber, true);
};
- this.navigateTo = function(row, column) {
+ /** related to: Editor.moveCursorTo
+ * Editor.navigateTo(row, column) -> Void
+ * - row (Number): The new row number
+ * - column (Number): The new column number
+ *
+ * Moves the cursor to the specified row and column. Note that this does de-select the current selection.
+ *
+ **/
+ this.navigateTo = function(row, column) {
this.clearSelection();
this.moveCursorTo(row, column);
};
- this.navigateUp = function(times) {
+ /**
+ * Editor.navigateUp(times) -> Void
+ * - times (Number): The number of times to change navigation
+ *
+ * Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.
+ **/
+ this.navigateUp = function(times) {
this.selection.clearSelection();
times = times || 1;
this.selection.moveCursorBy(-times, 0);
};
- this.navigateDown = function(times) {
+ /**
+ * Editor.navigateDown(times) -> Void
+ * - times (Number): The number of times to change navigation
+ *
+ * Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.
+ **/
+ this.navigateDown = function(times) {
this.selection.clearSelection();
times = times || 1;
this.selection.moveCursorBy(times, 0);
};
- this.navigateLeft = function(times) {
+ /**
+ * Editor.navigateLeft(times) -> Void
+ * - times (Number): The number of times to change navigation
+ *
+ * Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.
+ **/
+ this.navigateLeft = function(times) {
if (!this.selection.isEmpty()) {
var selectionStart = this.getSelectionRange().start;
this.moveCursorToPosition(selectionStart);
@@ -1082,7 +1753,13 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
- this.navigateRight = function(times) {
+ /**
+ * Editor.navigateRight(times) -> Void
+ * - times (Number): The number of times to change navigation
+ *
+ * Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.
+ **/
+ this.navigateRight = function(times) {
if (!this.selection.isEmpty()) {
var selectionEnd = this.getSelectionRange().end;
this.moveCursorToPosition(selectionEnd);
@@ -1096,37 +1773,72 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
- this.navigateLineStart = function() {
+ /**
+ * Editor.navigateLineStart() -> Void
+ *
+ * Moves the cursor to the start of the current line. Note that this does de-select the current selection.
+ **/
+ this.navigateLineStart = function() {
this.selection.moveCursorLineStart();
this.clearSelection();
};
- this.navigateLineEnd = function() {
+ /**
+ * Editor.navigateLineEnd() -> Void
+ *
+ * Moves the cursor to the end of the current line. Note that this does de-select the current selection.
+ **/
+ this.navigateLineEnd = function() {
this.selection.moveCursorLineEnd();
this.clearSelection();
};
- this.navigateFileEnd = function() {
+ /**
+ * Editor.navigateFileEnd() -> Void
+ *
+ * Moves the cursor to the end of the current file. Note that this does de-select the current selection.
+ **/
+ this.navigateFileEnd = function() {
this.selection.moveCursorFileEnd();
this.clearSelection();
};
- this.navigateFileStart = function() {
+ /**
+ * Editor.navigateFileStart() -> Void
+ *
+ * Moves the cursor to the start of the current file. Note that this does de-select the current selection.
+ **/
+ this.navigateFileStart = function() {
this.selection.moveCursorFileStart();
this.clearSelection();
};
- this.navigateWordRight = function() {
+ /**
+ * Editor.navigateWordRight() -> Void
+ *
+ * Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.
+ **/
+ this.navigateWordRight = function() {
this.selection.moveCursorWordRight();
this.clearSelection();
};
- this.navigateWordLeft = function() {
+ /**
+ * Editor.navigateWordLeft() -> Void
+ *
+ * Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.
+ **/
+ this.navigateWordLeft = function() {
this.selection.moveCursorWordLeft();
this.clearSelection();
};
- this.replace = function(replacement, options) {
+ /**
+ * Editor.replace(replacement, options) -> Void
+ *
+ * TODO
+ **/
+ this.replace = function(replacement, options) {
if (options)
this.$search.set(options);
@@ -1139,7 +1851,12 @@ var Editor = function(renderer, session) {
this.selection.setSelectionRange(range);
};
- this.replaceAll = function(replacement, options) {
+ /**
+ * Editor.replaceAll(replacement, options) -> Void
+ *
+ * TODO
+ **/
+ this.replaceAll = function(replacement, options) {
if (options) {
this.$search.set(options);
}
@@ -1160,7 +1877,7 @@ var Editor = function(renderer, session) {
this.$blockScrolling -= 1;
};
- this.$tryReplace = function(range, replacement) {
+ this.$tryReplace = function(range, replacement) {
var input = this.session.getTextRange(range);
replacement = this.$search.replace(input, replacement);
if (replacement !== null) {
@@ -1171,11 +1888,21 @@ var Editor = function(renderer, session) {
}
};
- this.getLastSearchOptions = function() {
+ /** related to: Search.getOptions
+ * Editor.getLastSearchOptions() -> Object
+ *
+ * (~Search.getOptions)
+ **/
+ this.getLastSearchOptions = function() {
return this.$search.getOptions();
};
- this.find = function(needle, options) {
+ /** related to: Search.find
+ * Editor.find(needle, options) -> Void
+ *
+ * TODO
+ **/
+ this.find = function(needle, options) {
this.clearSelection();
options = options || {};
options.needle = needle;
@@ -1183,7 +1910,12 @@ var Editor = function(renderer, session) {
this.$find();
};
- this.findNext = function(options) {
+ /** related to: Editor.find
+ * Editor.findNext(options) -> Void
+ *
+ * Performs another search for `needle` in the document.
+ **/
+ this.findNext = function(options) {
options = options || {};
if (typeof options.backwards == "undefined")
options.backwards = false;
@@ -1191,7 +1923,12 @@ var Editor = function(renderer, session) {
this.$find();
};
- this.findPrevious = function(options) {
+ /** related to: Editor.find
+ * Editor.findPrevious(options) -> Void
+ *
+ * Performs a search for `needle` backwards.
+ **/
+ this.findPrevious = function(options) {
options = options || {};
if (typeof options.backwards == "undefined")
options.backwards = true;
@@ -1213,15 +1950,30 @@ var Editor = function(renderer, session) {
}
};
- this.undo = function() {
+ /** related to: UndoManager.undo
+ * Editor.undo() -> Void
+ *
+ * (~UndoManager.undo)
+ **/
+ this.undo = function() {
this.session.getUndoManager().undo();
};
- this.redo = function() {
+ /** related to: UndoManager.redo
+ * Editor.redo() -> Void
+ *
+ * (~UndoManager.redo)
+ **/
+ this.redo = function() {
this.session.getUndoManager().redo();
};
- this.destroy = function() {
+ /**
+ * Editor.destroy() -> Void
+ *
+ * TODO
+ **/
+ this.destroy = function() {
this.renderer.destroy();
};
diff --git a/lib/ace/ext/static_highlight.js b/lib/ace/ext/static_highlight.js
index e62ae3b2..a3e59f80 100644
--- a/lib/ace/ext/static_highlight.js
+++ b/lib/ace/ext/static_highlight.js
@@ -44,7 +44,7 @@ var EditSession = require("../edit_session").EditSession;
var TextLayer = require("../layer/text").Text;
var baseStyles = require("../requirejs/text!./static.css");
-/** Transforms a given input code snippet into HTML using the given mode
+/* Transforms a given input code snippet into HTML using the given mode
*
* @param {string} input Code snippet
* @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode')
diff --git a/lib/ace/ext/textarea.js b/lib/ace/ext/textarea.js
index 5eea3d92..74360620 100644
--- a/lib/ace/ext/textarea.js
+++ b/lib/ace/ext/textarea.js
@@ -46,7 +46,7 @@ var ace = require("../ace");
require("ace/theme/textmate");
-/**
+/*
* Returns the CSS property of element.
* 1) If the CSS property is on the style object of the element, use it, OR
* 2) Compute the CSS property
diff --git a/lib/ace/keyboard/hash_handler.js b/lib/ace/keyboard/hash_handler.js
index 040e8de6..783d98bc 100644
--- a/lib/ace/keyboard/hash_handler.js
+++ b/lib/ace/keyboard/hash_handler.js
@@ -93,7 +93,7 @@ function HashHandler(config) {
this.$config.reverse = objectReverse.call(this, this.$config, "|");
};
- /**
+ /*
* This function is called by keyBinding.
*/
this.handleKeyboard = function(data, hashId, textOrKey, keyCode) {
diff --git a/lib/ace/keyboard/state_handler.js b/lib/ace/keyboard/state_handler.js
index 541fa1cd..8e93ba30 100644
--- a/lib/ace/keyboard/state_handler.js
+++ b/lib/ace/keyboard/state_handler.js
@@ -47,7 +47,7 @@ function StateHandler(keymapping) {
}
StateHandler.prototype = {
- /**
+ /*
* Build the RegExp from the keymapping as RegExp can't stored directly
* in the metadata JSON and as the RegExp used to match the keys/buffer
* need to be adapted.
@@ -198,7 +198,7 @@ StateHandler.prototype = {
}
},
- /**
+ /*
* This function is called by keyBinding.
*/
handleKeyboard: function(data, hashId, key, keyCode, e) {
@@ -224,7 +224,7 @@ StateHandler.prototype = {
}
}
-/**
+/*
* This is a useful matching function and therefore is defined here so that
* users of KeyboardStateMapper can use it.
*
diff --git a/lib/ace/layer/marker.js b/lib/ace/layer/marker.js
index ea31a2df..7f56b37f 100644
--- a/lib/ace/layer/marker.js
+++ b/lib/ace/layer/marker.js
@@ -111,7 +111,7 @@ var Marker = function(parentEl) {
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
};
- /**
+ /*
* Draws a marker, which spans a range of text in a single line
*/
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
@@ -137,7 +137,7 @@ var Marker = function(parentEl) {
}
};
- /**
+ /*
* Draws a multi line marker, where lines span the full width
*/
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
@@ -186,7 +186,7 @@ var Marker = function(parentEl) {
);
};
- /**
+ /*
* Draws a marker which covers one single full line
*/
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, type) {
diff --git a/lib/ace/lib/browser_focus.js b/lib/ace/lib/browser_focus.js
index fdc4e6fc..0555dd87 100644
--- a/lib/ace/lib/browser_focus.js
+++ b/lib/ace/lib/browser_focus.js
@@ -45,7 +45,7 @@ var oop = require("./oop");
var event = require("./event");
var EventEmitter = require("./event_emitter").EventEmitter;
-/**
+/*
* This class keeps track of the focus state of the given window.
* Focus changes for example when the user switches a browser tab,
* goes to the location bar or switches to another application.
diff --git a/lib/ace/lib/dom.js b/lib/ace/lib/dom.js
index 4c5af70d..d70a0c8c 100644
--- a/lib/ace/lib/dom.js
+++ b/lib/ace/lib/dom.js
@@ -63,7 +63,7 @@ exports.hasCssClass = function(el, name) {
return classes.indexOf(name) !== -1;
};
-/**
+/*
* Add a CSS class to the list of classes on the given node
*/
exports.addCssClass = function(el, name) {
@@ -72,7 +72,7 @@ exports.addCssClass = function(el, name) {
}
};
-/**
+/*
* Remove a CSS class from the list of classes on the given node
*/
exports.removeCssClass = function(el, name) {
@@ -104,7 +104,7 @@ exports.toggleCssClass = function(el, name) {
return add;
};
-/**
+/*
* Add or remove a CSS class from the list of classes on the given node
* depending on the value of include
*/
@@ -255,7 +255,7 @@ exports.scrollbarWidth = function(document) {
return noScrollbar-withScrollbar;
};
-/**
+/*
* Optimized set innerHTML. This is faster than plain innerHTML if the element
* already contains a lot of child elements.
*
diff --git a/lib/ace/lib/es5-shim.js b/lib/ace/lib/es5-shim.js
index bbd39f99..9c477f22 100644
--- a/lib/ace/lib/es5-shim.js
+++ b/lib/ace/lib/es5-shim.js
@@ -26,7 +26,7 @@
define(function(require, exports, module) {
-/**
+/*
* Brings an environment as close to ECMAScript 5 compliance
* as is possible with the facilities of erstwhile engines.
*
diff --git a/lib/ace/lib/event.js b/lib/ace/lib/event.js
index a09f9359..164cdd33 100644
--- a/lib/ace/lib/event.js
+++ b/lib/ace/lib/event.js
@@ -64,7 +64,7 @@ exports.removeListener = function(elem, type, callback) {
}
};
-/**
+/*
* Prevents propagation and clobbers the default action of the passed event
*/
exports.stopEvent = function(e) {
@@ -103,7 +103,7 @@ exports.getDocumentY = function(e) {
}
};
-/**
+/*
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
*/
exports.getButton = function(e) {
diff --git a/lib/ace/lib/keys.js b/lib/ace/lib/keys.js
index 0e17d547..e5121fb1 100644
--- a/lib/ace/lib/keys.js
+++ b/lib/ace/lib/keys.js
@@ -36,7 +36,7 @@ define(function(require, exports, module) {
var oop = require("./oop");
-/**
+/*
* Helper functions and hashes for key handling.
*/
var Keys = (function() {
diff --git a/lib/ace/lib/lang.js b/lib/ace/lib/lang.js
index 2d1b4f98..c8b7afa3 100644
--- a/lib/ace/lib/lang.js
+++ b/lib/ace/lib/lang.js
@@ -101,7 +101,7 @@ exports.arrayToMap = function(arr) {
};
-/**
+/*
* splice out of 'array' anything that === 'value'
*/
exports.arrayRemove = function(array, value) {
diff --git a/lib/ace/lib/net.js b/lib/ace/lib/net.js
index 692aead0..8712b93c 100644
--- a/lib/ace/lib/net.js
+++ b/lib/ace/lib/net.js
@@ -1,4 +1,4 @@
-/**
+/*
* based on code from:
*
* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
diff --git a/lib/ace/lib/regexp.js b/lib/ace/lib/regexp.js
index 09e2bb7e..e83596cc 100644
--- a/lib/ace/lib/regexp.js
+++ b/lib/ace/lib/regexp.js
@@ -1,4 +1,4 @@
-/**
+/*
* Based on code from:
*
* XRegExp 1.5.0
diff --git a/lib/ace/lib/useragent.js b/lib/ace/lib/useragent.js
index 8b5a0577..dfb51212 100644
--- a/lib/ace/lib/useragent.js
+++ b/lib/ace/lib/useragent.js
@@ -41,13 +41,13 @@ define(function(require, exports, module) {
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
var ua = navigator.userAgent;
-/** Is the user using a browser that identifies itself as Windows */
+// Is the user using a browser that identifies itself as Windows
exports.isWin = (os == "win");
-/** Is the user using a browser that identifies itself as Mac OS */
+// Is the user using a browser that identifies itself as Mac OS
exports.isMac = (os == "mac");
-/** Is the user using a browser that identifies itself as Linux */
+// Is the user using a browser that identifies itself as Linux
exports.isLinux = (os == "linux");
exports.isIE =
@@ -56,16 +56,16 @@ exports.isIE =
exports.isOldIE = exports.isIE && exports.isIE < 9;
-/** Is this Firefox or related? */
+// Is this Firefox or related?
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
-/** oldGecko == rev < 2.0 **/
+// oldGecko == rev < 2.0
exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4;
-/** Is this Opera */
+// Is this Opera
exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
-/** Is the user using a browser that identifies itself as WebKit */
+// Is the user using a browser that identifies itself as WebKit
exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
@@ -76,7 +76,7 @@ exports.isIPad = ua.indexOf("iPad") >= 0;
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
-/**
+/*
* I hate doing this, but we need some way to determine if the user is on a Mac
* The reason is that users have different expectations of their key combinations.
*
@@ -89,7 +89,7 @@ exports.OS = {
WINDOWS: "WINDOWS"
};
-/**
+/*
* Return an exports.OS constant
*/
exports.getOS = function() {
diff --git a/lib/ace/mode/coffee/helpers.js b/lib/ace/mode/coffee/helpers.js
index c03611e2..7133fd75 100644
--- a/lib/ace/mode/coffee/helpers.js
+++ b/lib/ace/mode/coffee/helpers.js
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2011 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
diff --git a/lib/ace/mode/coffee/lexer.js b/lib/ace/mode/coffee/lexer.js
index e06066f4..23526873 100644
--- a/lib/ace/mode/coffee/lexer.js
+++ b/lib/ace/mode/coffee/lexer.js
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2011 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
diff --git a/lib/ace/mode/coffee/nodes.js b/lib/ace/mode/coffee/nodes.js
index 0fb53135..207b1f9d 100644
--- a/lib/ace/mode/coffee/nodes.js
+++ b/lib/ace/mode/coffee/nodes.js
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2011 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
diff --git a/lib/ace/mode/coffee/parser.js b/lib/ace/mode/coffee/parser.js
index 8f90c442..80b88834 100644
--- a/lib/ace/mode/coffee/parser.js
+++ b/lib/ace/mode/coffee/parser.js
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2011 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
diff --git a/lib/ace/mode/coffee/rewriter.js b/lib/ace/mode/coffee/rewriter.js
index 3e71f078..415d01c1 100644
--- a/lib/ace/mode/coffee/rewriter.js
+++ b/lib/ace/mode/coffee/rewriter.js
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2011 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
diff --git a/lib/ace/mode/coffee/scope.js b/lib/ace/mode/coffee/scope.js
index 2015c42d..0215cb6d 100644
--- a/lib/ace/mode/coffee/scope.js
+++ b/lib/ace/mode/coffee/scope.js
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2011 Jeremy Ashkenas
*
* Permission is hereby granted, free of charge, to any person
diff --git a/lib/ace/mode/css/csslint.js b/lib/ace/mode/css/csslint.js
index 2c80f22c..b93d085f 100644
--- a/lib/ace/mode/css/csslint.js
+++ b/lib/ace/mode/css/csslint.js
@@ -49,7 +49,7 @@ THE SOFTWARE.
var parserlib = {};
(function(){
-/**
+/*
* A generic base to inherit from for any object
* that needs event handling.
* @class EventTarget
@@ -57,7 +57,7 @@ var parserlib = {};
*/
function EventTarget(){
- /**
+ /*
* The array of listeners for various events.
* @type Object
* @property _listeners
@@ -71,7 +71,7 @@ EventTarget.prototype = {
//restore constructor
constructor: EventTarget,
- /**
+ /*
* Adds a listener for a given event type.
* @param {String} type The type of event to add a listener for.
* @param {Function} listener The function to call when the event occurs.
@@ -86,7 +86,7 @@ EventTarget.prototype = {
this._listeners[type].push(listener);
},
- /**
+ /*
* Fires an event based on the passed-in object.
* @param {Object|String} event An object with at least a 'type' attribute
* or a string indicating the event name.
@@ -115,7 +115,7 @@ EventTarget.prototype = {
}
},
- /**
+ /*
* Removes a listener for a given event type.
* @param {String} type The type of event to remove a listener from.
* @param {Function} listener The function to remove from the event.
@@ -136,7 +136,7 @@ EventTarget.prototype = {
}
}
};
-/**
+/*
* Convenient way to read through strings.
* @namespace parserlib.util
* @class StringReader
@@ -145,7 +145,7 @@ EventTarget.prototype = {
*/
function StringReader(text){
- /**
+ /*
* The input text with line endings normalized.
* @property _input
* @type String
@@ -154,7 +154,7 @@ function StringReader(text){
this._input = text.replace(/\n\r?/g, "\n");
- /**
+ /*
* The row for the character to be read next.
* @property _line
* @type int
@@ -163,7 +163,7 @@ function StringReader(text){
this._line = 1;
- /**
+ /*
* The column for the character to be read next.
* @property _col
* @type int
@@ -171,7 +171,7 @@ function StringReader(text){
*/
this._col = 1;
- /**
+ /*
* The index of the character in the input to be read next.
* @property _cursor
* @type int
@@ -189,7 +189,7 @@ StringReader.prototype = {
// Position info
//-------------------------------------------------------------------------
- /**
+ /*
* Returns the column of the character to be read next.
* @return {int} The column of the character to be read next.
* @method getCol
@@ -198,7 +198,7 @@ StringReader.prototype = {
return this._col;
},
- /**
+ /*
* Returns the row of the character to be read next.
* @return {int} The row of the character to be read next.
* @method getLine
@@ -207,7 +207,7 @@ StringReader.prototype = {
return this._line ;
},
- /**
+ /*
* Determines if you're at the end of the input.
* @return {Boolean} True if there's no more input, false otherwise.
* @method eof
@@ -220,7 +220,7 @@ StringReader.prototype = {
// Basic reading
//-------------------------------------------------------------------------
- /**
+ /*
* Reads the next character without advancing the cursor.
* @param {int} count How many characters to look ahead (default is 1).
* @return {String} The next character or null if there is no next character.
@@ -240,7 +240,7 @@ StringReader.prototype = {
return c;
},
- /**
+ /*
* Reads the next character from the input and adjusts the row and column
* accordingly.
* @return {String} The next character or null if there is no next character.
@@ -272,7 +272,7 @@ StringReader.prototype = {
// Misc
//-------------------------------------------------------------------------
- /**
+ /*
* Saves the current location so it can be returned to later.
* @method mark
* @return {void}
@@ -298,7 +298,7 @@ StringReader.prototype = {
// Advanced reading
//-------------------------------------------------------------------------
- /**
+ /*
* Reads up to and including the given string. Throws an error if that
* string is not found.
* @param {String} pattern The string to read.
@@ -329,7 +329,7 @@ StringReader.prototype = {
},
- /**
+ /*
* Reads characters while each character causes the given
* filter function to return true. The function is passed
* in each character and either returns true to continue
@@ -353,7 +353,7 @@ StringReader.prototype = {
},
- /**
+ /*
* Reads characters that match either text or a regular expression and
* returns those characters. If a match is found, the row and column
* are adjusted; if no match is found, the reader's state is unchanged.
@@ -385,7 +385,7 @@ StringReader.prototype = {
},
- /**
+ /*
* Reads a given number of characters. If the end of the input is reached,
* it reads only the remaining characters and does not throw an error.
* @param {int} count The number of characters to read.
@@ -403,7 +403,7 @@ StringReader.prototype = {
}
};
-/**
+/*
* Type to use when a syntax error occurs.
* @class SyntaxError
* @namespace parserlib.util
@@ -414,21 +414,21 @@ StringReader.prototype = {
*/
function SyntaxError(message, line, col){
- /**
+ /*
* The column at which the error occurred.
* @type int
* @property col
*/
this.col = col;
- /**
+ /*
* The line at which the error occurred.
* @type int
* @property line
*/
this.line = line;
- /**
+ /*
* The text representation of the unit.
* @type String
* @property text
@@ -439,7 +439,7 @@ function SyntaxError(message, line, col){
//inherit from Error
SyntaxError.prototype = new Error();
-/**
+/*
* Base type to represent a single syntactic unit.
* @class SyntaxUnit
* @namespace parserlib.util
@@ -451,21 +451,21 @@ SyntaxError.prototype = new Error();
function SyntaxUnit(text, line, col){
- /**
+ /*
* The column of text on which the unit resides.
* @type int
* @property col
*/
this.col = col;
- /**
+ /*
* The line of text on which the unit resides.
* @type int
* @property line
*/
this.line = line;
- /**
+ /*
* The text representation of the unit.
* @type String
* @property text
@@ -474,7 +474,7 @@ function SyntaxUnit(text, line, col){
}
-/**
+/*
* Create a new syntax unit based solely on the given token.
* Convenience method for creating a new syntax unit when
* it represents a single token instead of multiple.
@@ -492,7 +492,7 @@ SyntaxUnit.prototype = {
//restore constructor
constructor: SyntaxUnit,
- /**
+ /*
* Returns the text representation of the unit.
* @return {String} The text representation of the unit.
* @method valueOf
@@ -501,7 +501,7 @@ SyntaxUnit.prototype = {
return this.toString();
},
- /**
+ /*
* Returns the text representation of the unit.
* @return {String} The text representation of the unit.
* @method toString
@@ -511,7 +511,7 @@ SyntaxUnit.prototype = {
}
};
-/**
+/*
* Generic TokenStream providing base functionality.
* @class TokenStreamBase
* @namespace parserlib.util
@@ -521,7 +521,7 @@ SyntaxUnit.prototype = {
*/
function TokenStreamBase(input, tokenData){
- /**
+ /*
* The string reader for easy access to the text.
* @type StringReader
* @property _reader
@@ -530,7 +530,7 @@ function TokenStreamBase(input, tokenData){
//this._reader = (typeof input == "string") ? new StringReader(input) : input;
this._reader = input ? new StringReader(input.toString()) : null;
- /**
+ /*
* Token object for the last consumed token.
* @type Token
* @property _token
@@ -538,7 +538,7 @@ function TokenStreamBase(input, tokenData){
*/
this._token = null;
- /**
+ /*
* The array of token information.
* @type Array
* @property _tokenData
@@ -546,7 +546,7 @@ function TokenStreamBase(input, tokenData){
*/
this._tokenData = tokenData;
- /**
+ /*
* Lookahead token buffer.
* @type Array
* @property _lt
@@ -554,7 +554,7 @@ function TokenStreamBase(input, tokenData){
*/
this._lt = [];
- /**
+ /*
* Lookahead token buffer index.
* @type int
* @property _ltIndex
@@ -565,7 +565,7 @@ function TokenStreamBase(input, tokenData){
this._ltIndexCache = [];
}
-/**
+/*
* Accepts an array of token information and outputs
* an array of token data containing key-value mappings
* and matching functions that the TokenStream needs.
@@ -613,7 +613,7 @@ TokenStreamBase.prototype = {
// Matching methods
//-------------------------------------------------------------------------
- /**
+ /*
* Determines if the next token matches the given token type.
* If so, that token is consumed; if not, the token is placed
* back onto the token stream. You can pass in any number of
@@ -649,7 +649,7 @@ TokenStreamBase.prototype = {
return false;
},
- /**
+ /*
* Determines if the next token matches the given token type.
* If so, that token is consumed; if not, an error is thrown.
* @param {int|int[]} tokenTypes Either a single token type or an array of
@@ -678,7 +678,7 @@ TokenStreamBase.prototype = {
// Consuming methods
//-------------------------------------------------------------------------
- /**
+ /*
* Keeps reading from the token stream until either one of the specified
* token types is found or until the end of the input is reached.
* @param {int|int[]} tokenTypes Either a single token type or an array of
@@ -698,7 +698,7 @@ TokenStreamBase.prototype = {
return this.LA(0);
},
- /**
+ /*
* Consumes the next token from the token stream.
* @return {int} The token type of the token that was just consumed.
* @method get
@@ -783,7 +783,7 @@ TokenStreamBase.prototype = {
}
},
- /**
+ /*
* Looks ahead a certain number of tokens and returns the token type at
* that position. This will throw an error if you lookahead past the
* end of input, past the size of the lookahead buffer, or back past
@@ -829,7 +829,7 @@ TokenStreamBase.prototype = {
},
- /**
+ /*
* Looks ahead a certain number of tokens and returns the token at
* that position. This will throw an error if you lookahead past the
* end of input, past the size of the lookahead buffer, or back past
@@ -848,7 +848,7 @@ TokenStreamBase.prototype = {
return this._lt[this._ltIndex+index-1];
},
- /**
+ /*
* Returns the token type for the next token in the stream without
* consuming it.
* @return {int} The token type of the next token in the stream.
@@ -858,7 +858,7 @@ TokenStreamBase.prototype = {
return this.LA(1);
},
- /**
+ /*
* Returns the actual token object for the last consumed token.
* @return {Token} The token object for the last consumed token.
* @method token
@@ -867,7 +867,7 @@ TokenStreamBase.prototype = {
return this._token;
},
- /**
+ /*
* Returns the name of the token for the given token type.
* @param {int} tokenType The type of token to get the name of.
* @return {String} The name of the token or "UNKNOWN_TOKEN" for any
@@ -882,7 +882,7 @@ TokenStreamBase.prototype = {
}
},
- /**
+ /*
* Returns the token type value for the given token name.
* @param {String} tokenName The name of the token whose value should be returned.
* @return {int} The token type value for the given token name or -1
@@ -893,7 +893,7 @@ TokenStreamBase.prototype = {
return this._tokenData[tokenName] || -1;
},
- /**
+ /*
* Returns the last consumed token to the token stream.
* @method unget
*/
@@ -1093,7 +1093,7 @@ var Colors = {
yellow :"#ffff00",
yellowgreen :"#9acd32"
};
-/**
+/*
* Represents a selector combinator (whitespace, +, >).
* @namespace parserlib.css
* @class Combinator
@@ -1107,7 +1107,7 @@ function Combinator(text, line, col){
SyntaxUnit.call(this, text, line, col);
- /**
+ /*
* The type of modifier.
* @type String
* @property type
@@ -1307,7 +1307,7 @@ var Level2Properties = {
"word-spacing": 1,
"z-index": 1
};
-/**
+/*
* Represents a media feature, such as max-width:500.
* @namespace parserlib.css
* @class MediaFeature
@@ -1320,14 +1320,14 @@ function MediaFeature(name, value){
SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol);
- /**
+ /*
* The name of the media feature
* @type String
* @property name
*/
this.name = name;
- /**
+ /*
* The value for the feature or null if there is none.
* @type SyntaxUnit
* @property value
@@ -1339,7 +1339,7 @@ MediaFeature.prototype = new SyntaxUnit();
MediaFeature.prototype.constructor = MediaFeature;
-/**
+/*
* Represents an individual media query.
* @namespace parserlib.css
* @class MediaQuery
@@ -1355,21 +1355,21 @@ function MediaQuery(modifier, mediaType, features, line, col){
SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType + " " : "") + features.join(" and "), line, col);
- /**
+ /*
* The media modifier ("not" or "only")
* @type String
* @property modifier
*/
this.modifier = modifier;
- /**
+ /*
* The mediaType (i.e., "print")
* @type String
* @property mediaType
*/
this.mediaType = mediaType;
- /**
+ /*
* The parts that make up the selector.
* @type Array
* @property features
@@ -1382,7 +1382,7 @@ MediaQuery.prototype = new SyntaxUnit();
MediaQuery.prototype.constructor = MediaQuery;
-/**
+/*
* A CSS3 parser.
* @namespace parserlib.css
* @class Parser
@@ -1799,7 +1799,7 @@ Parser.prototype = function(){
return this._media_feature();
},
- /**
+ /*
* Note: in CSS3 Media Queries, this is called "expression".
* Renamed here to avoid conflict with CSS3 Selectors
* definition of "expression". Also note that "expr" in the
@@ -3210,7 +3210,7 @@ Parser.prototype = function(){
// Helper methods
//-----------------------------------------------------------------
- /**
+ /*
* Not part of CSS grammar, but useful for skipping over
* combination of white space and HTML-style comments.
* @return {void}
@@ -3223,7 +3223,7 @@ Parser.prototype = function(){
}
},
- /**
+ /*
* Not part of CSS grammar, but this pattern occurs frequently
* in the official CSS grammar. Split out here to eliminate
* duplicate code.
@@ -3312,7 +3312,7 @@ Parser.prototype = function(){
},
- /**
+ /*
* In some cases, you can end up with two white space tokens in a
* row. Instead of making a change in every function that looks for
* white space, this function is used to match as much white space
@@ -3334,7 +3334,7 @@ Parser.prototype = function(){
},
- /**
+ /*
* Throws an error when an unexpected token is found.
* @param {Object} token The token that was found.
* @method _unexpectedToken
@@ -3345,7 +3345,7 @@ Parser.prototype = function(){
throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
},
- /**
+ /*
* Helper method used for parsing subparts of a style sheet.
* @return {void}
* @method _verifyEnd
@@ -3382,7 +3382,7 @@ Parser.prototype = function(){
return result;
},
- /**
+ /*
* Parses a property value (everything after the semicolon).
* @return {parserlib.css.PropertyValue} The property value.
* @throws parserlib.util.SyntaxError If an unexpected token is found.
@@ -3405,7 +3405,7 @@ Parser.prototype = function(){
return result;
},
- /**
+ /*
* Parses a complete CSS rule, including selectors and
* properties.
* @param {String} input The text to parser.
@@ -3430,7 +3430,7 @@ Parser.prototype = function(){
return result;
},
- /**
+ /*
* Parses a single CSS selector (no comma)
* @param {String} input The text to parse as a CSS selector.
* @return {Selector} An object representing the selector.
@@ -3473,7 +3473,7 @@ nth
['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S*
;
*/
-/**
+/*
* Represents a selector combinator (whitespace, +, >).
* @namespace parserlib.css
* @class PropertyName
@@ -3488,7 +3488,7 @@ function PropertyName(text, hack, line, col){
SyntaxUnit.call(this, (hack||"") + text, line, col);
- /**
+ /*
* The type of IE hack applied ("*", "_", or null).
* @type String
* @property hack
@@ -3501,7 +3501,7 @@ PropertyName.prototype = new SyntaxUnit();
PropertyName.prototype.constructor = PropertyName;
-/**
+/*
* Represents a single part of a CSS property value, meaning that it represents
* just everything single part between ":" and ";". If there are multiple values
* separated by commas, this type represents just one of the values.
@@ -3517,7 +3517,7 @@ function PropertyValue(parts, line, col){
SyntaxUnit.call(this, parts.join(" "), line, col);
- /**
+ /*
* The parts that make up the selector.
* @type Array
* @property parts
@@ -3530,7 +3530,7 @@ PropertyValue.prototype = new SyntaxUnit();
PropertyValue.prototype.constructor = PropertyValue;
-/**
+/*
* Represents a single part of a CSS property value, meaning that it represents
* just one part of the data between ":" and ";".
* @param {String} text The text representation of the unit.
@@ -3545,7 +3545,7 @@ function PropertyValuePart(text, line, col){
SyntaxUnit.apply(this,arguments);
- /**
+ /*
* Indicates the type of value unit.
* @type String
* @property type
@@ -3662,7 +3662,7 @@ function PropertyValuePart(text, line, col){
PropertyValuePart.prototype = new SyntaxUnit();
PropertyValuePart.prototype.constructor = PropertyValue;
-/**
+/*
* Create a new syntax unit based solely on the given token.
* Convenience method for creating a new syntax unit when
* it represents a single token instead of multiple.
@@ -3674,7 +3674,7 @@ PropertyValuePart.prototype.constructor = PropertyValue;
PropertyValuePart.fromToken = function(token){
return new PropertyValuePart(token.value, token.startLine, token.startCol);
};
-/**
+/*
* Represents an entire single selector, including all parts but not
* including multiple selectors (those separated by commas).
* @namespace parserlib.css
@@ -3689,7 +3689,7 @@ function Selector(parts, line, col){
SyntaxUnit.call(this, parts.join(" "), line, col);
- /**
+ /*
* The parts that make up the selector.
* @type Array
* @property parts
@@ -3702,7 +3702,7 @@ Selector.prototype = new SyntaxUnit();
Selector.prototype.constructor = Selector;
-/**
+/*
* Represents a single part of a selector string, meaning a single set of
* element name and modifiers. This does not include combinators such as
* spaces, +, >, etc.
@@ -3722,7 +3722,7 @@ function SelectorPart(elementName, modifiers, text, line, col){
SyntaxUnit.call(this, text, line, col);
- /**
+ /*
* The tag name of the element to which this part
* of the selector affects.
* @type String
@@ -3730,7 +3730,7 @@ function SelectorPart(elementName, modifiers, text, line, col){
*/
this.elementName = elementName;
- /**
+ /*
* The parts that come after the element name, such as class names, IDs,
* pseudo classes/elements, etc.
* @type Array
@@ -3744,7 +3744,7 @@ SelectorPart.prototype = new SyntaxUnit();
SelectorPart.prototype.constructor = SelectorPart;
-/**
+/*
* Represents a selector modifier string, meaning a class name, element name,
* element ID, pseudo rule, etc.
* @namespace parserlib.css
@@ -3760,14 +3760,14 @@ function SelectorSubPart(text, type, line, col){
SyntaxUnit.call(this, text, line, col);
- /**
+ /*
* The type of modifier.
* @type String
* @property type
*/
this.type = type;
- /**
+ /*
* Some subparts have arguments, this represents them.
* @type Array
* @property args
@@ -3833,7 +3833,7 @@ function mix(receiver, supplier){
//-----------------------------------------------------------------------------
-/**
+/*
* A token stream that produces CSS tokens.
* @param {String|Reader} input The source of text to tokenize.
* @constructor
@@ -3846,7 +3846,7 @@ function TokenStream(input){
TokenStream.prototype = mix(new TokenStreamBase(), {
- /**
+ /*
* Overrides the TokenStreamBase method of the same name
* to produce CSS tokens.
* @param {variant} channel The name of the channel to use
@@ -4076,7 +4076,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
// Methods to create tokens
//-------------------------------------------------------------------------
- /**
+ /*
* Produces a token based on available data and the current
* reader position information. This method is called by other
* private methods to create tokens and is never called directly.
@@ -4111,7 +4111,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
// Methods to create specific tokens
//-------------------------------------------------------------------------
- /**
+ /*
* Produces a token for any at-rule. If the at-rule is unknown, then
* the token is for a single "@" character.
* @param {String} first The first character for the token.
@@ -4152,7 +4152,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
return this.createToken(tt, rule, startLine, startCol);
},
- /**
+ /*
* Produces a character token based on the given character
* and location in the stream. If there's a special (non-standard)
* token name, this is used; otherwise CHAR is used.
@@ -4172,7 +4172,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
return this.createToken(tt, c, startLine, startCol);
},
- /**
+ /*
* Produces a character token based on the given character
* and location in the stream. If there's a special (non-standard)
* token name, this is used; otherwise CHAR is used.
@@ -4189,7 +4189,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
return this.createToken(Tokens.COMMENT, comment, startLine, startCol);
},
- /**
+ /*
* Produces a comparison token based on the given character
* and location in the stream. The next character must be
* read and is already known to be an equals sign.
@@ -4207,7 +4207,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
return this.createToken(tt, comparison, startLine, startCol);
},
- /**
+ /*
* Produces a hash token based on the specified information. The
* first character provided is the pound sign (#) and then this
* method reads a name afterward.
@@ -4224,7 +4224,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
return this.createToken(Tokens.HASH, name, startLine, startCol);
},
- /**
+ /*
* Produces a CDO or CHAR token based on the specified information. The
* first character is provided and the rest is read by the function to determine
* the correct token to create.
@@ -4249,7 +4249,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
}
},
- /**
+ /*
* Produces a CDC or CHAR token based on the specified information. The
* first character is provided and the rest is read by the function to determine
* the correct token to create.
@@ -4274,7 +4274,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
}
},
- /**
+ /*
* Produces an IDENT or FUNCTION token based on the specified information. The
* first character is provided and the rest is read by the function to determine
* the correct token to create.
@@ -4315,7 +4315,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
return this.createToken(tt, ident, startLine, startCol);
},
- /**
+ /*
* Produces an IMPORTANT_SYM or CHAR token based on the specified information. The
* first character is provided and the rest is read by the function to determine
* the correct token to create.
@@ -4376,7 +4376,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
},
- /**
+ /*
* Produces a NOT or CHAR token based on the specified information. The
* first character is provided and the rest is read by the function to determine
* the correct token to create.
@@ -4401,7 +4401,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
}
},
- /**
+ /*
* Produces a number token based on the given character
* and location in the stream. This may return a token of
* NUMBER, EMS, EXS, LENGTH, ANGLE, TIME, FREQ, DIMENSION,
@@ -4445,7 +4445,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
return this.createToken(tt, value, startLine, startCol);
},
- /**
+ /*
* Produces a string token based on the given character
* and location in the stream. Since strings may be indicated
* by single or double quotes, a failure to match starting
@@ -4535,7 +4535,7 @@ TokenStream.prototype = mix(new TokenStreamBase(), {
return this.createToken(tt, value, startLine, startCol);
},
- /**
+ /*
* Produces a S token based on the specified information. Since whitespace
* may have multiple characters, this consumes all whitespace characters
* into a single token.
@@ -5005,7 +5005,7 @@ Tokens :Tokens
};
})();
-/**
+/*
* Main CSSLint object.
* @class CSSLint
* @static
@@ -5023,7 +5023,7 @@ var CSSLint = (function(){
// Rule Management
//-------------------------------------------------------------------------
- /**
+ /*
* Adds a new rule to the engine.
* @param {Object} rule The rule to add.
* @method addRule
@@ -5033,7 +5033,7 @@ var CSSLint = (function(){
rules[rule.id] = rule;
};
- /**
+ /*
* Clears all rule from the engine.
* @method clearRules
*/
@@ -5045,7 +5045,7 @@ var CSSLint = (function(){
// Formatters
//-------------------------------------------------------------------------
- /**
+ /*
* Adds a new formatter to the engine.
* @param {Object} formatter The formatter to add.
* @method addFormatter
@@ -5055,7 +5055,7 @@ var CSSLint = (function(){
formatters[formatter.id] = formatter;
};
- /**
+ /*
* Retrieves a formatter for use.
* @param {String} formatId The name of the format to retrieve.
* @return {Object} The formatter or undefined.
@@ -5065,7 +5065,7 @@ var CSSLint = (function(){
return formatters[formatId];
};
- /**
+ /*
* Formats the results in a particular format for a single file.
* @param {Object} result The results returned from CSSLint.verify().
* @param {String} filename The filename for which the results apply.
@@ -5086,7 +5086,7 @@ var CSSLint = (function(){
return result;
}
- /**
+ /*
* Indicates if the given format is supported.
* @param {String} formatId The ID of the format to check.
* @return {Boolean} True if the format exists, false if not.
@@ -5100,7 +5100,7 @@ var CSSLint = (function(){
// Verification
//-------------------------------------------------------------------------
- /**
+ /*
* Starts the verification process for the given CSS text.
* @param {String} text The CSS text to verify.
* @param {Object} ruleset (Optional) List of rules to apply. If null, then
@@ -5155,7 +5155,7 @@ var CSSLint = (function(){
return api;
})();
-/**
+/*
* An instance of Report is used to report results of the
* verification back to the main API.
* @class Reporter
@@ -5164,21 +5164,21 @@ var CSSLint = (function(){
*/
function Reporter(lines){
- /**
+ /*
* List of messages being reported.
* @property messages
* @type String[]
*/
this.messages = [];
- /**
+ /*
* List of statistics being reported.
* @property stats
* @type String[]
*/
this.stats = [];
- /**
+ /*
* Lines of code being reported on. Used to provide contextual information
* for messages.
* @property lines
@@ -5192,7 +5192,7 @@ Reporter.prototype = {
//restore constructor
constructor: Reporter,
- /**
+ /*
* Report an error.
* @param {String} message The message to store.
* @param {int} line The line number.
@@ -5211,7 +5211,7 @@ Reporter.prototype = {
});
},
- /**
+ /*
* Report an warning.
* @param {String} message The message to store.
* @param {int} line The line number.
@@ -5230,7 +5230,7 @@ Reporter.prototype = {
});
},
- /**
+ /*
* Report some informational text.
* @param {String} message The message to store.
* @param {int} line The line number.
@@ -5249,7 +5249,7 @@ Reporter.prototype = {
});
},
- /**
+ /*
* Report some rollup error information.
* @param {String} message The message to store.
* @param {Object} rule The rule this message relates to.
@@ -5264,7 +5264,7 @@ Reporter.prototype = {
});
},
- /**
+ /*
* Report some rollup warning information.
* @param {String} message The message to store.
* @param {Object} rule The rule this message relates to.
@@ -5279,7 +5279,7 @@ Reporter.prototype = {
});
},
- /**
+ /*
* Report a statistic.
* @param {String} name The name of the stat to store.
* @param {Variant} value The value of the stat.
diff --git a/lib/ace/mode/folding/xml.js b/lib/ace/mode/folding/xml.js
index 6efa8194..5bedd44b 100644
--- a/lib/ace/mode/folding/xml.js
+++ b/lib/ace/mode/folding/xml.js
@@ -101,7 +101,7 @@ oop.inherits(FoldMode, BaseFoldMode);
};
};
- /**
+ /*
* reads a full tag and places the iterator after the tag
*/
this._readTagForward = function(iterator) {
diff --git a/lib/ace/mouse/mouse_event.js b/lib/ace/mouse/mouse_event.js
index 31c16ae7..64ee6acf 100644
--- a/lib/ace/mouse/mouse_event.js
+++ b/lib/ace/mouse/mouse_event.js
@@ -41,7 +41,7 @@ define(function(require, exports, module) {
var event = require("../lib/event");
-/**
+/*
* Custom Ace mouse event
*/
var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
@@ -78,7 +78,7 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
this.preventDefault();
};
- /**
+ /*
* Get the document position below the mouse cursor
*
* @return {Object} 'row' and 'column' of the document position
@@ -94,7 +94,7 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
return this.$pos;
};
- /**
+ /*
* Check if the mouse cursor is inside of the text selection
*
* @return {Boolean} whether the mouse cursor is inside of the selection
@@ -120,7 +120,7 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
return this.$inSelection;
};
- /**
+ /*
* Get the clicked mouse button
*
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
@@ -129,7 +129,7 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
return event.getButton(this.domEvent);
};
- /**
+ /*
* @return {Boolean} whether the shift key was pressed when the event was emitted
*/
this.getShiftKey = function() {
diff --git a/lib/ace/placeholder.js b/lib/ace/placeholder.js
index f0fa5b46..d9fc224a 100644
--- a/lib/ace/placeholder.js
+++ b/lib/ace/placeholder.js
@@ -41,6 +41,26 @@ var Range = require('./range').Range;
var EventEmitter = require("./lib/event_emitter").EventEmitter;
var oop = require("./lib/oop");
+/**
+ * class PlaceHolder
+ *
+ * TODO
+ *
+ **/
+
+/**
+ * new PlaceHolder(session, length, pos, others, mainClass, othersClass)
+ * - session (Document): The document to associate with the anchor
+ * - length (Number): The starting row position
+ * - pos (Number): The starting column position
+ * - others (String):
+ * - mainClass (String):
+ * - othersClass (String):
+ *
+ * TODO
+ *
+ **/
+
var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
var _self = this;
this.length = length;
@@ -70,6 +90,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
oop.implement(this, EventEmitter);
+ /**
+ * PlaceHolder.setup() -> Void
+ *
+ * TODO
+ *
+ **/
this.setup = function() {
var _self = this;
var doc = this.doc;
@@ -90,6 +116,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
session.setUndoSelect(false);
};
+ /**
+ * PlaceHolder.showOtherMarkers() -> Void
+ *
+ * TODO
+ *
+ **/
this.showOtherMarkers = function() {
if(this.othersActive) return;
var session = this.session;
@@ -104,6 +136,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
});
};
+ /**
+ * PlaceHolder.hideOtherMarkers() -> Void
+ *
+ * TODO
+ *
+ **/
this.hideOtherMarkers = function() {
if(!this.othersActive) return;
this.othersActive = false;
@@ -112,6 +150,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
}
};
+ /**
+ * PlaceHolder@onUpdate(e)
+ *
+ * Emitted when the place holder updates.
+ *
+ **/
this.onUpdate = function(event) {
var delta = event.data;
var range = delta.range;
@@ -174,6 +218,13 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
this.$updating = false;
};
+ /**
+ * PlaceHolder@onCursorChange(e)
+ *
+ * Emitted when the cursor changes.
+ *
+ **/
+
this.onCursorChange = function(event) {
if (this.$updating) return;
var pos = this.session.selection.getCursor();
@@ -186,6 +237,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
}
};
+ /**
+ * PlaceHolder.detach()
+ *
+ * TODO
+ *
+ **/
this.detach = function() {
this.session.removeMarker(this.markerId);
this.hideOtherMarkers();
@@ -198,6 +255,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
this.session.setUndoSelect(true);
};
+ /**
+ * PlaceHolder.cancel()
+ *
+ * TODO
+ *
+ **/
this.cancel = function() {
if(this.$undoStackDepth === -1)
throw Error("Canceling placeholders only supported with undo manager attached to session.");
diff --git a/lib/ace/range.js b/lib/ace/range.js
index 16e88f9c..a0ad29b2 100644
--- a/lib/ace/range.js
+++ b/lib/ace/range.js
@@ -38,6 +38,23 @@
define(function(require, exports, module) {
"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.
+ *
+ **/
+
+/**
+ * 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.
+ *
+ **/
var Range = function(startRow, startColumn, endRow, endColumn) {
this.start = {
row: startRow,
@@ -51,6 +68,13 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
};
(function() {
+ /**
+ * Range.isEequal(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`.
+ *
+ **/
this.isEequal = function(range) {
return this.start.row == range.start.row &&
this.end.row == range.end.row &&
@@ -58,28 +82,54 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
this.end.column == range.end.column
};
+ /**
+ * Range.toString() -> String
+ *
+ * Returns a string containing the range's row and column information, given like this:
+ *
+ * [start.row/start.column] -> [end.row/end.column]
+ *
+ **/
+
this.toString = function() {
return ("Range: [" + this.start.row + "/" + this.start.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:
+ *
+ * this.start.row <= row <= this.end.row &&
+ * this.start.column <= column <= this.end.column
+ *
+ **/
+
this.contains = function(row, column) {
return this.compare(row, column) == 0;
};
- /**
- * Compares this range (A) with another range (B), where B is the passed in
- * range.
+ /** related to: Range.compare
+ * Range.compareRange(range) -> Number
+ * - range (Range): A range to compare with
*
- * Return values:
- * -2: (B) is infront of (A) and doesn't intersect with (A)
- * -1: (B) begins before (A) but ends inside of (A)
- * 0: (B) is completly inside of (A) OR (A) is complety inside of (B)
- * +1: (B) begins inside of (A) but ends outside of (A)
- * +2: (B) is after (A) and doesn't intersect with (A)
+ * Compares `this` range (A) with another range (B).
*
- * 42: FTW state: (B) ends in (A) but starts outside of (A)
- */
+ * #### Returns
+ *
+ * This method returns one of the following numbers:
+ *
+ * * -2: (B) is in front of (A), and doesn't intersect with (A)
+ * * -1: (B) begins before (A) but ends inside of (A)
+ * * 0: (B) is completely inside of (A) OR (A) is completely inside of (B)
+ * * +1: (B) begins inside of (A) but ends outside of (A)
+ * * +2: (B) is after (A) and doesn't intersect with (A)
+ * * 42: FTW state: (B) ends in (A) but starts outside of (A)
+ *
+ **/
this.compareRange = function(range) {
var cmp,
end = range.end,
@@ -109,22 +159,74 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
+ /** 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.
+ *
+ * #### Returns
+ *
+ * * `0` if the two points are exactly equal
+ * * `-1` if `p.row` is less then the calling range
+ * * `1` if `p.row` is greater than the calling range
+ *
+ * If the starting row of the calling range is equal to `p.row`, and:
+ * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
+ * * Otherwise, it returns -1
+ *
+ * If the ending row of the calling range is equal to `p.row`, and:
+ * * `p.column` is less than or equal to the calling range's ending column, this returns `0`
+ * * Otherwise, it returns 1
+ *
+ **/
this.comparePoint = function(p) {
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.
+ *
+ **/
this.containsRange = function(range) {
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
}
+ /**
+ * 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`.
+ *
+ **/
this.isEnd = function(row, 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`.
+ *
+ **/
this.isStart = function(row, column) {
return this.start.row == row && this.start.column == column;
}
+ /**
+ * Range.setStart(row, column) -> Void
+ * - row (Number): A row point to set
+ * - column (Number): A column point to set
+ *
+ * Sets the starting row and column for the range.
+ *
+ **/
this.setStart = function(row, column) {
if (typeof row == "object") {
this.start.column = row.column;
@@ -135,6 +237,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
+ /**
+ * Range.setEnd(row, column) -> Void
+ * - row (Number): A row point to set
+ * - column (Number): A column point to set
+ *
+ * Sets the starting row and column for the range.
+ *
+ **/
this.setEnd = function(row, column) {
if (typeof row == "object") {
this.end.column = row.column;
@@ -145,6 +255,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
+ /** 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.
+ *
+ **/
this.inside = function(row, column) {
if (this.compare(row, column) == 0) {
if (this.isEnd(row, column) || this.isStart(row, column)) {
@@ -156,6 +274,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
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.
+ *
+ **/
this.insideStart = function(row, column) {
if (this.compare(row, column) == 0) {
if (this.isEnd(row, column)) {
@@ -167,6 +293,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
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.
+ *
+ **/
this.insideEnd = function(row, column) {
if (this.compare(row, column) == 0) {
if (this.isStart(row, column)) {
@@ -178,6 +312,28 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return false;
}
+ /**
+ * Range.compare(row, column) -> Number
+ * - row (Number): A row point to compare with
+ * - column (Number): A column point to compare with
+ *
+ * Checks the row and column points with the row and column points of the calling range.
+ *
+ * #### Returns
+ *
+ * * `0` if the two points are exactly equal
+ * * `-1` if `p.row` is less then the calling range
+ * * `1` if `p.row` is greater than the calling range
+ *
+ * If the starting row of the calling range is equal to `p.row`, and:
+ * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
+ * * Otherwise, it returns -1
+ *
+ * If the ending row of the calling range is equal to `p.row`, and:
+ * * `p.column` is less than or equal to the calling range's ending column, this returns `0`
+ * * Otherwise, it returns 1
+ *
+ **/
this.compare = function(row, column) {
if (!this.isMultiLine()) {
if (row === this.start.row) {
@@ -200,9 +356,28 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return 0;
};
- /**
- * Like .compare(), but if isStart is true, return -1;
- */
+ /**
+ * Range.compareStart(row, column) -> Number
+ * - row (Number): A row point to compare with
+ * - column (Number): A column point to compare with
+ *
+ * Checks the row and column points with the row and column points of the calling range.
+ *
+ * #### Returns
+ *
+ * * `0` if the two points are exactly equal
+ * * `-1` if `p.row` is less then the calling range
+ * * `1` if `p.row` is greater than the calling range, or if `isStart` is `true.
+ *
+ * If the starting row of the calling range is equal to `p.row`, and:
+ * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
+ * * Otherwise, it returns -1
+ *
+ * If the ending row of the calling range is equal to `p.row`, and:
+ * * `p.column` is less than or equal to the calling range's ending column, this returns `0`
+ * * Otherwise, it returns 1
+ *
+ **/
this.compareStart = function(row, column) {
if (this.start.row == row && this.start.column == column) {
return -1;
@@ -211,9 +386,28 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
- /**
- * Like .compare(), but if isEnd is true, return 1;
- */
+ /**
+ * Range.compareEnd(row, column) -> Number
+ * - row (Number): A row point to compare with
+ * - column (Number): A column point to compare with
+ *
+ * Checks the row and column points with the row and column points of the calling range.
+ *
+ * #### Returns
+ *
+ * * `0` if the two points are exactly equal
+ * * `-1` if `p.row` is less then the calling range
+ * * `1` if `p.row` is greater than the calling range, or if `isEnd` is `true.
+ *
+ * If the starting row of the calling range is equal to `p.row`, and:
+ * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`
+ * * Otherwise, it returns -1
+ *
+ * If the ending row of the calling range is equal to `p.row`, and:
+ * * `p.column` is less than or equal to the calling range's ending column, this returns `0`
+ * * Otherwise, it returns 1
+ *
+ **/
this.compareEnd = function(row, column) {
if (this.end.row == row && this.end.column == column) {
return 1;
@@ -222,6 +416,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
+ /**
+ * Range.compareInside(row, column) -> Number
+ * - row (Number): A row point to compare with
+ * - column (Number): A column point to compare with
+ *
+ * Checks the row and column points with the row and column points of the calling range.
+ *
+ * #### Returns
+ *
+ * * `1` if the ending row of the calling range is equal to `row`, and the ending column of the calling range is equal to `column`
+ * * `-1` if the starting row of the calling range is equal to `row`, and the starting column of the calling range is equal to `column`
+ *
+ * Otherwise, it returns the value after calling [[Range.compare `compare()`]].
+ *
+ **/
this.compareInside = function(row, column) {
if (this.end.row == row && this.end.column == column) {
return 1;
@@ -232,6 +441,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
+ /**
+ * Range.clipRows(firstRow, lastRow) -> Range
+ * - firstRow (Number):
+ * - lastRow (Number):
+ *
+ * TODO
+ *
+ **/
this.clipRows = function(firstRow, lastRow) {
if (this.end.row > lastRow) {
var end = {
@@ -263,6 +480,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return Range.fromPoints(start || this.start, end || this.end);
};
+ /**
+ * Range.extend(row, column) -> Range
+ * - row (Number): A new row to extend to
+ * - column (Number): 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.
+ *
+ **/
this.extend = function(row, column) {
var cmp = this.compare(row, column);
@@ -276,18 +501,42 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return Range.fromPoints(start || this.start, end || this.end);
};
+ /**
+ * Range.isEmpty() -> Boolean
+ *
+ * Checks if the range is empty; that is, the starting and ending points for row and column are equivalent. Returns `true` if the range is indeed empty.
+ *
+ **/
this.isEmpty = function() {
return (this.start.row == this.end.row && this.start.column == this.end.column);
};
+ /**
+ * Range.isMultiLine() -> Boolean
+ *
+ * Returns true if the range spans across multiple lines.
+ *
+ **/
this.isMultiLine = function() {
return (this.start.row !== this.end.row);
};
+ /**
+ * Range.clone() -> Range
+ *
+ * Returns a duplicate of the calling range.
+ *
+ **/
this.clone = function() {
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`.
+ *
+ **/
this.collapseRows = function() {
if (this.end.column == 0)
return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
@@ -295,6 +544,12 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return new Range(this.start.row, 0, this.end.row, 0)
};
+ /**
+ * Range.toScreenRange() -> Range
+ *
+ * TODO
+ *
+ **/
this.toScreenRange = function(session) {
var screenPosStart =
session.documentToScreenPosition(this.start);
@@ -309,7 +564,14 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}).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.
+ *
+**/
Range.fromPoints = function(start, end) {
return new Range(start.row, start.column, end.row, end.column);
};
diff --git a/lib/ace/renderloop.js b/lib/ace/renderloop.js
index 9a754c52..c5701393 100644
--- a/lib/ace/renderloop.js
+++ b/lib/ace/renderloop.js
@@ -41,6 +41,19 @@ define(function(require, exports, module) {
var event = require("./lib/event");
+/**
+ * class RenderLoop
+ *
+ * TODO
+ *
+ **/
+
+/**
+ * new RenderLoop(onRender, win)
+ *
+ * TODO
+ *
+**/
var RenderLoop = function(onRender, win) {
this.onRender = onRender;
this.pending = false;
@@ -50,6 +63,12 @@ var RenderLoop = function(onRender, win) {
(function() {
+ /**
+ * RenderLoop.schedule(change) -> Void
+ * - change (Array):
+ *
+ * TODO
+ **/
this.schedule = function(change) {
//this.onRender(change);
//return;
diff --git a/lib/ace/requirejs/text.js b/lib/ace/requirejs/text.js
index eb056456..f9b5976d 100644
--- a/lib/ace/requirejs/text.js
+++ b/lib/ace/requirejs/text.js
@@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
-/**
+/*
* Extremely simplified version of the requireJS text plugin
*/
diff --git a/lib/ace/scrollbar.js b/lib/ace/scrollbar.js
index 27b83fee..26e9becd 100644
--- a/lib/ace/scrollbar.js
+++ b/lib/ace/scrollbar.js
@@ -44,6 +44,20 @@ var dom = require("./lib/dom");
var event = require("./lib/event");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
+/**
+ * class ScrollBar
+ *
+ * A set of methods for setting and retrieving the editor's scrollbar.
+ *
+ **/
+
+/**
+ * new ScrollBar(parent)
+ * - parent (TODO)
+ *
+ * Creates a new `ScrollBar`.
+ *
+ **/
var ScrollBar = function(parent) {
this.element = dom.createElement("div");
this.element.className = "ace_sb";
@@ -67,22 +81,55 @@ var ScrollBar = function(parent) {
(function() {
oop.implement(this, EventEmitter);
+ /**
+ * ScrollBar@onScroll
+ *
+ * Emitted when the scroll bar, well, scrolls.
+ *
+ **/
this.onScroll = function() {
this._emit("scroll", {data: this.element.scrollTop});
};
+ /**
+ * ScrollBar.getWidth() -> Number
+ *
+ * Returns the width of the scroll bar.
+ *
+ **/
this.getWidth = function() {
return this.width;
};
+ /**
+ * ScrollBar.setHeight(height) -> Void
+ * - height (Number): The new height
+ *
+ * Sets the height of the scroll bar, in pixels.
+ *
+ **/
this.setHeight = function(height) {
this.element.style.height = height + "px";
};
+ /**
+ * ScrollBar.setInnerHeight(height) -> Void
+ * - height (Number): The new inner height
+ *
+ * Sets the inner height of the scroll bar, in pixels.
+ *
+ **/
this.setInnerHeight = function(height) {
this.inner.style.height = height + "px";
};
+ /**
+ * ScrollBar.setScrollTop(scrollTop) -> Void
+ * - scrollTop (Number): The new scroll top
+ *
+ * Sets the scroll top of the scroll bar.
+ *
+ **/
this.setScrollTop = function(scrollTop) {
this.element.scrollTop = scrollTop;
};
diff --git a/lib/ace/search.js b/lib/ace/search.js
index c15d0b16..6ad81b7f 100644
--- a/lib/ace/search.js
+++ b/lib/ace/search.js
@@ -44,6 +44,28 @@ var lang = require("./lib/lang");
var oop = require("./lib/oop");
var Range = require("./range").Range;
+/**
+ * class Search
+ *
+ * TODO
+ *
+ **/
+
+/**
+ * new Search()
+ *
+ * Creates a new `Search` object. The search options contain the following defaults:
+ *
+ * * `needle`: `""`
+ * * `backwards`: `false`
+ * * `wrap`: `false`
+ * * `caseSensitive`: `false`
+ * * `wholeWord`: `false`
+ * * `scope`: `ALL`
+ * * `regExp`: `false`
+ *
+**/
+
var Search = function() {
this.$options = {
needle: "",
@@ -61,15 +83,35 @@ Search.SELECTION = 2;
(function() {
+ /**
+ * Search.set(options) -> Search
+ * - options (Object): An object containing all the new search properties
+ *
+ * Sets the search options via the `options` parameter.
+ *
+ **/
this.set = function(options) {
oop.mixin(this.$options, options);
return this;
};
-
+
+ /**
+ * Search.getOptions() -> Object
+ *
+ * [Returns an object containing all the search options.](~Search.getOptions)
+ *
+ **/
this.getOptions = function() {
return lang.copyObject(this.$options);
};
+ /**
+ * Search.find(session) -> Range | null
+ * - 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.
+ *
+ **/
this.find = function(session) {
if (!this.$options.needle)
return null;
@@ -89,6 +131,13 @@ Search.SELECTION = 2;
return firstRange;
};
+ /**
+ * Search.findAll(session) -> Array | null
+ * - session (EditSession): The session to search with
+ *
+ * Searches for all occurances `options.needle`. If found, this method returns an array of [[Range `Range`s]] where the text first occurs. If `options.backwards` is `true`, the search goes backwards in the session.
+ *
+ **/
this.findAll = function(session) {
var options = this.$options;
if (!options.needle)
@@ -115,6 +164,20 @@ Search.SELECTION = 2;
return ranges;
};
+ /**
+ * Search.replace(input, replacement) -> String | null
+ * - input (String): The text to search in
+ * - replacement (String): The replacing text
+ *
+ * Searches for `options.needle` in `input`, and, if found, replaces it with `replacement`.
+ *
+ * #### Returns
+ *
+ * If `options.regExp` is `true`, this function returns `input` with the replacement already made. Otherwise, this function just returns `replacement`.
+ *
+ * If `options.needle` was not found, this function returns `null`.
+ *
+ **/
this.replace = function(input, replacement) {
var re = this.$assembleRegExp();
var match = re.exec(input);
@@ -129,6 +192,13 @@ Search.SELECTION = 2;
}
};
+ /**
+ * Search.$forwardMatchIterator(session) -> String | Boolean
+ * - session (EditSession): The session to search with
+ *
+ * TODO--not doing the below $ signs, they look internal
+ *
+ **/
this.$forwardMatchIterator = function(session) {
var re = this.$assembleRegExp();
var self = this;
@@ -163,6 +233,13 @@ Search.SELECTION = 2;
};
};
+ /**
+ * Search.$backwardMatchIterator(session) -> String | null
+ * - session (EditSession): The session to search with
+ *
+ * TODO
+ *
+ **/
this.$backwardMatchIterator = function(session) {
var re = this.$assembleRegExp();
var self = this;
diff --git a/lib/ace/selection.js b/lib/ace/selection.js
index 810a0289..36cad630 100644
--- a/lib/ace/selection.js
+++ b/lib/ace/selection.js
@@ -45,12 +45,20 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
var Range = require("./range").Range;
/**
- * Keeps cursor position and the text selection of an edit session.
+ * class Selection
*
- * 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.
- */
+ * 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.
+ **/
+
+/**
+ * new Selection(session)
+ * - session (EditSession): The session to use
+ *
+ * Creates a new `Selection` object.
+ *
+**/
var Selection = function(session) {
this.session = session;
this.doc = session.getDocument();
@@ -78,14 +86,24 @@ var Selection = function(session) {
oop.implement(this, EventEmitter);
- this.isEmpty = function() {
+ /**
+ * Selection.isEmpty() -> Boolean
+ *
+ * Returns `true` if the selection is empty.
+ **/
+ this.isEmpty = function() {
return (this.$isEmpty || (
this.selectionAnchor.row == this.selectionLead.row &&
this.selectionAnchor.column == this.selectionLead.column
));
};
- this.isMultiLine = function() {
+ /**
+ * Selection.isMultiLine() -> Boolean
+ *
+ * Returns `true` if the selection is a multi-line.
+ **/
+ this.isMultiLine = function() {
if (this.isEmpty()) {
return false;
}
@@ -93,11 +111,23 @@ var Selection = function(session) {
return this.getRange().isMultiLine();
};
- this.getCursor = function() {
+ /**
+ * Selection.getCursor() -> Number
+ *
+ * Gets the current position of the cursor.
+ **/
+ this.getCursor = function() {
return this.selectionLead.getPosition();
};
- this.setSelectionAnchor = function(row, column) {
+ /**
+ * Selection.setSelectionAnchor(row, column) -> Void
+ * - 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.
+ **/
+ this.setSelectionAnchor = function(row, column) {
this.selectionAnchor.setPosition(row, column);
if (this.$isEmpty) {
@@ -106,18 +136,36 @@ var Selection = function(session) {
}
};
- this.getSelectionAnchor = function() {
+ /** related to: Anchor.getPosition
+ * Selection.getSelectionAnchor() -> Object
+ *
+ * Returns an object containing the `row` and `column` of the calling selection anchor.
+ *
+ **/
+ this.getSelectionAnchor = function() {
if (this.$isEmpty)
return this.getSelectionLead()
else
return this.selectionAnchor.getPosition();
};
- this.getSelectionLead = function() {
+ /** related to: Lead.getPosition
+ * Selection.getSelectionLead() -> Object
+ *
+ * Returns an object containing the `row` and `column` of the calling selection lead.
+ **/
+ this.getSelectionLead = function() {
return this.selectionLead.getPosition();
};
- this.shiftSelection = function(columns) {
+ /**
+ * Selection.shiftSelection(columns) -> Void
+ * - columns (Number): The number of columns to shift by
+ *
+ * TODO
+ *
+ **/
+ this.shiftSelection = function(columns) {
if (this.$isEmpty) {
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
return;
@@ -138,13 +186,23 @@ var Selection = function(session) {
}
};
- this.isBackwards = function() {
+ /**
+ * Selection.isBackwards() -> Boolean
+ *
+ * Returns `true` if the selection is going backwards in the document.
+ **/
+ this.isBackwards = function() {
var anchor = this.selectionAnchor;
var lead = this.selectionLead;
return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
};
- this.getRange = function() {
+ /**
+ * Selection.getRange() -> Range
+ *
+ * [Returns the [[Range `Range`]] for the selected text.](~Selection.getRange)
+ **/
+ this.getRange = function() {
var anchor = this.selectionAnchor;
var lead = this.selectionLead;
@@ -159,20 +217,38 @@ var Selection = function(session) {
}
};
- this.clearSelection = function() {
+ /**
+ * Selection.clearSelection() -> Void
+ *
+ * [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.](~Selection.clearSelection)
+ **/
+ this.clearSelection = function() {
if (!this.$isEmpty) {
this.$isEmpty = true;
this._emit("changeSelection");
}
};
- this.selectAll = function() {
+ /**
+ * Selection.selectAll() -> Void
+ *
+ * Selects all the text in the document.
+ **/
+ this.selectAll = function() {
var lastRow = this.doc.getLength() - 1;
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
this.moveCursorTo(0, 0);
};
- this.setSelectionRange = function(range, reverse) {
+ /**
+ * Selection.setSelectionRange(range, reverse) -> Void
+ * - 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.
+ *
+ **/
+ this.setSelectionRange = function(range, reverse) {
if (reverse) {
this.setSelectionAnchor(range.end.row, range.end.column);
this.selectTo(range.start.row, range.start.column);
@@ -196,72 +272,151 @@ var Selection = function(session) {
mover.call(this);
};
- this.selectTo = function(row, column) {
+ /**
+ * Selection.selectTo(row, column) -> Void
+ * - row (Number): The row to select to
+ * - column (Number): The column to select to
+ *
+ * Moves the selection cursor to the indicated row and column.
+ *
+ **/
+ this.selectTo = function(row, column) {
this.$moveSelection(function() {
this.moveCursorTo(row, column);
});
};
- this.selectToPosition = function(pos) {
+ /**
+ * Selection.selectToPosition(pos) -> Void
+ * - pos (Object): An object containing the row and column
+ *
+ * Moves the selection cursor to the row and column indicated by `pos`.
+ *
+ **/
+ this.selectToPosition = function(pos) {
this.$moveSelection(function() {
this.moveCursorToPosition(pos);
});
};
- this.selectUp = function() {
+ /**
+ * Selection.selectUp() -> Void
+ *
+ * Moves the selection up one row.
+ **/
+ this.selectUp = function() {
this.$moveSelection(this.moveCursorUp);
};
- this.selectDown = function() {
+ /**
+ * Selection.selectDown() -> Void
+ *
+ * Moves the selection down one row.
+ **/
+ this.selectDown = function() {
this.$moveSelection(this.moveCursorDown);
};
- this.selectRight = function() {
+ /**
+ * Selection.selectRight() -> Void
+ *
+ * Moves the selection right one column.
+ **/
+ this.selectRight = function() {
this.$moveSelection(this.moveCursorRight);
};
- this.selectLeft = function() {
+ /**
+ * Selection.selectLeft() -> Void
+ *
+ * Moves the selection left one column.
+ **/
+ this.selectLeft = function() {
this.$moveSelection(this.moveCursorLeft);
};
- this.selectLineStart = function() {
+ /**
+ * Selection.selectLineStart() -> Void
+ *
+ * Moves the selection to the beginning of the current line.
+ **/
+ this.selectLineStart = function() {
this.$moveSelection(this.moveCursorLineStart);
};
- this.selectLineEnd = function() {
+ /**
+ * Selection.selectLineEnd() -> Void
+ *
+ * Moves the selection to the end of the current line.
+ **/
+ this.selectLineEnd = function() {
this.$moveSelection(this.moveCursorLineEnd);
};
- this.selectFileEnd = function() {
+ /**
+ * Selection.selectFileEnd() -> Void
+ *
+ * Moves the selection to the end of the file.
+ **/
+ this.selectFileEnd = function() {
this.$moveSelection(this.moveCursorFileEnd);
};
- this.selectFileStart = function() {
+ /**
+ * Selection.selectFileStart() -> Void
+ *
+ * Moves the selection to the start of the file.
+ **/
+ this.selectFileStart = function() {
this.$moveSelection(this.moveCursorFileStart);
};
- this.selectWordRight = function() {
+ /**
+ * Selection.selectWordRight() -> Void
+ *
+ * Moves the selection to the first word on the right.
+ **/
+ this.selectWordRight = function() {
this.$moveSelection(this.moveCursorWordRight);
};
- this.selectWordLeft = function() {
+ /**
+ * Selection.selectWordLeft() -> Void
+ *
+ * Moves the selection to the first word on the left.
+ **/
+ this.selectWordLeft = function() {
this.$moveSelection(this.moveCursorWordLeft);
};
- this.selectWord = function() {
+ /** related to: EditSession.getWordRange
+ * Selection.selectWord() -> Void
+ *
+ * Moves the selection to highlight the entire word.
+ **/
+ this.selectWord = function() {
var cursor = this.getCursor();
var range = this.session.getWordRange(cursor.row, cursor.column);
this.setSelectionRange(range);
};
- // Selects a word including its right whitespace
- this.selectAWord = function() {
+ /** related to: EditSession.getAWordRange
+ * Selection.selectAWord() -> Void
+ *
+ * Selects a word, including its right whitespace.
+ **/
+ this.selectAWord = function() {
var cursor = this.getCursor();
var range = this.session.getAWordRange(cursor.row, cursor.column);
this.setSelectionRange(range);
};
- this.selectLine = function() {
+ /**
+ * Selection.selectLine() -> Void
+ *
+ * Selects the entire line.
+ **/
+ this.selectLine = function() {
var rowStart = this.selectionLead.row;
var rowEnd;
@@ -278,15 +433,30 @@ var Selection = function(session) {
});
};
- this.moveCursorUp = function() {
+ /**
+ * Selection.moveCursorUp() -> Void
+ *
+ * Moves the cursor up one row.
+ **/
+ this.moveCursorUp = function() {
this.moveCursorBy(-1, 0);
};
- this.moveCursorDown = function() {
+ /**
+ * Selection.moveCursorDown() -> Void
+ *
+ * Moves the cursor down one row.
+ **/
+ this.moveCursorDown = function() {
this.moveCursorBy(1, 0);
};
- this.moveCursorLeft = function() {
+ /**
+ * Selection.moveCursorLeft() -> Void
+ *
+ * Moves the cursor left one column.
+ **/
+ this.moveCursorLeft = function() {
var cursor = this.selectionLead.getPosition(),
fold;
@@ -307,7 +477,12 @@ var Selection = function(session) {
}
};
- this.moveCursorRight = function() {
+ /**
+ * Selection.moveCursorRight() -> Void
+ *
+ * Moves the cursor right one column.
+ **/
+ this.moveCursorRight = function() {
var cursor = this.selectionLead.getPosition(),
fold;
if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
@@ -328,7 +503,12 @@ var Selection = function(session) {
}
};
- this.moveCursorLineStart = function() {
+ /**
+ * Selection.moveCursorLineStart() -> Void
+ *
+ * Moves the cursor to the start of the line.
+ **/
+ this.moveCursorLineStart = function() {
var row = this.selectionLead.row;
var column = this.selectionLead.column;
var screenRow = this.session.documentToScreenRow(row, column);
@@ -356,7 +536,12 @@ var Selection = function(session) {
}
};
- this.moveCursorLineEnd = function() {
+ /**
+ * Selection.moveCursorLineEnd() -> Void
+ *
+ * Moves the cursor to the end of the line.
+ **/
+ this.moveCursorLineEnd = function() {
var lead = this.selectionLead;
var lastRowColumnPosition =
this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
@@ -366,17 +551,32 @@ var Selection = function(session) {
);
};
- this.moveCursorFileEnd = function() {
+ /**
+ * Selection.moveCursorFileEnd() -> Void
+ *
+ * Moves the cursor to the end of the file.
+ **/
+ this.moveCursorFileEnd = function() {
var row = this.doc.getLength() - 1;
var column = this.doc.getLine(row).length;
this.moveCursorTo(row, column);
};
- this.moveCursorFileStart = function() {
+ /**
+ * Selection.moveCursorFileStart() -> Void
+ *
+ * Moves the cursor to the start of the file.
+ **/
+ this.moveCursorFileStart = function() {
this.moveCursorTo(0, 0);
};
- this.moveCursorWordRight = function() {
+ /**
+ * Selection.moveCursorWordRight() -> Void
+ *
+ * Moves the cursor to the word on the right.
+ **/
+ this.moveCursorWordRight = function() {
var row = this.selectionLead.row;
var column = this.selectionLead.column;
var line = this.doc.getLine(row);
@@ -418,7 +618,12 @@ var Selection = function(session) {
this.moveCursorTo(row, column);
};
- this.moveCursorWordLeft = function() {
+ /**
+ * Selection.moveCursorWordLeft() -> Void
+ *
+ * Moves the cursor to the word on the left.
+ **/
+ this.moveCursorWordLeft = function() {
var row = this.selectionLead.row;
var column = this.selectionLead.column;
@@ -464,7 +669,14 @@ var Selection = function(session) {
this.moveCursorTo(row, column);
};
- this.moveCursorBy = function(rows, chars) {
+ /** related to: EditSession.documentToScreenPosition
+ * Selection.moveCursorBy(rows, chars) -> Void
+ * - rows (Number): The number of rows to move by
+ * - chars (Number): 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.
+ **/
+ this.moveCursorBy = function(rows, chars) {
var screenPos = this.session.documentToScreenPosition(
this.selectionLead.row,
this.selectionLead.column
@@ -477,11 +689,25 @@ var Selection = function(session) {
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
};
- this.moveCursorToPosition = function(position) {
+ /**
+ * Selection.moveCursorToPosition(position) -> Void
+ * - position (Object): The position to move to
+ *
+ * Moves the selection to the position indicated by its `row` and `column`.
+ **/
+ this.moveCursorToPosition = function(position) {
this.moveCursorTo(position.row, position.column);
};
- this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
+ /**
+ * Selection.moveCursorTo(row, column, preventUpdateDesiredColumn) -> Void
+ * - row (Number): The row to move to
+ * - column (Number): The column to move to
+ * - preventUpdateDesiredColumn (Boolean): Indicates if the column should be updated (`true`) or not (`false`)
+ *
+ * TODO
+ **/
+ this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
// Ensure the row/column is not inside of a fold.
var fold = this.session.getFoldAt(row, column, 1);
if (fold) {
@@ -497,7 +723,15 @@ var Selection = function(session) {
this.$updateDesiredColumn(this.selectionLead.column);
};
- this.moveCursorToScreen = function(row, column, preventUpdateDesiredColumn) {
+ /**
+ * Selection.moveCursorToScreen(row, column, preventUpdateDesiredColumn) -> Void
+ * - row (Number): The row to move to
+ * - column (Number): The column to move to
+ * - preventUpdateDesiredColumn (Boolean): Indicates if the column should be updated (`true`) or not (`false`)
+ *
+ * TODO
+ **/
+ this.moveCursorToScreen = function(row, column, preventUpdateDesiredColumn) {
var pos = this.session.screenToDocumentPosition(row, column);
row = pos.row;
column = pos.column;
diff --git a/lib/ace/split.js b/lib/ace/split.js
index 068d5269..dfe4f3be 100644
--- a/lib/ace/split.js
+++ b/lib/ace/split.js
@@ -47,6 +47,23 @@ var Editor = require("./editor").Editor;
var Renderer = require("./virtual_renderer").VirtualRenderer;
var EditSession = require("./edit_session").EditSession;
+/**
+ * class Split
+ *
+ * TODO
+ *
+ **/
+
+/**
+ * new Split(container, theme, splits)
+ * - container (Document): The document to associate with the anchor
+ * - theme (Number): The starting row position
+ * - splits (Number): The starting column position
+ *
+ * TODO
+ *
+ **/
+
var Split = function(container, theme, splits) {
this.BELOW = 1;
this.BESIDE = 0;
@@ -87,6 +104,13 @@ var Split = function(container, theme, splits) {
return editor;
};
+ /**
+ * Split.setSplits(splits) -> Void
+ * - splits (Number): The new number of splits
+ *
+ * TODO
+ *
+ **/
this.setSplits = function(splits) {
var editor;
if (splits < 1) {
@@ -116,42 +140,100 @@ var Split = function(container, theme, splits) {
this.resize();
};
+ /**
+ * Split.getSplits() -> Number
+ *
+ * Returns the number of splits.
+ *
+ **/
this.getSplits = function() {
return this.$splits;
};
+ /**
+ * Split.getEditor(idx) -> Editor
+ * -idx (Number): The index of the editor you want
+ *
+ * Returns the editor identified by the index `idx`.
+ *
+ **/
this.getEditor = function(idx) {
return this.$editors[idx];
};
+ /**
+ * Split.getCurrentEditor() -> Editor
+ *
+ * Returns the current editor.
+ *
+ **/
this.getCurrentEditor = function() {
return this.$cEditor;
};
+ /** related to: Editor.focus
+ * Split.focus() -> Void
+ *
+ * Focuses the current editor.
+ *
+ **/
this.focus = function() {
this.$cEditor.focus();
};
+ /** related to: Editor.blur
+ * Split.blur() -> Void
+ *
+ * Blurs the current editor.
+ *
+ **/
this.blur = function() {
this.$cEditor.blur();
};
+ /** related to: Editor.setTheme
+ * Split.setTheme(theme) -> Void
+ * - theme (String):
+ *
+ * Sets a theme for each of the available editors.
+ **/
this.setTheme = function(theme) {
this.$editors.forEach(function(editor) {
editor.setTheme(theme);
});
};
+ /**
+ * Split.setKeyboardHandler(keybinding) -> Void
+ * - keybinding (String):
+ *
+ * TODO
+ **/
this.setKeyboardHandler = function(keybinding) {
this.$editors.forEach(function(editor) {
editor.setKeyboardHandler(keybinding);
});
};
+ /**
+ * Split.forEach(callback, scope) -> Void
+ * - callback (Function): A callback function to execute
+ * - scope (String): TODO
+ *
+ * Executes `callback` on all of the available editors. TODO
+ *
+ **/
this.forEach = function(callback, scope) {
this.$editors.forEach(callback, scope);
};
+ /** related to: editor.setFontSize
+ * Split.setFontSize(size) -> Void
+ * - size (Number): The new font size
+ *
+ * Sets the font size, in pixels, for all the available editors.
+ *
+ **/
this.$fontSize = "";
this.setFontSize = function(size) {
this.$fontSize = size;
@@ -187,6 +269,14 @@ var Split = function(container, theme, splits) {
return s;
};
+ /** related to: editor.setSession
+ * Split.setSession(session, idx) -> Void
+ * - session (EditSession): The new edit session
+ * - idx (Number): The editor's index you're interested in
+ *
+ * Sets a new [[EditSession `EditSession`]] for the indicated editor.
+ *
+ **/
this.setSession = function(session, idx) {
var editor;
if (idx == null) {
@@ -213,10 +303,23 @@ var Split = function(container, theme, splits) {
return session;
};
+ /**
+ * Split.getOriantation() -> Number
+ *
+ * Returns the orientation. TODO
+ *
+ **/
this.getOriantation = function() {
return this.$oriantation;
};
+ /**
+ * Split.setOriantation(oriantation) -> Void
+ * - oriantation (Number):
+ *
+ * Sets the orientation. TODO
+ *
+ **/
this.setOriantation = function(oriantation) {
if (this.$oriantation == oriantation) {
return;
@@ -225,6 +328,12 @@ var Split = function(container, theme, splits) {
this.resize();
};
+ /**
+ * Split.resize() -> Void
+ *
+ * TODO
+ *
+ **/
this.resize = function() {
var width = this.$container.clientWidth;
var height = this.$container.clientHeight;
@@ -255,6 +364,12 @@ var Split = function(container, theme, splits) {
}).call(Split.prototype);
+ /**
+ * Split.UndoManagerProxy() -> Void
+ *
+ * TODO
+ *
+ **/
function UndoManagerProxy(undoManager, session) {
this.$u = undoManager;
this.$doc = session;
diff --git a/lib/ace/test/asyncjs/async.js b/lib/ace/test/asyncjs/async.js
index c439421b..632d7c9d 100644
--- a/lib/ace/test/asyncjs/async.js
+++ b/lib/ace/test/asyncjs/async.js
@@ -467,7 +467,7 @@ exports.keys = function(map, construct) {
return exports.list(keys, construct)
}
-/**
+/*
* range([start,] stop[, step]) -> generator of integers
*
* Return a generator containing an arithmetic progression of integers.
diff --git a/lib/ace/token_iterator.js b/lib/ace/token_iterator.js
index 6ddd6395..8a6aee3c 100644
--- a/lib/ace/token_iterator.js
+++ b/lib/ace/token_iterator.js
@@ -39,6 +39,22 @@
define(function(require, exports, module) {
"use strict";
+/**
+ * class Token_Iterator
+ *
+ * This class handles all sorts of token iterizing. Is that even a word? TODO
+ *
+ **/
+
+/**
+ * new Token_Iterator(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 row and column coordinates.
+ *
+ **/
var TokenIterator = function(session, initialRow, initialColumn) {
this.$session = session;
this.$row = initialRow;
@@ -49,7 +65,12 @@ var TokenIterator = function(session, initialRow, initialColumn) {
};
(function() {
-
+
+ /**
+ * Token_Iterator.stepBackward() -> Array | null
+ *
+ * Tokenizes all the items from the current point to the row prior in the document. If the current point is at the top of the file, this function returns `null`. Otherwise, it returns an array of the tokenized strings.
+ **/
this.stepBackward = function() {
this.$tokenIndex -= 1;
@@ -66,7 +87,12 @@ var TokenIterator = function(session, initialRow, initialColumn) {
return this.$rowTokens[this.$tokenIndex];
};
-
+
+ /**
+ * Token_Iterator.stepForward() -> String | null
+ *
+ * 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.
+ **/
this.stepForward = function() {
var rowCount = this.$session.getLength();
this.$tokenIndex += 1;
@@ -84,15 +110,33 @@ var TokenIterator = function(session, initialRow, initialColumn) {
return this.$rowTokens[this.$tokenIndex];
};
-
+
+ /**
+ * Token_Iterator.getCurrentToken() -> String
+ *
+ * Returns the current tokenized string.
+ *
+ **/
this.getCurrentToken = function () {
return this.$rowTokens[this.$tokenIndex];
};
-
+
+ /**
+ * Token_Iterator.getCurrentTokenRow() -> Number
+ *
+ * Returns the current row.
+ *
+ **/
this.getCurrentTokenRow = function () {
return this.$row;
};
-
+
+ /**
+ * Token_Iterator.getCurrentTokenColumn() -> Number
+ *
+ * Returns the current column.
+ *
+ **/
this.getCurrentTokenColumn = function() {
var rowTokens = this.$rowTokens;
var tokenIndex = this.$tokenIndex;
diff --git a/lib/ace/tokenizer.js b/lib/ace/tokenizer.js
index af6d8cae..56641804 100644
--- a/lib/ace/tokenizer.js
+++ b/lib/ace/tokenizer.js
@@ -38,6 +38,21 @@
define(function(require, exports, module) {
"use strict";
+/**
+ * class Tokenizer
+ *
+ * This object handles all sorts of tokenizing? TODO
+ *
+ **/
+
+/**
+ * new Tokenizer(rules, flag)
+ * - rules (String):
+ * - flag (String):
+ *
+ * TODO
+ *
+ **/
var Tokenizer = function(rules, flag) {
flag = flag ? "g" + flag : "g";
this.rules = rules;
@@ -76,6 +91,11 @@ var Tokenizer = function(rules, flag) {
(function() {
+ /**
+ * Tokenizer.getLineTokens() -> Object
+ *
+ * TODO. Returns an object containing two properties: `tokens`, all the tokens; and `state`, the current state.
+ **/
this.getLineTokens = function(line, startState) {
var currentState = startState;
var state = this.rules[currentState];
diff --git a/lib/ace/undomanager.js b/lib/ace/undomanager.js
index 7e594197..d7924adf 100644
--- a/lib/ace/undomanager.js
+++ b/lib/ace/undomanager.js
@@ -40,12 +40,30 @@
define(function(require, exports, module) {
"use strict";
+/**
+ * class UndoManager
+ *
+ * This object controls all the undoing that needs to be done. TODO
+ *
+ **/
+
+/**
+ * new UndoManager()
+ *
+ * Resets the current undo state and creates a new `UndoManager`.
+ **/
var UndoManager = function() {
this.reset();
};
(function() {
+ /**
+ * UndoManager.execute(options) -> Void
+ * - options (Object):
+ *
+ * TODO
+ **/
this.execute = function(options) {
var deltas = options.args[0];
this.$doc = options.args[1];
@@ -53,6 +71,12 @@ var UndoManager = function() {
this.$redoStack = [];
};
+ /**
+ * UndoManager.undo(dontSelect) -> Range
+ * - dontSelect (Boolean): TODO
+ *
+ * [Perform an undo operation on the document, reverting the last change. Returns the range of the undo.](~UndoManager.undo)
+ **/
this.undo = function(dontSelect) {
var deltas = this.$undoStack.pop();
var undoSelectionRange = null;
@@ -64,6 +88,12 @@ var UndoManager = function() {
return undoSelectionRange;
};
+ /**
+ * UndoManager.redo(dontSelect) -> Void
+ * - dontSelect (Boolean): TODO
+ *
+ * [Perform a redo operation on the document, reimplementing the last change.](~UndoManager.redo)
+ **/
this.redo = function(dontSelect) {
var deltas = this.$redoStack.pop();
var redoSelectionRange = null;
@@ -75,15 +105,30 @@ var UndoManager = function() {
return redoSelectionRange;
};
+ /**
+ * UndoManager.reset() -> Void
+ *
+ * Destroys the stack of undo and redo redo operations.
+ **/
this.reset = function() {
this.$undoStack = [];
this.$redoStack = [];
};
+ /**
+ * UndoManager.hasUndo() -> Boolean
+ *
+ * Returns `true` if there are undo operations left to perform.
+ **/
this.hasUndo = function() {
return this.$undoStack.length > 0;
};
+ /**
+ * UndoManager.hasRedo() -> Boolean
+ *
+ * Returns `true` if there are redo operations left to perform.
+ **/
this.hasRedo = function() {
return this.$redoStack.length > 0;
};
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 4247ac48..47206a2d 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -56,6 +56,22 @@ var editorCss = require("ace/requirejs/text!./css/editor.css");
dom.importCssString(editorCss, "ace_editor");
+/**
+ * class Virtual_Renderer
+ *
+ * TODO
+ *
+ **/
+
+/**
+ * new Virtual_Renderer(container, theme)
+ * - container (Editor):
+ * - theme (String): The starting theme
+ *
+ * TODO
+ *
+ **/
+
var VirtualRenderer = function(container, theme) {
var _self = this;
@@ -175,6 +191,11 @@ var VirtualRenderer = function(container, theme) {
oop.implement(this, EventEmitter);
+ /**
+ * Virtual_Renderer.setSession(session) -> Void
+ *
+ * Associates an [[EditSession `EditSession`]].
+ **/
this.setSession = function(session) {
this.session = session;
this.$cursorLayer.setSession(session);
@@ -186,8 +207,12 @@ var VirtualRenderer = function(container, theme) {
};
/**
- * Triggers partial update of the text layer
- */
+ * Virtual_Renderer.updateLines(firstRow, lastRow) -> Void
+ * - 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.
+ **/
this.updateLines = function(firstRow, lastRow) {
if (lastRow === undefined)
lastRow = Infinity;
@@ -210,26 +235,38 @@ var VirtualRenderer = function(container, theme) {
};
/**
- * Triggers full update of the text layer
- */
+ * Virtual_Renderer.updateText() -> Void
+ *
+ * Triggers a full update of the text, for all the rows.
+ **/
this.updateText = function() {
this.$loop.schedule(this.CHANGE_TEXT);
};
/**
- * Triggers a full update of all layers
- */
+ * Virtual_Renderer.updateFull() -> Void
+ *
+ * Triggers a full update of all the layers, for all the rows.
+ **/
this.updateFull = function() {
this.$loop.schedule(this.CHANGE_FULL);
};
+ /**
+ * Virtual_Renderer.updateFontSize() -> Void
+ *
+ * Updates the font size.
+ **/
this.updateFontSize = function() {
this.$textLayer.checkForSizeChanges();
};
/**
- * Triggers resize of the editor
- */
+ * Virtual_Renderer.onResize(force) -> Void
+ * - force (Boolean): TODO
+ *
+ * Triggers a resize of the editor.
+ **/
this.onResize = function(force) {
var changes = this.CHANGE_SIZE;
var size = this.$size;
@@ -264,45 +301,99 @@ var VirtualRenderer = function(container, theme) {
this.$loop.schedule(changes);
};
+ /**
+ * Virtual_Renderer.adjustWrapLimit() -> Void
+ *
+ * Adjusts the wrap limits. TODO.
+ **/
this.adjustWrapLimit = function() {
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
var limit = Math.floor(availableWidth / this.characterWidth);
return this.session.adjustWrapLimit(limit);
};
+ /**
+ * Virtual_Renderer.setShowInvisibles(showInvisibles) -> Void
+ * - showInvisibles (Boolean): Set to `true` to show invisibles
+ *
+ * Identifies whether you want to show invisible characters or not.
+ *
+ **/
this.setShowInvisibles = function(showInvisibles) {
if (this.$textLayer.setShowInvisibles(showInvisibles))
this.$loop.schedule(this.CHANGE_TEXT);
};
+ /**
+ * Virtual_Renderer.getShowInvisibles() -> Boolean
+ *
+ * Returns whether or not invisible characters are being shown or not.
+ **/
this.getShowInvisibles = function() {
return this.$textLayer.showInvisibles;
};
this.$showPrintMargin = true;
+
+ /**
+ * Virtual_Renderer.setShowPrintMargin(showPrintMargin)
+ * - showPrintMargin (Boolean): Set to `true` to show the print margin
+ *
+ * Identifies whether you want to show the print margin or not.
+ *
+ **/
this.setShowPrintMargin = function(showPrintMargin) {
this.$showPrintMargin = showPrintMargin;
this.$updatePrintMargin();
};
+ /**
+ * Virtual_Renderer.getShowPrintMargin() -> Boolean
+ *
+ * Returns whether or not the print margin is being shown or not.
+ **/
this.getShowPrintMargin = function() {
return this.$showPrintMargin;
};
this.$printMarginColumn = 80;
+
+ /**
+ * Virtual_Renderer.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.
+ *
+ **/
this.setPrintMarginColumn = function(showPrintMargin) {
this.$printMarginColumn = showPrintMargin;
this.$updatePrintMargin();
};
+ /**
+ * Virtual_Renderer.getPrintMarginColumn() -> Boolean
+ *
+ * Returns whether or not the print margin column is being shown or not.
+ **/
this.getPrintMarginColumn = function() {
return this.$printMarginColumn;
};
+ /**
+ * Virtual_Renderer.getShowGutter() -> Boolean
+ *
+ * Returns `true` if the gutter is being shown.
+ **/
this.getShowGutter = function(){
return this.showGutter;
};
+ /**
+ * Virtual_Renderer.setShowGutter(show) -> Void
+ * - show (Boolean): Set to `true` to show the gutter
+ *
+ * Identifies whether you want to show the gutter or not.
+ **/
this.setShowGutter = function(show){
if(this.showGutter === show)
return;
@@ -331,18 +422,39 @@ var VirtualRenderer = function(container, theme) {
style.visibility = this.$showPrintMargin ? "visible" : "hidden";
};
+ /**
+ * Virtual_Renderer.getContainerElement() -> TODO
+ *
+ * TODO
+ **/
this.getContainerElement = function() {
return this.container;
};
+ /**
+ * Virtual_Renderer.getMouseEventTarget() -> TODO
+ *
+ * TODO
+ **/
this.getMouseEventTarget = function() {
return this.content;
};
+ /**
+ * Virtual_Renderer.getTextAreaContainer() -> TODO
+ *
+ * TODO
+ **/
this.getTextAreaContainer = function() {
return this.container;
};
+ /**
+ * Virtual_Renderer.moveTextAreaToCursor(textarea) -> Void
+ * - textarea (Element): A text area to work with
+ *
+ * Changes the position of `textarea` to where the cursor is pointing.
+ **/
this.moveTextAreaToCursor = function(textarea) {
// in IE the native cursor always shines through
// this persists in IE9
@@ -363,24 +475,52 @@ var VirtualRenderer = function(container, theme) {
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
};
+ /**
+ * Virtual_Renderer.getFirstVisibleRow() -> Number
+ *
+ * [Returns the index of the first visible row.](~VirtualRenderer.getFirstVisibleRow)
+ **/
this.getFirstVisibleRow = function() {
return this.layerConfig.firstRow;
};
+ /**
+ * Virtual_Renderer.getFirstFullyVisibleRow() -> Number
+ *
+ * Returns the index of the first fully visible row. "Fully" here means TODO
+ **/
this.getFirstFullyVisibleRow = function() {
return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
};
+ /**
+ * Virtual_Renderer.getLastFullyVisibleRow() -> Number
+ *
+ * Returns the index of the last fully visible row. "Fully" here means TODO
+ **/
this.getLastFullyVisibleRow = function() {
var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
return this.layerConfig.firstRow - 1 + flint;
};
+ /**
+ * Virtual_Renderer.getLastVisibleRow() -> Number
+ *
+ * [Returns the index of the last visible row.](~VirtualRenderer.getLastVisibleRow)
+ **/
this.getLastVisibleRow = function() {
return this.layerConfig.lastRow;
};
this.$padding = null;
+
+ /**
+ * Virtual_Renderer.setPadding(padding) -> Void
+ * - padding (Number): A new padding value (in pixels)
+ *
+ * Sets the padding for all the layers.
+ *
+ **/
this.setPadding = function(padding) {
this.$padding = padding;
this.$textLayer.setPadding(padding);
@@ -391,10 +531,21 @@ var VirtualRenderer = function(container, theme) {
this.$updatePrintMargin();
};
+ /**
+ * Virtual_Renderer.getHScrollBarAlwaysVisible() -> Boolean
+ *
+ * Returns whether or not the horizontal scrollbar is set to be always visible.
+ **/
this.getHScrollBarAlwaysVisible = function() {
return this.$horizScrollAlwaysVisible;
};
+ /**
+ * Virtual_Renderer.setHScrollBarAlwaysVisible(alwaysVisible) -> Void
+ * - alwaysVisible (Boolean): Set to `true` to make the horizontal scroll bar visible
+ *
+ * Identifies whether you want to show the horizontal scrollbar or not.
+ **/
this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
if (this.$horizScrollAlwaysVisible != alwaysVisible) {
this.$horizScrollAlwaysVisible = alwaysVisible;
@@ -588,48 +739,104 @@ var VirtualRenderer = function(container, theme) {
return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
};
+ /**
+ * Virtual_Renderer.updateFrontMarkers() -> Void
+ *
+ * TODO
+ **/
this.updateFrontMarkers = function() {
this.$markerFront.setMarkers(this.session.getMarkers(true));
this.$loop.schedule(this.CHANGE_MARKER_FRONT);
};
+ /**
+ * Virtual_Renderer.updateBackMarkers() -> Void
+ *
+ * TODO
+ **/
this.updateBackMarkers = function() {
this.$markerBack.setMarkers(this.session.getMarkers());
this.$loop.schedule(this.CHANGE_MARKER_BACK);
};
+ /**
+ * Virtual_Renderer.addGutterDecoration(row, className) -> Void
+ * - row (Number): The row number
+ * - className (String): The class to add
+ *
+ * Adds `className` to the `row`, to be used for CSS stylings and whatnot.
+ **/
this.addGutterDecoration = function(row, className){
this.$gutterLayer.addGutterDecoration(row, className);
this.$loop.schedule(this.CHANGE_GUTTER);
};
+ /**
+ * Virtual_Renderer.removeGutterDecoration(row, className)-> Void
+ * - row (Number): The row number
+ * - className (String): The class to add
+ *
+ * Removes `className` from the `row`.
+ **/
this.removeGutterDecoration = function(row, className){
this.$gutterLayer.removeGutterDecoration(row, className);
this.$loop.schedule(this.CHANGE_GUTTER);
};
+ /**
+ * Virtual_Renderer.setBreakpoints(rows) -> Void
+ * - rows (Array): An array containg row numbers
+ *
+ * Sets a breakpoint for every row number indicated on `rows`.
+ **/
this.setBreakpoints = function(rows) {
this.$gutterLayer.setBreakpoints(rows);
this.$loop.schedule(this.CHANGE_GUTTER);
};
+ /**
+ * Virtual_Renderer.setAnnotations(annotations) -> Void
+ * - annotations (Array): An array containing annotation
+ *
+ * TODO
+ **/
this.setAnnotations = function(annotations) {
this.$gutterLayer.setAnnotations(annotations);
this.$loop.schedule(this.CHANGE_GUTTER);
};
+ /**
+ * Virtual_Renderer.updateCursor() -> Void
+ *
+ * Updates the cursor icon.
+ **/
this.updateCursor = function() {
this.$loop.schedule(this.CHANGE_CURSOR);
};
+ /**
+ * Virtual_Renderer.hideCursor() -> Void
+ *
+ * Hides the cursor icon.
+ **/
this.hideCursor = function() {
this.$cursorLayer.hideCursor();
};
+ /**
+ * Virtual_Renderer.showCursor() -> Void
+ *
+ * Shows the cursor icon.
+ **/
this.showCursor = function() {
this.$cursorLayer.showCursor();
};
+ /**
+ * Virtual_Renderer.scrollCursorIntoView() -> VOid
+ *
+ * TODO
+ **/
this.scrollCursorIntoView = function() {
// the editor is not visible
if (this.$size.scrollerHeight === 0)
@@ -661,26 +868,60 @@ var VirtualRenderer = function(container, theme) {
}
};
+ /** related to: EditSession.getScrollTop
+ * Virtual_Renderer.getScrollTop() -> Number
+ *
+ * (~EditSession.getScrollTop)
+ **/
this.getScrollTop = function() {
return this.session.getScrollTop();
};
+ /** related to: EditSession.getScrollLeft
+ * Virtual_Renderer.getScrollLeft() -> Number
+ *
+ * (~EditSession.getScrollLeft)
+ **/
this.getScrollLeft = function() {
return this.session.getScrollTop();
};
+ /**
+ * Virtual_Renderer.getScrollTopRow() -> Number
+ *
+ * Returns the size of the first row, in pixels. TODO
+ **/
this.getScrollTopRow = function() {
return this.scrollTop / this.lineHeight;
};
+ /**
+ * Virtual_Renderer.getScrollBottomRow() -> Number
+ *
+ * Returns the size of the last row, in pixels.
+ **/
this.getScrollBottomRow = function() {
return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
};
+ /** related to: EditSession.setScrollTop
+ * Virtual_Renderer.scrollToRow(row) -> Void
+ * - row (Number): A row id
+ *
+ * Sets the top of the editor to the row indicated.
+ **/
this.scrollToRow = function(row) {
this.session.setScrollTop(row * this.lineHeight);
};
+ /**
+ * Virtual_Renderer.scrollToLine(line, center)
+ * - line (Number): The line to go to
+ * - center (Boolean): Identifies whether you want the cursor centered or not
+ *
+ * Scrolls the editor to the `line` indicated.
+ *
+ **/
this.scrollToLine = function(line, center) {
var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
var offset = pos.top;
@@ -690,6 +931,13 @@ var VirtualRenderer = function(container, theme) {
this.session.setScrollTop(offset);
};
+ /**
+ * Virtual_Renderer.scrollToY(scrollTop) -> Number
+ * - scrollTop (Number): The position to scroll to
+ *
+ * Scrolls the editor to the y pixel indicated.
+ *
+ **/
this.scrollToY = function(scrollTop) {
// after calling scrollBar.setScrollTop
// scrollbar sends us event with same scrollTop. ignore it
@@ -699,6 +947,13 @@ var VirtualRenderer = function(container, theme) {
}
};
+ /**
+ * Virtual_Renderer.scrollToX(scrollLeft) -> Number
+ * - scrollLeft (Number): The position to scroll to
+ *
+ * Scrolls the editor to the x pixel indicated.
+ *
+ **/
this.scrollToX = function(scrollLeft) {
if (scrollLeft <= this.$padding)
scrollLeft = 0;
@@ -709,11 +964,25 @@ var VirtualRenderer = function(container, theme) {
}
};
+ /**
+ * Virtual_Renderer.scrollBy(deltaX, deltaY) -> Void
+ * - 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.
+ **/
this.scrollBy = function(deltaX, deltaY) {
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
};
+ /**
+ * Virtual_Renderer.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.
+ **/
this.isScrollableBy = function(deltaX, deltaY) {
if (deltaY < 0 && this.session.getScrollTop() > 0)
return true;
@@ -722,6 +991,11 @@ var VirtualRenderer = function(container, theme) {
// todo: handle horizontal scrolling
};
+ /**
+ * Virtual_Renderer.screenToTextCoordinates(pageX, pageY) -> Number
+ *
+ * TODO
+ **/
this.screenToTextCoordinates = function(pageX, pageY) {
var canvasPos = this.scroller.getBoundingClientRect();
@@ -735,6 +1009,11 @@ var VirtualRenderer = function(container, theme) {
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
};
+ /**
+ * Virtual_Renderer.textToScreenCoordinates(row, column) -> Object
+ *
+ * TODO
+ **/
this.textToScreenCoordinates = function(row, column) {
var canvasPos = this.scroller.getBoundingClientRect();
var pos = this.session.documentToScreenPosition(row, column);
@@ -748,14 +1027,29 @@ var VirtualRenderer = function(container, theme) {
};
};
+ /**
+ * Virtual_Renderer.visualizeFocus() -> Void
+ *
+ * Focuses the current container.
+ **/
this.visualizeFocus = function() {
dom.addCssClass(this.container, "ace_focus");
};
+ /**
+ * Virtual_Renderer.visualizeBlur() -> Void
+ *
+ * Blurs the current container.
+ **/
this.visualizeBlur = function() {
dom.removeCssClass(this.container, "ace_focus");
};
+ /**
+ * Virtual_Renderer.showComposition(position) -> Void
+ *
+ * TODO
+ **/
this.showComposition = function(position) {
if (!this.$composition) {
this.$composition = dom.createElement("div");
@@ -774,10 +1068,21 @@ var VirtualRenderer = function(container, theme) {
this.hideCursor();
};
+ /**
+ * Virtual_Renderer.setCompositionText(text) -> Void
+ * - text (String): A string of text to use
+ *
+ * Sets the inner text of the current composition to `text`.
+ **/
this.setCompositionText = function(text) {
dom.setInnerText(this.$composition, text);
};
+ /**
+ * Virtual_Renderer.hideComposition() -> Void
+ *
+ * Hides the current composition.
+ **/
this.hideComposition = function() {
this.showCursor();
@@ -789,6 +1094,12 @@ var VirtualRenderer = function(container, theme) {
style.left = "-10000px";
};
+ /**
+ * Virtual_Renderer.setTheme(theme) -> Void
+ * - 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)
+ **/
this.setTheme = function(theme) {
var _self = this;
@@ -830,6 +1141,11 @@ var VirtualRenderer = function(container, theme) {
}
};
+ /**
+ * Virtual_Renderer.getTheme() -> String
+ *
+ * [Returns the path of the current theme.](~VirtualRenderer.getTheme)
+ **/
this.getTheme = function() {
return this.$themeValue;
};
@@ -838,14 +1154,31 @@ var VirtualRenderer = function(container, theme) {
// This feature can be used by plug-ins to provide a visual indication of
// a certain mode that editor is in.
+ /**
+ * Virtual_Renderer.setStyle(style) -> Void
+ * - style (String): A class name
+ *
+ * [Adds a new class, `style`, to the editor.](~VirtualRenderer.setStyle)
+ **/
this.setStyle = function setStyle(style) {
dom.addCssClass(this.container, style);
};
+ /**
+ * Virtual_Renderer.unsetStyle(style) -> Void
+ * - style (String): A class name
+ *
+ * [Removes the class `style` from the editor.](~VirtualRenderer.unsetStyle)
+ **/
this.unsetStyle = function unsetStyle(style) {
dom.removeCssClass(this.container, style);
};
+ /**
+ * Virtual_Renderer.destroy()
+ *
+ * TODO
+ **/
this.destroy = function() {
this.$textLayer.destroy();
this.$cursorLayer.destroy();