diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js index 7a40b833..38b2f328 100644 --- a/lib/ace/commands/default_commands.js +++ b/lib/ace/commands/default_commands.js @@ -39,156 +39,156 @@ define(function(require, exports, module) { var PluginManager = require("ace/plugin_manager").PluginManager; -PluginManager.registerCommand("selectall", function(editor, selection) { - selection.selectAll(); +PluginManager.registerCommand("selectall", function(env, args, request) { + env.selection.selectAll(); }); -PluginManager.registerCommand("removeline", function(editor, selection) { - editor.removeLines(); +PluginManager.registerCommand("removeline", function(env, args, request) { + env.editor.removeLines(); }); -PluginManager.registerCommand("gotoline", function(editor, selection) { +PluginManager.registerCommand("gotoline", function(env, args, request) { var line = parseInt(prompt("Enter line number:")); if (!isNaN(line)) { - editor.gotoLine(line); + env.editor.gotoLine(line); } }); -PluginManager.registerCommand("togglecomment", function(editor, selection) { - editor.toggleCommentLines(); +PluginManager.registerCommand("togglecomment", function(env, args, request) { + env.editor.toggleCommentLines(); }); -PluginManager.registerCommand("findnext", function(editor, selection) { - editor.findNext(); +PluginManager.registerCommand("findnext", function(env, args, request) { + env.editor.findNext(); }); -PluginManager.registerCommand("findprevious", function(editor, selection) { - editor.findPrevious(); +PluginManager.registerCommand("findprevious", function(env, args, request) { + env.editor.findPrevious(); }); -PluginManager.registerCommand("find", function(editor, selection) { +PluginManager.registerCommand("find", function(env, args, request) { var needle = prompt("Find:"); - editor.find(needle); + env.editor.find(needle); }); -PluginManager.registerCommand("undo", function(editor, selection) { - editor.undo(); +PluginManager.registerCommand("undo", function(env, args, request) { + env.editor.undo(); }); -PluginManager.registerCommand("redo", function(editor, selection) { - editor.redo(); +PluginManager.registerCommand("redo", function(env, args, request) { + env.editor.redo(); }); -PluginManager.registerCommand("redo", function(editor, selection) { - editor.redo(); +PluginManager.registerCommand("redo", function(env, args, request) { + env.editor.redo(); }); -PluginManager.registerCommand("overwrite", function(editor, selection) { - editor.toggleOverwrite(); +PluginManager.registerCommand("overwrite", function(env, args, request) { + env.editor.toggleOverwrite(); }); -PluginManager.registerCommand("copylinesup", function(editor, selection) { - editor.copyLinesUp(); +PluginManager.registerCommand("copylinesup", function(env, args, request) { + env.editor.copyLinesUp(); }); -PluginManager.registerCommand("movelinesup", function(editor, selection) { - editor.moveLinesUp(); +PluginManager.registerCommand("movelinesup", function(env, args, request) { + env.editor.moveLinesUp(); }); -PluginManager.registerCommand("selecttostart", function(editor, selection) { - selection.selectFileStart(); +PluginManager.registerCommand("selecttostart", function(env, args, request) { + env.selection.selectFileStart(); }); -PluginManager.registerCommand("gotostart", function(editor, selection) { - editor.navigateFileStart(); +PluginManager.registerCommand("gotostart", function(env, args, request) { + env.editor.navigateFileStart(); }); -PluginManager.registerCommand("selectup", function(editor, selection) { - selection.selectUp(); +PluginManager.registerCommand("selectup", function(env, args, request) { + env.selection.selectUp(); }); -PluginManager.registerCommand("golineup", function(editor, selection) { - editor.navigateUp(); +PluginManager.registerCommand("golineup", function(env, args, request) { + env.editor.navigateUp(); }); -PluginManager.registerCommand("copylinesdown", function(editor, selection) { - editor.copyLinesDown(); +PluginManager.registerCommand("copylinesdown", function(env, args, request) { + env.editor.copyLinesDown(); }); -PluginManager.registerCommand("movelinesdown", function(editor, selection) { - editor.moveLinesDown(); +PluginManager.registerCommand("movelinesdown", function(env, args, request) { + env.editor.moveLinesDown(); }); -PluginManager.registerCommand("selecttoend", function(editor, selection) { - selection.selectFileEnd(); +PluginManager.registerCommand("selecttoend", function(env, args, request) { + env.selection.selectFileEnd(); }); -PluginManager.registerCommand("gotoend", function(editor, selection) { - editor.navigateFileEnd(); +PluginManager.registerCommand("gotoend", function(env, args, request) { + env.editor.navigateFileEnd(); }); -PluginManager.registerCommand("selectdown", function(editor, selection) { - selection.selectDown(); +PluginManager.registerCommand("selectdown", function(env, args, request) { + env.selection.selectDown(); }); -PluginManager.registerCommand("godown", function(editor, selection) { - editor.navigateDown(); +PluginManager.registerCommand("godown", function(env, args, request) { + env.editor.navigateDown(); }); -PluginManager.registerCommand("selectwordleft", function(editor, selection) { - selection.selectWordLeft(); +PluginManager.registerCommand("selectwordleft", function(env, args, request) { + env.selection.selectWordLeft(); }); -PluginManager.registerCommand("gotowordleft", function(editor, selection) { - editor.navigateWordLeft(); +PluginManager.registerCommand("gotowordleft", function(env, args, request) { + env.editor.navigateWordLeft(); }); -PluginManager.registerCommand("selecttolinestart", function(editor, selection) { - selection.selectLineStart(); +PluginManager.registerCommand("selecttolinestart", function(env, args, request) { + env.selection.selectLineStart(); }); -PluginManager.registerCommand("gotolinestart", function(editor, selection) { - editor.navigateLineStart(); +PluginManager.registerCommand("gotolinestart", function(env, args, request) { + env.editor.navigateLineStart(); }); -PluginManager.registerCommand("selectleft", function(editor, selection) { - selection.selectLeft(); +PluginManager.registerCommand("selectleft", function(env, args, request) { + env.selection.selectLeft(); }); -PluginManager.registerCommand("gotoleft", function(editor, selection) { - editor.navigateLeft(); +PluginManager.registerCommand("gotoleft", function(env, args, request) { + env.editor.navigateLeft(); }); -PluginManager.registerCommand("selectwordright", function(editor, selection) { - selection.selectWordRight(); +PluginManager.registerCommand("selectwordright", function(env, args, request) { + env.selection.selectWordRight(); }); -PluginManager.registerCommand("gotowordright", function(editor, selection) { - editor.navigateWordRight(); +PluginManager.registerCommand("gotowordright", function(env, args, request) { + env.editor.navigateWordRight(); }); -PluginManager.registerCommand("selecttolineend", function(editor, selection) { - selection.selectLineEnd(); +PluginManager.registerCommand("selecttolineend", function(env, args, request) { + env.selection.selectLineEnd(); }); -PluginManager.registerCommand("gotolineend", function(editor, selection) { - editor.navigateLineEnd(); +PluginManager.registerCommand("gotolineend", function(env, args, request) { + env.editor.navigateLineEnd(); }); -PluginManager.registerCommand("selectright", function(editor, selection) { - selection.selectRight(); +PluginManager.registerCommand("selectright", function(env, args, request) { + env.selection.selectRight(); }); -PluginManager.registerCommand("gotoright", function(editor, selection) { - editor.navigateRight(); +PluginManager.registerCommand("gotoright", function(env, args, request) { + env.editor.navigateRight(); }); -PluginManager.registerCommand("selectpagedown", function(editor, selection) { - editor.selectPageDown(); +PluginManager.registerCommand("selectpagedown", function(env, args, request) { + env.editor.selectPageDown(); }); -PluginManager.registerCommand("pagedown", function(editor, selection) { - editor.scrollPageDown(); +PluginManager.registerCommand("pagedown", function(env, args, request) { + env.editor.scrollPageDown(); }); -PluginManager.registerCommand("gotopagedown", function(editor, selection) { - editor.gotoPageDown(); +PluginManager.registerCommand("gotopagedown", function(env, args, request) { + env.editor.gotoPageDown(); }); -PluginManager.registerCommand("selectpageup", function(editor, selection) { - editor.selectPageUp(); +PluginManager.registerCommand("selectpageup", function(env, args, request) { + env.editor.selectPageUp(); }); -PluginManager.registerCommand("pageup", function(editor, selection) { - editor.scrollPageUp(); +PluginManager.registerCommand("pageup", function(env, args, request) { + env.editor.scrollPageUp(); }); -PluginManager.registerCommand("gotopageup", function(editor, selection) { - editor.gotoPageUp(); +PluginManager.registerCommand("gotopageup", function(env, args, request) { + env.editor.gotoPageUp(); }); -PluginManager.registerCommand("selectlinestart", function(editor, selection) { - selection.selectLineStart(); +PluginManager.registerCommand("selectlinestart", function(env, args, request) { + env.selection.selectLineStart(); }); -PluginManager.registerCommand("gotolinestart", function(editor, selection) { - editor.navigateLineStart(); +PluginManager.registerCommand("gotolinestart", function(env, args, request) { + env.editor.navigateLineStart(); }); -PluginManager.registerCommand("selectlineend", function(editor, selection) { - selection.selectLineEnd(); +PluginManager.registerCommand("selectlineend", function(env, args, request) { + env.selection.selectLineEnd(); }); -PluginManager.registerCommand("gotolineend", function(editor, selection) { - editor.navigateLineEnd(); +PluginManager.registerCommand("gotolineend", function(env, args, request) { + env.editor.navigateLineEnd(); }); -PluginManager.registerCommand("del", function(editor, selection) { - editor.removeRight(); +PluginManager.registerCommand("del", function(env, args, request) { + env.editor.removeRight(); }); -PluginManager.registerCommand("backspace", function(editor, selection) { - editor.removeLeft(); +PluginManager.registerCommand("backspace", function(env, args, request) { + env.editor.removeLeft(); }); -PluginManager.registerCommand("outdent", function(editor, selection) { - editor.blockOutdent(); +PluginManager.registerCommand("outdent", function(env, args, request) { + env.editor.blockOutdent(); }); -PluginManager.registerCommand("indent", function(editor, selection) { - editor.indent(); +PluginManager.registerCommand("indent", function(env, args, request) { + env.editor.indent(); }); }); \ No newline at end of file diff --git a/lib/ace/document.js b/lib/ace/document.js index ee02000b..903b8e51 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -73,13 +73,13 @@ var Document = function(text, mode) { return text.split(/\r\n|\r|\n/); }; - this.setValue = function(text) { - var args = [0, this.lines.length]; - args.push.apply(args, this.$split(text)); - this.lines.splice.apply(this.lines, args); - this.modified = true; - this.fireChangeEvent(0); - }; + this.setValue = function(text) { + var args = [0, this.lines.length]; + args.push.apply(args, this.$split(text)); + this.lines.splice.apply(this.lines, args); + this.modified = true; + this.fireChangeEvent(0); + }; this.toString = function() { return this.lines.join(this.$getNewLineCharacter()); diff --git a/lib/ace/keybinding.js b/lib/ace/keybinding.js index 2a3ba8ec..afea13ab 100644 --- a/lib/ace/keybinding.js +++ b/lib/ace/keybinding.js @@ -58,7 +58,8 @@ var KeyBinding = function(element, editor, config) { var command = PluginManager.commands[commandName]; if (command) { - command(editor, editor.getSelection()); + var env = { editor: editor, selection: editor.getSelection() }; + command(env); return event.stopEvent(e); } }); diff --git a/lib/ace/plugin_manager.js b/lib/ace/plugin_manager.js index eeffd15a..5446a69f 100644 --- a/lib/ace/plugin_manager.js +++ b/lib/ace/plugin_manager.js @@ -46,4 +46,4 @@ var PluginManager = { }; exports.PluginManager = PluginManager; -}); \ No newline at end of file +});