small cleanups
This commit is contained in:
parent
806114aa2e
commit
6e1215a45e
13 changed files with 172 additions and 136 deletions
|
|
@ -51,16 +51,11 @@ oop.inherits(CommandManager, HashHandler);
|
|||
if (editor && editor.$readOnly && !command.readOnly)
|
||||
return false;
|
||||
|
||||
try {
|
||||
var retvalue = this._emit("exec", {
|
||||
editor: editor,
|
||||
command: command,
|
||||
args: args
|
||||
});
|
||||
} catch (e) {
|
||||
window.console && window.console.log(e);
|
||||
return true;
|
||||
}
|
||||
var retvalue = this._emit("exec", {
|
||||
editor: editor,
|
||||
command: command,
|
||||
args: args
|
||||
});
|
||||
|
||||
return retvalue === false ? false : true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -79,12 +79,15 @@ exports.defaultCommands = [{
|
|||
exec: function(editor) { editor.selectMore(1, true); },
|
||||
bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
|
||||
readonly: true
|
||||
}, {
|
||||
}, {
|
||||
name: "splitIntoLines",
|
||||
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
|
||||
bindKey: {win: "Ctrl-Shift-L", mac: "Ctrl-Shift-L"},
|
||||
readonly: true
|
||||
}, {
|
||||
}];
|
||||
|
||||
// commands active in multiselect mode
|
||||
exports.multiSelectCommands = [{
|
||||
name: "singleSelection",
|
||||
bindKey: "esc",
|
||||
exec: function(editor) { editor.exitMultiSelectMode(); },
|
||||
|
|
@ -92,10 +95,7 @@ exports.defaultCommands = [{
|
|||
isAvailable: function(editor) {return editor.inMultiSelectMode}
|
||||
}];
|
||||
|
||||
// commands active in multiselect mode
|
||||
exports.multiEditCommands = {"singleSelection": "esc"};
|
||||
|
||||
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
||||
exports.keyboardHandler = new HashHandler(exports.multiEditCommands);
|
||||
exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -55,14 +55,14 @@ var options = {
|
|||
|
||||
exports.get = function(key) {
|
||||
if (!options.hasOwnProperty(key))
|
||||
throw new Error("Unknown confik key: " + key);
|
||||
throw new Error("Unknown config key: " + key);
|
||||
|
||||
return options[key];
|
||||
};
|
||||
|
||||
exports.set = function(key, value) {
|
||||
if (!options.hasOwnProperty(key))
|
||||
throw new Error("Unknown confik key: " + key);
|
||||
throw new Error("Unknown config key: " + key);
|
||||
|
||||
options[key] = value;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -235,6 +235,35 @@ var Editor = function(renderer, session) {
|
|||
return this.session;
|
||||
};
|
||||
|
||||
/** related to: Document.setValue
|
||||
* Editor.setValue(val [,dontSelect]) -> String
|
||||
* - val (String): The new value to set for the document
|
||||
* - cursorPos (number): 0: selectAll, -1 document start, 1 end
|
||||
*
|
||||
* Sets the current document to `val`.
|
||||
**/
|
||||
this.setValue = function(val, cursorPos) {
|
||||
this.session.doc.setValue(val);
|
||||
|
||||
if (!cursorPos)
|
||||
this.selectAll();
|
||||
else if (cursorPos == 1)
|
||||
this.navigateFileEnd();
|
||||
else if (cursorPos == -1)
|
||||
this.navigateFileStart();
|
||||
|
||||
return val;
|
||||
};
|
||||
|
||||
/** related to: EditSession.getValue
|
||||
* Editor.getValue() -> String
|
||||
*
|
||||
* Returns the current session's content.
|
||||
**/
|
||||
this.getValue = function() {
|
||||
return this.session.getValue();
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.getSelection() -> String
|
||||
*
|
||||
|
|
@ -249,8 +278,8 @@ var Editor = function(renderer, session) {
|
|||
*
|
||||
* {:VirtualRenderer.onResize}
|
||||
**/
|
||||
this.resize = function() {
|
||||
this.renderer.onResize();
|
||||
this.resize = function(force) {
|
||||
this.renderer.onResize(force);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -57,9 +57,8 @@ function HashHandler(config, platform) {
|
|||
|
||||
this.commands[command.name] = command;
|
||||
|
||||
if (command.bindKey) {
|
||||
if (command.bindKey)
|
||||
this._buildKeyHash(command);
|
||||
}
|
||||
};
|
||||
|
||||
this.removeCommand = function(command) {
|
||||
|
|
@ -81,6 +80,10 @@ function HashHandler(config, platform) {
|
|||
this.bindKey = function(key, command) {
|
||||
if(!key)
|
||||
return;
|
||||
if (typeof command == "function") {
|
||||
this.addCommand({exec: command, bindKey: key, name: key});
|
||||
return;
|
||||
}
|
||||
|
||||
var ckb = this.commmandKeyBinding;
|
||||
key.split("|").forEach(function(keyPart) {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,8 @@ var KeyBinding = function(editor) {
|
|||
else
|
||||
success = toExecute.passEvent != true;
|
||||
|
||||
if (success && e)
|
||||
// do not stop input events to not break repeating
|
||||
if (success && e && hashId != -1)
|
||||
event.stopEvent(e);
|
||||
|
||||
return success;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,9 @@ exports.handler = {
|
|||
editor.removeListener("click", exports.onCursorMove);
|
||||
util.noMode(editor);
|
||||
util.currentMode = "normal";
|
||||
}
|
||||
},
|
||||
|
||||
actions: cmds.actions
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,18 +52,6 @@ var MOTION = 3;
|
|||
var ACTION = 4;
|
||||
var HMARGIN = 8; // Minimum amount of line separation between margins;
|
||||
|
||||
exports.searchStore = {
|
||||
current: "",
|
||||
options: {
|
||||
needle: "",
|
||||
backwards: false,
|
||||
wrap: true,
|
||||
caseSensitive: false,
|
||||
wholeWord: false,
|
||||
regExp: false
|
||||
}
|
||||
};
|
||||
|
||||
var repeat = function repeat(fn, count, args) {
|
||||
while (0 < count--)
|
||||
fn.apply(this, args);
|
||||
|
|
@ -88,7 +76,7 @@ var ensureScrollMargin = function(editor) {
|
|||
}
|
||||
};
|
||||
|
||||
var actions = {
|
||||
var actions = exports.actions = {
|
||||
"z": {
|
||||
param: true,
|
||||
fn: function(editor, range, count, param) {
|
||||
|
|
@ -288,16 +276,17 @@ var actions = {
|
|||
},
|
||||
":": {
|
||||
fn: function(editor, range, count, param) {
|
||||
editor.blur();
|
||||
txtConsoleInput.focus();
|
||||
txtConsoleInput.setValue(":");
|
||||
// not implemented
|
||||
}
|
||||
},
|
||||
"/": {
|
||||
fn: function(editor, range, count, param) {
|
||||
editor.blur();
|
||||
txtConsoleInput.focus();
|
||||
txtConsoleInput.setValue("/");
|
||||
// not implemented
|
||||
}
|
||||
},
|
||||
"?": {
|
||||
fn: function(editor, range, count, param) {
|
||||
// not implemented
|
||||
}
|
||||
},
|
||||
".": {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ function GutterHandler(mouseHandler) {
|
|||
}
|
||||
|
||||
mouseHandler.captureMouse(e, "selectByLines");
|
||||
return e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,16 +42,12 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
var BrowserFocus = require("../lib/browser_focus").BrowserFocus;
|
||||
|
||||
var useragent = require("../lib/useragent");
|
||||
|
||||
var DRAG_OFFSET = 5; // pixels
|
||||
|
||||
|
||||
|
||||
function DefaultHandlers(mouseHandler) {
|
||||
mouseHandler.$clickSelection = null;
|
||||
mouseHandler.browserFocus = new BrowserFocus();
|
||||
|
||||
var editor = mouseHandler.editor;
|
||||
editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
|
||||
|
|
@ -69,14 +65,16 @@ function DefaultHandlers(mouseHandler) {
|
|||
|
||||
mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
|
||||
mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
|
||||
|
||||
mouseHandler.$focusWaitTimout = 250;
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
this.onMouseDown = function(ev) {
|
||||
this.mousedownEvent = ev;
|
||||
var inSelection = ev.inSelection();
|
||||
var pos = ev.getDocumentPosition();
|
||||
this.mousedownEvent = ev;
|
||||
var editor = this.editor;
|
||||
var _self = this;
|
||||
|
||||
|
|
@ -99,7 +97,10 @@ function DefaultHandlers(mouseHandler) {
|
|||
// selection
|
||||
if (inSelection && !editor.isFocused()) {
|
||||
editor.focus();
|
||||
return;
|
||||
if (this.$focusWaitTimout && !this.$clickSelection) {
|
||||
// todo start select after focusWaitTimout passes
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inSelection || this.$clickSelection || ev.getShiftKey()) {
|
||||
|
|
@ -116,7 +117,8 @@ function DefaultHandlers(mouseHandler) {
|
|||
}
|
||||
}
|
||||
|
||||
this.captureMouse(ev)
|
||||
this.captureMouse(ev);
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
this.startSelect = function(pos) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ var Range = require("./range").Range;
|
|||
var Selection = require("./selection").Selection;
|
||||
var onMouseDown = require("./mouse/multi_select_handler").onMouseDown;
|
||||
var event = require("./lib/event");
|
||||
exports.commands = require("./commands/multi_select_commands");
|
||||
var commands = require("./commands/multi_select_commands");
|
||||
exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
|
||||
|
||||
// Todo: session.find or editor.findVolatile that returns range
|
||||
var Search = require("./search").Search;
|
||||
|
|
@ -397,7 +398,7 @@ var Editor = require("./editor").Editor;
|
|||
this.inMultiSelectMode = true;
|
||||
|
||||
this.setStyle("multiselect");
|
||||
this.keyBinding.addKeyboardHandler(exports.commands.keyboardHandler);
|
||||
this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
|
||||
this.commands.on("exec", this.$onMultiSelectExec);
|
||||
|
||||
this.renderer.updateCursor();
|
||||
|
|
@ -410,7 +411,7 @@ var Editor = require("./editor").Editor;
|
|||
this.inMultiSelectMode = false;
|
||||
|
||||
this.unsetStyle("multiselect");
|
||||
this.keyBinding.removeKeyboardHandler(exports.commands.keyboardHandler);
|
||||
this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
|
||||
|
||||
this.commands.removeEventListener("exec", this.$onMultiSelectExec);
|
||||
this.renderer.updateCursor();
|
||||
|
|
@ -420,6 +421,8 @@ var Editor = require("./editor").Editor;
|
|||
this.$onMultiSelectExec = function(e) {
|
||||
var command = e.command;
|
||||
var editor = e.editor;
|
||||
if (!editor.multiSelect)
|
||||
return;
|
||||
if (!command.multiSelectAction) {
|
||||
command.exec(editor, e.args || {});
|
||||
editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
|
||||
|
|
@ -724,7 +727,7 @@ function MultiSelect(editor) {
|
|||
editor.on("changeSession", exports.onSessionChange.bind(editor));
|
||||
|
||||
editor.on("mousedown", onMouseDown);
|
||||
editor.commands.addCommands(exports.commands.defaultCommands);
|
||||
editor.commands.addCommands(commands.defaultCommands);
|
||||
|
||||
addAltCursorListeners(editor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ var Range = require("./range").Range;
|
|||
/**
|
||||
* new Selection(session)
|
||||
* - session (EditSession): The session to use
|
||||
*
|
||||
*
|
||||
* Creates a new `Selection` object.
|
||||
*
|
||||
**/
|
||||
|
|
@ -88,7 +88,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.isEmpty() -> Boolean
|
||||
*
|
||||
*
|
||||
* Returns `true` if the selection is empty.
|
||||
**/
|
||||
this.isEmpty = function() {
|
||||
|
|
@ -100,7 +100,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.isMultiLine() -> Boolean
|
||||
*
|
||||
*
|
||||
* Returns `true` if the selection is a multi-line.
|
||||
**/
|
||||
this.isMultiLine = function() {
|
||||
|
|
@ -113,7 +113,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.getCursor() -> Number
|
||||
*
|
||||
*
|
||||
* Gets the current position of the cursor.
|
||||
**/
|
||||
this.getCursor = function() {
|
||||
|
|
@ -121,7 +121,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.setSelectionAnchor(row, column)
|
||||
* Selection.setSelectionAnchor(row, column)
|
||||
* - row (Number): The new row
|
||||
* - column (Number): The new column
|
||||
*
|
||||
|
|
@ -138,7 +138,7 @@ var Selection = function(session) {
|
|||
|
||||
/** related to: Anchor.getPosition
|
||||
* Selection.getSelectionAnchor() -> Object
|
||||
*
|
||||
*
|
||||
* Returns an object containing the `row` and `column` of the calling selection anchor.
|
||||
*
|
||||
**/
|
||||
|
|
@ -149,9 +149,9 @@ var Selection = function(session) {
|
|||
return this.anchor.getPosition();
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Selection.getSelectionLead() -> Object
|
||||
*
|
||||
*
|
||||
* Returns an object containing the `row` and `column` of the calling selection lead.
|
||||
**/
|
||||
this.getSelectionLead = function() {
|
||||
|
|
@ -159,9 +159,9 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.shiftSelection(columns)
|
||||
* Selection.shiftSelection(columns)
|
||||
* - columns (Number): The number of columns to shift by
|
||||
*
|
||||
*
|
||||
* Shifts the selection up (or down, if [[Selection.isBackwards `isBackwards()`]] is true) the given number of columns.
|
||||
*
|
||||
**/
|
||||
|
|
@ -188,7 +188,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.isBackwards() -> Boolean
|
||||
*
|
||||
*
|
||||
* Returns `true` if the selection is going backwards in the document.
|
||||
**/
|
||||
this.isBackwards = function() {
|
||||
|
|
@ -199,7 +199,7 @@ var Selection = function(session) {
|
|||
|
||||
/**
|
||||
* Selection.getRange() -> Range
|
||||
*
|
||||
*
|
||||
* [Returns the [[Range `Range`]] for the selected text.]{: #Selection.getRange}
|
||||
**/
|
||||
this.getRange = function() {
|
||||
|
|
@ -218,8 +218,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.clearSelection()
|
||||
*
|
||||
* Selection.clearSelection()
|
||||
*
|
||||
* [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.]{: #Selection.clearSelection}
|
||||
**/
|
||||
this.clearSelection = function() {
|
||||
|
|
@ -230,24 +230,25 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectAll()
|
||||
*
|
||||
* Selection.selectAll()
|
||||
*
|
||||
* 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.setSelectionAnchor(0, 0);
|
||||
this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);
|
||||
};
|
||||
|
||||
/**
|
||||
* Selection.setSelectionRange(range, reverse)
|
||||
* Selection.setSelectionRange(range, reverse)
|
||||
* - range (Range): The range of text to select
|
||||
* - reverse (Boolean): Indicates if the range should go backwards (`true`) or not
|
||||
*
|
||||
* Sets the selection to the provided range.
|
||||
*
|
||||
**/
|
||||
this.setRange =
|
||||
this.setSelectionRange = function(range, reverse) {
|
||||
if (reverse) {
|
||||
this.setSelectionAnchor(range.end.row, range.end.column);
|
||||
|
|
@ -268,7 +269,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectTo(row, column)
|
||||
* Selection.selectTo(row, column)
|
||||
* - row (Number): The row to select to
|
||||
* - column (Number): The column to select to
|
||||
*
|
||||
|
|
@ -282,9 +283,9 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectToPosition(pos)
|
||||
* Selection.selectToPosition(pos)
|
||||
* - pos (Object): An object containing the row and column
|
||||
*
|
||||
*
|
||||
* Moves the selection cursor to the row and column indicated by `pos`.
|
||||
*
|
||||
**/
|
||||
|
|
@ -295,8 +296,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectUp()
|
||||
*
|
||||
* Selection.selectUp()
|
||||
*
|
||||
* Moves the selection up one row.
|
||||
**/
|
||||
this.selectUp = function() {
|
||||
|
|
@ -304,8 +305,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectDown()
|
||||
*
|
||||
* Selection.selectDown()
|
||||
*
|
||||
* Moves the selection down one row.
|
||||
**/
|
||||
this.selectDown = function() {
|
||||
|
|
@ -313,8 +314,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectRight()
|
||||
*
|
||||
* Selection.selectRight()
|
||||
*
|
||||
* Moves the selection right one column.
|
||||
**/
|
||||
this.selectRight = function() {
|
||||
|
|
@ -322,8 +323,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectLeft()
|
||||
*
|
||||
* Selection.selectLeft()
|
||||
*
|
||||
* Moves the selection left one column.
|
||||
**/
|
||||
this.selectLeft = function() {
|
||||
|
|
@ -331,8 +332,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectLineStart()
|
||||
*
|
||||
* Selection.selectLineStart()
|
||||
*
|
||||
* Moves the selection to the beginning of the current line.
|
||||
**/
|
||||
this.selectLineStart = function() {
|
||||
|
|
@ -340,8 +341,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectLineEnd()
|
||||
*
|
||||
* Selection.selectLineEnd()
|
||||
*
|
||||
* Moves the selection to the end of the current line.
|
||||
**/
|
||||
this.selectLineEnd = function() {
|
||||
|
|
@ -349,8 +350,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectFileEnd()
|
||||
*
|
||||
* Selection.selectFileEnd()
|
||||
*
|
||||
* Moves the selection to the end of the file.
|
||||
**/
|
||||
this.selectFileEnd = function() {
|
||||
|
|
@ -358,8 +359,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectFileStart()
|
||||
*
|
||||
* Selection.selectFileStart()
|
||||
*
|
||||
* Moves the selection to the start of the file.
|
||||
**/
|
||||
this.selectFileStart = function() {
|
||||
|
|
@ -367,8 +368,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectWordRight()
|
||||
*
|
||||
* Selection.selectWordRight()
|
||||
*
|
||||
* Moves the selection to the first word on the right.
|
||||
**/
|
||||
this.selectWordRight = function() {
|
||||
|
|
@ -376,8 +377,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.selectWordLeft()
|
||||
*
|
||||
* Selection.selectWordLeft()
|
||||
*
|
||||
* Moves the selection to the first word on the left.
|
||||
**/
|
||||
this.selectWordLeft = function() {
|
||||
|
|
@ -385,8 +386,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/** related to: EditSession.getWordRange
|
||||
* Selection.selectWord()
|
||||
*
|
||||
* Selection.selectWord()
|
||||
*
|
||||
* Moves the selection to highlight the entire word.
|
||||
**/
|
||||
this.getWordRange = function(row, column) {
|
||||
|
|
@ -403,8 +404,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/** related to: EditSession.getAWordRange
|
||||
* Selection.selectAWord()
|
||||
*
|
||||
* Selection.selectAWord()
|
||||
*
|
||||
* Selects a word, including its right whitespace.
|
||||
**/
|
||||
this.selectAWord = function() {
|
||||
|
|
@ -430,9 +431,9 @@ var Selection = function(session) {
|
|||
return new Range(rowStart, 0, rowEnd + 1, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Selection.selectLine()
|
||||
*
|
||||
/**
|
||||
* Selection.selectLine()
|
||||
*
|
||||
* Selects the entire line.
|
||||
**/
|
||||
this.selectLine = function() {
|
||||
|
|
@ -440,8 +441,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorUp()
|
||||
*
|
||||
* Selection.moveCursorUp()
|
||||
*
|
||||
* Moves the cursor up one row.
|
||||
**/
|
||||
this.moveCursorUp = function() {
|
||||
|
|
@ -449,8 +450,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorDown()
|
||||
*
|
||||
* Selection.moveCursorDown()
|
||||
*
|
||||
* Moves the cursor down one row.
|
||||
**/
|
||||
this.moveCursorDown = function() {
|
||||
|
|
@ -458,8 +459,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLeft()
|
||||
*
|
||||
* Selection.moveCursorLeft()
|
||||
*
|
||||
* Moves the cursor left one column.
|
||||
**/
|
||||
this.moveCursorLeft = function() {
|
||||
|
|
@ -484,8 +485,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorRight()
|
||||
*
|
||||
* Selection.moveCursorRight()
|
||||
*
|
||||
* Moves the cursor right one column.
|
||||
**/
|
||||
this.moveCursorRight = function() {
|
||||
|
|
@ -510,8 +511,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLineStart()
|
||||
*
|
||||
* Selection.moveCursorLineStart()
|
||||
*
|
||||
* Moves the cursor to the start of the line.
|
||||
**/
|
||||
this.moveCursorLineStart = function() {
|
||||
|
|
@ -543,8 +544,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLineEnd()
|
||||
*
|
||||
* Selection.moveCursorLineEnd()
|
||||
*
|
||||
* Moves the cursor to the end of the line.
|
||||
**/
|
||||
this.moveCursorLineEnd = function() {
|
||||
|
|
@ -558,8 +559,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorFileEnd()
|
||||
*
|
||||
* Selection.moveCursorFileEnd()
|
||||
*
|
||||
* Moves the cursor to the end of the file.
|
||||
**/
|
||||
this.moveCursorFileEnd = function() {
|
||||
|
|
@ -569,8 +570,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorFileStart()
|
||||
*
|
||||
* Selection.moveCursorFileStart()
|
||||
*
|
||||
* Moves the cursor to the start of the file.
|
||||
**/
|
||||
this.moveCursorFileStart = function() {
|
||||
|
|
@ -578,8 +579,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLongWordRight()
|
||||
*
|
||||
* Selection.moveCursorLongWordRight()
|
||||
*
|
||||
* Moves the cursor to the word on the right.
|
||||
**/
|
||||
this.moveCursorLongWordRight = function() {
|
||||
|
|
@ -598,14 +599,14 @@ var Selection = function(session) {
|
|||
this.moveCursorTo(fold.end.row, fold.end.column);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// first skip space
|
||||
if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
|
||||
column += this.session.nonTokenRe.lastIndex;
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
rightOfCursor = line.substring(column);
|
||||
}
|
||||
|
||||
|
||||
// if at line end proceed with next line
|
||||
if (column >= line.length) {
|
||||
this.moveCursorTo(row, line.length);
|
||||
|
|
@ -614,7 +615,7 @@ var Selection = function(session) {
|
|||
this.moveCursorWordRight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// advance to the end of the next token
|
||||
if (match = this.session.tokenRe.exec(rightOfCursor)) {
|
||||
column += this.session.tokenRe.lastIndex;
|
||||
|
|
@ -625,8 +626,8 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorLongWordLeft()
|
||||
*
|
||||
* Selection.moveCursorLongWordLeft()
|
||||
*
|
||||
* Moves the cursor to the word on the left.
|
||||
**/
|
||||
this.moveCursorLongWordLeft = function() {
|
||||
|
|
@ -644,19 +645,19 @@ var Selection = function(session) {
|
|||
if (str == null) {
|
||||
str = this.doc.getLine(row).substring(0, column)
|
||||
}
|
||||
|
||||
|
||||
var leftOfCursor = lang.stringReverse(str);
|
||||
var match;
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
this.session.tokenRe.lastIndex = 0;
|
||||
|
||||
|
||||
// skip whitespace
|
||||
if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
|
||||
column -= this.session.nonTokenRe.lastIndex;
|
||||
leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
// if at begin of the line proceed in line above
|
||||
if (column <= 0) {
|
||||
this.moveCursorTo(row, 0);
|
||||
|
|
@ -762,7 +763,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/** related to: EditSession.documentToScreenPosition
|
||||
* Selection.moveCursorBy(rows, chars)
|
||||
* Selection.moveCursorBy(rows, chars)
|
||||
* - rows (Number): The number of rows to move by
|
||||
* - chars (Number): The number of characters to move by
|
||||
*
|
||||
|
|
@ -788,9 +789,9 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorToPosition(position)
|
||||
* Selection.moveCursorToPosition(position)
|
||||
* - position (Object): The position to move to
|
||||
*
|
||||
*
|
||||
* Moves the selection to the position indicated by its `row` and `column`.
|
||||
**/
|
||||
this.moveCursorToPosition = function(position) {
|
||||
|
|
@ -798,7 +799,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorTo(row, column, keepDesiredColumn)
|
||||
* Selection.moveCursorTo(row, column, keepDesiredColumn)
|
||||
* - row (Number): The row to move to
|
||||
* - column (Number): The column to move to
|
||||
* - keepDesiredColumn (Boolean): [If `true`, the cursor move does not respect the previous column]{: #preventUpdateBool}
|
||||
|
|
@ -822,7 +823,7 @@ var Selection = function(session) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Selection.moveCursorToScreen(row, column, keepDesiredColumn)
|
||||
* Selection.moveCursorToScreen(row, column, keepDesiredColumn)
|
||||
* - row (Number): The row to move to
|
||||
* - column (Number): The column to move to
|
||||
* - keepDesiredColumn (Boolean): {:preventUpdateBool}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,11 @@ if (location.search)
|
|||
testNames = location.search.substr(1).split(",")
|
||||
|
||||
require(testNames, function() {
|
||||
var tests = testNames.map(require);
|
||||
var tests = testNames.map(function(x) {
|
||||
var module = require(x);
|
||||
module.href = x;
|
||||
return module;
|
||||
});
|
||||
|
||||
async.list(tests)
|
||||
.expand(function(test) {
|
||||
|
|
@ -73,6 +77,12 @@ require(testNames, function() {
|
|||
}, AsyncTest.TestGenerator)
|
||||
.run()
|
||||
.each(function(test, next) {
|
||||
if (test.index == 1 && test.context.href) {
|
||||
var href = test.context.href;
|
||||
var node = document.createElement("div");
|
||||
node.innerHTML = "<a href='?" + href + "'>" + href.replace(/^ace\//, "") + "</a>";
|
||||
log.appendChild(node);
|
||||
}
|
||||
var node = document.createElement("div");
|
||||
node.className = test.passed ? "passed" : "failed";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue