Let us begin

This commit is contained in:
Garen Torikian 2012-12-21 17:07:00 -08:00 committed by nightwing
commit 808bb95538
3 changed files with 282 additions and 110 deletions

151
lib/ace/autocomplete.js Normal file
View file

@ -0,0 +1,151 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
var Autocomplete = function(editor) {
var self = this;
this.editor = editor;
var originalOnTextInput = editor.onTextInput;
var originalSoftTabs = editor.session.getUseSoftTabs();
// Create the suggest list
this.autocompleteContainer = document.createElement('div');
this.autocompleteContainer.className = 'ace_autocomplete';
this.selection = this.autocompleteContainer.appendChild(document.createElement("select"));
};
(function() {
oop.implement(this, EventEmitter);
this.current = function() {
var children = element.childNodes;
for (var i = 0; i < children.length; i++) {
var li = children[i];
if(li.className == 'ace_autocomplete_selected') {
return li;
}
};
}
this.focusNext = function() {
var curr = current();
curr.className = '';
var focus = curr.nextSibling || curr.parentNode.firstChild;
focus.className = 'ace_autocomplete_selected';
}
this.focusPrev = function() {
var curr = current();
curr.className = '';
var focus = curr.previousSibling || curr.parentNode.lastChild;
focus.className = 'ace_autocomplete_selected';
}
this.ensureFocus = function() {
if(!current()) {
element.firstChild.className = 'ace_autocomplete_selected';
}
}
this.replace = function() {
var Range = require('ace/range').Range;
var range = new Range(self.row, self.column, self.row, self.column + 1000);
// Firefox does not support innerText property, don't know about IE
// http://blog.coderlab.us/2005/09/22/using-the-innertext-property-with-firefox/
var selectedValue;
if(document.all){
selectedValue = current().innerText;
} else{
selectedValue = current().textContent;
}
editor.session.replace(range, selectedValue);
// Deactivate asynchrounously, so that in case of ENTER - we don't reactivate immediately.
setTimeout(function() {
deactivate();
}, 0);
}
this.deactivate = function() {
// Hide list
element.style.display = 'none';
// Restore keyboard
editor.session.setUseSoftTabs(originalSoftTabs);
editor.onTextInput = originalOnTextInput;
self.active = false;
}
// Shows the list and reassigns keys
this.activate = function(row, column) {
if(this.active) return;
this.active = true;
this.row = row;
this.column = column;
// Position the list
var coords = this.editor.renderer.textToScreenCoordinates(row, column);
this.autocompleteContainer.style.top = coords.pageY + 18 + 'px';
this.autocompleteContainer.style.left = coords.pageX + -2 + 'px';
this.autocompleteContainer.style.display = 'block';
};
// Sets the text the suggest should be based on.
// afterText indicates the position where the suggest box should start.
this.suggest = function(text) {
var options = ["FUNK", "frunk", "blunk", "frunk", "blunk", "frunk", "blunk", "frunk", "blunk", "frunk", "blunk", "frunk", "blunk"];//matches(text);
if (options.length == 0) {
return deactivate();
}
for (var n = 0; n < options.length; n++) {
var opt = this.selection.appendChild(document.createElement("option"));
opt.appendChild(document.createTextNode(options[n]));
}
this.selection.firstChild.selected = true;
this.selection.size = Math.min(10, options.length);
document.body.appendChild(this.autocompleteContainer);
//ensureFocus();
};
}).call(Autocomplete.prototype);
exports.Autocomplete = Autocomplete;
});

View file

@ -386,3 +386,12 @@
.ace_italic {
font-style: italic;
}
.ace_autocomplete {
position: fixed;
z-index: 9999;
}
.ace_autocomplete li {
color: #000000;
}

View file

@ -3,7 +3,7 @@
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@ -14,7 +14,7 @@
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@ -46,15 +46,16 @@ var Search = require("./search").Search;
var Range = require("./range").Range;
var EventEmitter = require("./lib/event_emitter").EventEmitter;
var CommandManager = require("./commands/command_manager").CommandManager;
var Autocomplete = require("./autocomplete").Autocomplete;
var defaultCommands = require("./commands/default_commands").commands;
var config = require("./config");
/**
*
*
* The main entry point into the Ace functionality.
* The main entry point into the Ace functionality.
*
* The `Editor` manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen.
* The `Editor` manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen.
*
* Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them.
* @class Editor
@ -89,6 +90,7 @@ var Editor = function(renderer, session) {
});
this.setSession(session || new EditSession(""));
this.auto = new Autocomplete(this);
config.resetOptions(this);
config._emit("editor", this);
};
@ -101,7 +103,7 @@ var Editor = function(renderer, session) {
* Sets a new key handler, such as "vim" or "windows".
* @param {String} keyboardHandler The new key handler
*
*
*
**/
this.setKeyboardHandler = function(keyboardHandler) {
if (!keyboardHandler) {
@ -119,11 +121,11 @@ var Editor = function(renderer, session) {
}
};
/**
/**
* Returns the keyboard handler, such as "vim" or "windows".
*
* @returns {String}
*
*
**/
this.getKeyboardHandler = function() {
return this.keyBinding.getKeyboardHandler();
@ -250,7 +252,7 @@ var Editor = function(renderer, session) {
return this.session;
};
/**
/**
* Sets the current document to `val`.
* @param {String} val The new value to set for the document
* @param {Number} cursorPos Where to set the new value. `undefined` or 0 is selectAll, -1 is at the document start, and 1 is at the end
@ -271,7 +273,7 @@ var Editor = function(renderer, session) {
return val;
};
/**
/**
* Returns the current session's content.
*
* @returns {String}
@ -282,7 +284,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* Returns the currently highlighted selection.
* @returns {String} The highlighted selection
**/
@ -290,11 +292,11 @@ var Editor = function(renderer, session) {
return this.selection;
};
/**
/**
* {:VirtualRenderer.onResize}
* @param {Boolean} force If `true`, recomputes the size, even if the height and width haven't changed
*
*
*
* @related VirtualRenderer.onResize
**/
this.resize = function(force) {
@ -311,9 +313,9 @@ var Editor = function(renderer, session) {
this.renderer.setTheme(theme);
};
/**
/**
* {:VirtualRenderer.getTheme}
*
*
* @returns {String} The set theme
* @related VirtualRenderer.getTheme
**/
@ -325,14 +327,14 @@ var Editor = function(renderer, session) {
* {:VirtualRenderer.setStyle}
* @param {String} style A class name
*
*
*
* @related VirtualRenderer.setStyle
**/
this.setStyle = function(style) {
this.renderer.setStyle(style);
};
/**
/**
* {:VirtualRenderer.unsetStyle}
* @related VirtualRenderer.unsetStyle
**/
@ -351,8 +353,8 @@ var Editor = function(renderer, session) {
/**
* Set a new font size (in pixels) for the editor text.
* @param {String} size A font size ( _e.g._ "12px")
*
*
*
*
**/
this.setFontSize = function(size) {
this.setOption("fontSize", size);
@ -386,7 +388,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* Brings the current `textInput` into focus.
**/
this.focus = function() {
@ -409,7 +411,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* Blurs the current `textInput`.
**/
this.blur = function() {
@ -418,9 +420,9 @@ var Editor = function(renderer, session) {
/**
* Emitted once the editor comes into focus.
* @event focus
*
*
* @event focus
*
*
**/
this.onFocus = function() {
if (this.$isFocused)
@ -434,8 +436,8 @@ var Editor = function(renderer, session) {
/**
* Emitted once the editor has been blurred.
* @event blur
*
*
*
*
**/
this.onBlur = function() {
if (!this.$isFocused)
@ -451,12 +453,12 @@ var Editor = function(renderer, session) {
};
/**
* Emitted whenever the document is changed.
* Emitted whenever the document is changed.
* @event change
* @param {Object} e Contains a single property, `data`, which has the delta of changes
*
*
*
*
**/
this.onDocumentChange = function(e) {
var delta = e.data;
@ -471,6 +473,16 @@ var Editor = function(renderer, session) {
this._emit("change", e);
var source = this.session.getValue();
var _self = this;
setTimeout(function() {
var cursor = _self.getCursorPosition();
var line = _self.session.getLine(cursor.row);
_self.auto.activate(cursor.row, cursor.column);
_self.auto.suggest(name);
}, 0);
// update cursor because tab characters can influence the cursor position
this.$cursorChange();
};
@ -484,14 +496,14 @@ var Editor = function(renderer, session) {
this.onScrollTopChange = function() {
this.renderer.scrollToY(this.session.getScrollTop());
};
this.onScrollLeftChange = function() {
this.renderer.scrollToX(this.session.getScrollLeft());
};
/**
* Emitted when the selection changes.
*
*
**/
this.onCursorChange = function() {
this.$cursorChange();
@ -547,7 +559,7 @@ var Editor = function(renderer, session) {
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()
this.session.highlight(re);
this._emit("changeSelection");
};
@ -627,10 +639,10 @@ var Editor = function(renderer, session) {
/**
* Emitted when text is copied.
* @event copy
* @event copy
* @param {String} text The copied text
*
*
*
**/
/**
*
@ -676,7 +688,7 @@ var Editor = function(renderer, session) {
**/
this.onPaste = function(text) {
// todo this should change when paste becomes a command
if (this.$readOnly)
if (this.$readOnly)
return;
this._emit("paste", text);
this.insert(text);
@ -690,8 +702,8 @@ var Editor = function(renderer, session) {
/**
* Inserts `text` into wherever the cursor is pointing.
* @param {String} text The new text to add
*
*
*
*
**/
this.insert = function(text) {
var session = this.session;
@ -791,10 +803,10 @@ var Editor = function(renderer, session) {
this.keyBinding.onCommandKey(e, hashId, keyCode);
};
/**
/**
* 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.
* @param {Boolean} overwrite Defines wheter or not to set overwrites
*
*
*
* @related EditSession.setOverwrite
**/
@ -802,7 +814,7 @@ var Editor = function(renderer, session) {
this.session.setOverwrite(overwrite);
};
/**
/**
* Returns `true` if overwrites are enabled; `false` otherwise.
* @returns {Boolean}
* @related EditSession.getOverwrite
@ -811,7 +823,7 @@ var Editor = function(renderer, session) {
return this.session.getOverwrite();
};
/**
/**
* Sets the value of overwrite to the opposite of whatever it currently is.
* @related EditSession.toggleOverwrite
**/
@ -859,7 +871,7 @@ var Editor = function(renderer, session) {
/**
* Draw selection markers spanning whole line, or only over selected text. Default value is "line"
* @param {String} style The new selection style "line"|"text"
*
*
**/
this.setSelectionStyle = function(val) {
this.setOption("selectionStyle", val);
@ -922,7 +934,7 @@ var Editor = function(renderer, session) {
/**
* If `showInvisibles` is set to `true`, invisible characters&mdash;like spaces or new lines&mdash;are show in the editor.
* @param {Boolean} showInvisibles Specifies whether or not to show invisible characters
*
*
**/
this.setShowInvisibles = function(showInvisibles) {
this.renderer.setShowInvisibles(showInvisibles);
@ -947,7 +959,7 @@ var Editor = function(renderer, session) {
/**
* If `showPrintMargin` is set to `true`, the print margin is shown in the editor.
* @param {Boolean} showPrintMargin Specifies whether or not to show the print margin
*
*
**/
this.setShowPrintMargin = function(showPrintMargin) {
this.renderer.setShowPrintMargin(showPrintMargin);
@ -981,7 +993,7 @@ var Editor = function(renderer, session) {
/**
* If `readOnly` is true, then the editor is set to read-only mode, and none of the content can change.
* @param {Boolean} readOnly Specifies whether the editor can be modified or not
*
*
**/
this.setReadOnly = function(readOnly) {
this.setOption("readOnly", readOnly);
@ -998,7 +1010,7 @@ var Editor = function(renderer, session) {
/**
* Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef}
* @param {Boolean} enabled Enables or disables behaviors
*
*
**/
this.setBehavioursEnabled = function (enabled) {
this.setOption("behavioursEnabled", enabled);
@ -1006,7 +1018,7 @@ var Editor = function(renderer, session) {
/**
* Returns `true` if the behaviors are currently enabled. {:BehaviorsDef}
*
*
* @returns {Boolean}
**/
this.getBehavioursEnabled = function () {
@ -1017,7 +1029,7 @@ var Editor = function(renderer, session) {
* Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets
* when such a character is typed in.
* @param {Boolean} enabled Enables or disables wrapping behaviors
*
*
**/
this.setWrapBehavioursEnabled = function (enabled) {
this.setOption("wrapBehavioursEnabled", enabled);
@ -1057,7 +1069,7 @@ var Editor = function(renderer, session) {
/**
* Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.
* @param {String} dir The direction of the deletion to occur, either "left" or "right"
*
*
**/
this.remove = function(dir) {
if (this.selection.isEmpty()){
@ -1202,7 +1214,7 @@ var Editor = function(renderer, session) {
/**
* Inserts an indentation into the current cursor position or indents the selected lines.
*
*
* @related EditSession.indentRows
**/
this.indent = function() {
@ -1309,7 +1321,7 @@ var Editor = function(renderer, session) {
}
return null;
};
/**
* If the character before the cursor is a number, this functions changes its value by `amount`.
* @param {Number} amount The value to change the numeral by (can be negative to decrease value)
@ -1334,14 +1346,14 @@ var Editor = function(renderer, session) {
var t = parseFloat(nr.value);
t *= Math.pow(10, decimals);
if(fp !== nr.end && column < fp){
amount *= Math.pow(10, nr.end - column - 1);
} else {
amount *= Math.pow(10, nr.end - column);
}
t += amount;
t /= Math.pow(10, decimals);
var nnr = t.toFixed(decimals);
@ -1356,8 +1368,8 @@ var Editor = function(renderer, session) {
}
}
};
/**
/**
* Removes all the lines in the current selection
* @related EditSession.remove
**/
@ -1388,12 +1400,12 @@ var Editor = function(renderer, session) {
var endPoint = doc.insert(point, doc.getTextRange(range), false);
range.start = point;
range.end = endPoint;
sel.setSelectionRange(range, reverse)
}
};
/**
/**
* Shifts all the selected lines down one row.
*
* @returns {Number} On success, it returns -1.
@ -1405,7 +1417,7 @@ var Editor = function(renderer, session) {
});
};
/**
/**
* Shifts all the selected lines up one row.
* @returns {Number} On success, it returns -1.
* @related EditSession.moveLinesDown
@ -1416,14 +1428,14 @@ var Editor = function(renderer, session) {
});
};
/**
/**
* Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
* ```json
* { row: newRowLocation, column: newColumnLocation }
* ```
* @param {Range} fromRange The range of text you want moved within the document
* @param {Object} toPosition The location (row and column) where you want to move the text to
*
*
* @returns {Range} The new range where the text was moved to.
* @related EditSession.moveText
**/
@ -1431,10 +1443,10 @@ var Editor = function(renderer, session) {
return this.session.moveText(range, toPosition);
};
/**
/**
* Copies all the selected lines up one row.
* @returns {Number} On success, returns 0.
*
*
**/
this.copyLinesUp = function() {
this.$moveLines(function(firstRow, lastRow) {
@ -1443,7 +1455,7 @@ var Editor = function(renderer, session) {
});
};
/**
/**
* Copies all the selected lines down one row.
* @returns {Number} On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
* @related EditSession.duplicateLines
@ -1458,7 +1470,7 @@ var Editor = function(renderer, session) {
/**
* Executes a specific function, which can be anything that manipulates selected lines, such as copying them, duplicating them, or shifting them.
* @param {Function} mover A method to call on each selected row
*
*
*
**/
this.$moveLines = function(mover) {
@ -1466,7 +1478,7 @@ var Editor = function(renderer, session) {
if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
var range = selection.toOrientedRange();
var rows = this.$getSelectedRows(range);
var linesMoved = mover.call(this, rows.first, rows.last);
var linesMoved = mover.call(this, rows.first, rows.last);
range.moveBy(linesMoved, 0);
selection.fromOrientedRange(range);
} else {
@ -1484,14 +1496,14 @@ var Editor = function(renderer, session) {
first = rows.end.row;
else
break;
}
}
i++;
var linesMoved = mover.call(this, first, last);
while (rangeIndex >= i) {
ranges[rangeIndex].moveBy(linesMoved, 0);
rangeIndex--;
}
}
}
selection.fromOrientedRange(selection.ranges[0]);
selection.rangeList.attach(this.session);
@ -1528,7 +1540,7 @@ var Editor = function(renderer, session) {
this.renderer.hideComposition();
};
/**
/**
* {:VirtualRenderer.getFirstVisibleRow}
*
* @returns {Number}
@ -1538,7 +1550,7 @@ var Editor = function(renderer, session) {
return this.renderer.getFirstVisibleRow();
};
/**
/**
* {:VirtualRenderer.getLastVisibleRow}
*
* @returns {Number}
@ -1551,7 +1563,7 @@ var Editor = function(renderer, session) {
/**
* Indicates if the row is currently visible on the screen.
* @param {Number} row The row to check
*
*
* @returns {Boolean}
**/
this.isRowVisible = function(row) {
@ -1561,8 +1573,8 @@ var Editor = function(renderer, session) {
/**
* Indicates if the entire row is currently visible on the screen.
* @param {Number} row The row to check
*
*
*
*
* @returns {Boolean}
**/
this.isRowFullyVisible = function(row) {
@ -1644,7 +1656,7 @@ var Editor = function(renderer, session) {
this.$moveByPage(-1);
};
/**
/**
* Moves the editor to the specified row.
* @related VirtualRenderer.scrollToRow
**/
@ -1652,14 +1664,14 @@ var Editor = function(renderer, session) {
this.renderer.scrollToRow(row);
};
/**
/**
* Scrolls to a line. If `center` is `true`, it puts the line in middle of screen (or attempts to).
* @param {Number} line The line to scroll to
* @param {Boolean} center If `true`
* @param {Boolean} center If `true`
* @param {Boolean} animate If `true` animates scrolling
* @param {Function} callback Function to be called when the animation has finished
*
*
*
* @related VirtualRenderer.scrollToLine
**/
this.scrollToLine = function(line, center, animate, callback) {
@ -1678,9 +1690,9 @@ var Editor = function(renderer, session) {
this.renderer.alignCursor(pos, 0.5);
};
/**
/**
* Gets the current position of the cursor.
* @returns {Object} An object that looks something like this:
* @returns {Object} An object that looks something like this:
*
* ```json
* { row: currRow, column: currCol }
@ -1692,7 +1704,7 @@ var Editor = function(renderer, session) {
return this.selection.getCursor();
};
/**
/**
* Returns the screen position of the cursor.
* @returns {Number}
* @related EditSession.documentToScreenPosition
@ -1701,7 +1713,7 @@ var Editor = function(renderer, session) {
return this.session.documentToScreenPosition(this.getCursorPosition());
};
/**
/**
* {:Selection.getRange}
* @returns {Range}
* @related Selection.getRange
@ -1711,7 +1723,7 @@ var Editor = function(renderer, session) {
};
/**
/**
* Selects all the text in editor.
* @related Selection.selectAll
**/
@ -1721,7 +1733,7 @@ var Editor = function(renderer, session) {
this.$blockScrolling -= 1;
};
/**
/**
* {:Selection.clearSelection}
* @related Selection.clearSelection
**/
@ -1729,7 +1741,7 @@ var Editor = function(renderer, session) {
this.selection.clearSelection();
};
/**
/**
* Moves the cursor to the specified row and column. Note that this does not de-select the current selection.
* @param {Number} row The new row number
* @param {Number} column The new column number
@ -1741,10 +1753,10 @@ var Editor = function(renderer, session) {
this.selection.moveCursorTo(row, column);
};
/**
/**
* Moves the cursor to the position indicated by `pos.row` and `pos.column`.
* @param {Object} pos An object with two properties, row and column
*
*
*
* @related Selection.moveCursorToPosition
**/
@ -1752,7 +1764,7 @@ var Editor = function(renderer, session) {
this.selection.moveCursorToPosition(pos);
};
/**
/**
* Moves the cursor's row and column to the next matching bracket.
*
**/
@ -1772,7 +1784,7 @@ var Editor = function(renderer, session) {
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
range = this.session.getBracketRange(pos);
}
pos = range && range.cursor || pos;
if (pos) {
if (select) {
@ -1792,7 +1804,7 @@ var Editor = function(renderer, session) {
* @param {Number} lineNumber The line number to go to
* @param {Number} column A column number to go to
* @param {Boolean} animate If `true` animates scolling
*
*
**/
this.gotoLine = function(lineNumber, column, animate) {
this.selection.clearSelection();
@ -1808,7 +1820,7 @@ var Editor = function(renderer, session) {
this.scrollToLine(lineNumber - 1, true, animate);
};
/**
/**
* Moves the cursor to the specified row and column. Note that this does de-select the current selection.
* @param {Number} row The new row number
* @param {Number} column The new column number
@ -1824,8 +1836,8 @@ var Editor = function(renderer, session) {
/**
* Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.
* @param {Number} times The number of times to change navigation
*
*
*
*
**/
this.navigateUp = function(times) {
if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
@ -1840,8 +1852,8 @@ var Editor = function(renderer, session) {
/**
* Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.
* @param {Number} times The number of times to change navigation
*
*
*
*
**/
this.navigateDown = function(times) {
if (this.selection.isMultiLine() && this.selection.isBackwards()) {
@ -1856,8 +1868,8 @@ var Editor = function(renderer, session) {
/**
* Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.
* @param {Number} times The number of times to change navigation
*
*
*
*
**/
this.navigateLeft = function(times) {
if (!this.selection.isEmpty()) {
@ -1876,8 +1888,8 @@ var Editor = function(renderer, session) {
/**
* Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.
* @param {Number} times The number of times to change navigation
*
*
*
*
**/
this.navigateRight = function(times) {
if (!this.selection.isEmpty()) {
@ -1894,7 +1906,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* Moves the cursor to the start of the current line. Note that this does de-select the current selection.
**/
this.navigateLineStart = function() {
@ -1903,7 +1915,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* Moves the cursor to the end of the current line. Note that this does de-select the current selection.
**/
this.navigateLineEnd = function() {
@ -1912,7 +1924,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* Moves the cursor to the end of the current file. Note that this does de-select the current selection.
**/
this.navigateFileEnd = function() {
@ -1923,7 +1935,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* Moves the cursor to the start of the current file. Note that this does de-select the current selection.
**/
this.navigateFileStart = function() {
@ -1934,7 +1946,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* 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() {
@ -1943,7 +1955,7 @@ var Editor = function(renderer, session) {
};
/**
*
*
* 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() {
@ -2024,7 +2036,7 @@ var Editor = function(renderer, session) {
}
};
/**
/**
* {:Search.getOptions} For more information on `options`, see [[Search `Search`]].
* @related Search.getOptions
* @returns {Object}
@ -2033,7 +2045,7 @@ var Editor = function(renderer, session) {
return this.$search.getOptions();
};
/**
/**
* Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]].
* @param {String} needle The text to search for (optional)
* @param {Object} options An object defining various search properties
@ -2081,7 +2093,7 @@ var Editor = function(renderer, session) {
this.selection.setRange(range);
};
/**
/**
* Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]].
* @param {Object} options search options
* @param {Boolean} animate If `true` animate scrolling
@ -2093,7 +2105,7 @@ var Editor = function(renderer, session) {
this.find({skipCurrent: true, backwards: false}, options, animate);
};
/**
/**
* Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]].
* @param {Object} options search options
* @param {Boolean} animate If `true` animate scrolling
@ -2117,7 +2129,7 @@ var Editor = function(renderer, session) {
this.renderer.animateScrolling(scrollTop);
};
/**
/**
* {:UndoManager.undo}
* @related UndoManager.undo
**/
@ -2128,7 +2140,7 @@ var Editor = function(renderer, session) {
this.renderer.scrollCursorIntoView(null, 0.5);
};
/**
/**
* {:UndoManager.redo}
* @related UndoManager.redo
**/
@ -2139,8 +2151,8 @@ var Editor = function(renderer, session) {
this.renderer.scrollCursorIntoView(null, 0.5);
};
/**
*
/**
*
* Cleans up the entire editor.
**/
this.destroy = function() {