X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fcontent%2Feditor.js;fp=common%2Fcontent%2Feditor.js;h=eef3c1ded03f38f4fecd42e038b8c192b47dafa3;hb=8b6fcae7eaa413bc62d645d2d0c99835c47265e6;hp=63ec3eb675b3e65fc32443f9365e445dcb9abee7;hpb=5ebd29f56d17f62011cdd596b1d351947ee534ff;p=dactyl.git diff --git a/common/content/editor.js b/common/content/editor.js index 63ec3eb..eef3c1d 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -3,7 +3,7 @@ // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; /** @scope modules */ @@ -168,14 +168,14 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { this.setRegister(name, range); }, - cut: function cut(range, name) { + cut: function cut(range, name, noStrip) { if (range) this.selectedRange = range; if (!this.selection.isCollapsed) this.setRegister(name, this.selection); - this.editor.deleteSelection(0); + this.editor.deleteSelection(0, this.editor[noStrip ? "eNoStrip" : "eStrip"]); }, paste: function paste(name) { @@ -688,7 +688,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { return DOM(elem).editor; } }, { - modes: function init_modes() { + modes: function initModes() { modes.addMode("OPERATOR", { char: "o", description: "Mappings which move the cursor", @@ -745,7 +745,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { bases: [modes.INSERT] }); }, - commands: function init_commands() { + commands: function initCommands() { commands.add(["reg[isters]"], "List the contents of known registers", function (args) { @@ -753,7 +753,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { }, { argCount: "*" }); }, - completion: function init_completion() { + completion: function initCompletion() { completion.register = function complete_register(context) { context = context.fork("registers"); context.keys = { text: util.identity, description: editor.closure.getRegister }; @@ -777,7 +777,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { }); }; }, - mappings: function init_mappings() { + mappings: function initMappings() { Map.types["editor"] = { preExecute: function preExecute(args) { @@ -1035,7 +1035,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { } addMotionMap(["d", "x"], "Delete text", true, function (editor) { editor.cut(); }); - addMotionMap(["c"], "Change text", true, function (editor) { editor.cut(); }, modes.INSERT); + addMotionMap(["c"], "Change text", true, function (editor) { editor.cut(null, null, true); }, modes.INSERT); addMotionMap(["y"], "Yank text", false, function (editor, range) { editor.copy(range); }, null, true); addMotionMap(["gu"], "Lowercase text", false, @@ -1346,7 +1346,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { bind([""], "Select the next autocomplete result", function () { events.feedkeys("", { skipmap: true }); }); }, - options: function init_options() { + options: function initOptions() { options.add(["editor"], "The external text editor", "string", 'gvim -f + +"sil! call cursor(0, )" ', { @@ -1391,7 +1391,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { } }); }, - sanitizer: function () { + sanitizer: function initSanitizer() { sanitizer.addItem("registers", { description: "Register values", persistent: true,