//
// 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 */
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) {
}
},
- findChar: function findNumber(key, count, backward, offset) {
+ findChar: function findChar(key, count, backward, offset) {
count = count || 1; // XXX ?
offset = (offset || 0) - !!backward;
if (textBox) {
textBox.value = val;
- if (false) {
+ if (true) {
let elem = DOM(textBox);
elem.attrNS(NS, "modifiable", true)
.style.MozUserInput;
return DOM(elem).editor;
}
}, {
- modes: function init_modes() {
+ modes: function initModes() {
modes.addMode("OPERATOR", {
char: "o",
description: "Mappings which move the cursor",
bases: [modes.INSERT]
});
},
- commands: function init_commands() {
+ commands: function initCommands() {
commands.add(["reg[isters]"],
"List the contents of known registers",
function (args) {
},
{ 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 };
});
};
},
- mappings: function init_mappings() {
+ mappings: function initMappings() {
Map.types["editor"] = {
preExecute: function preExecute(args) {
if (editor.editor && !this.editor) {
this.editor = editor.editor;
- this.editor.beginTransaction();
+ if (!this.noTransaction)
+ this.editor.beginTransaction();
}
editor.inEditMap = true;
},
postExecute: function preExecute(args) {
editor.inEditMap = false;
if (this.editor) {
- this.editor.endTransaction();
+ if (!this.noTransaction)
+ this.editor.endTransaction();
this.editor = null;
}
},
}
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,
// text edit mode
bind(["u"], "Undo changes",
function (args) {
- editor.executeCommand("cmd_undo", Math.max(args.count, 1));
+ editor.editor.undo(Math.max(args.count, 1));
editor.deselect();
},
- { count: true });
+ { count: true, noTransaction: true });
bind(["<C-r>"], "Redo undone changes",
function (args) {
- editor.executeCommand("cmd_redo", Math.max(args.count, 1));
+ editor.editor.redo(Math.max(args.count, 1));
editor.deselect();
},
- { count: true });
+ { count: true, noTransaction: true });
bind(["D"], "Delete characters from the cursor to the end of the line",
function () { editor.executeCommand("cmd_deleteToEndOfLine"); });
bind(["<C-n>"], "Select the next autocomplete result",
function () { events.feedkeys("<Down>", { skipmap: true }); });
},
- options: function init_options() {
+ options: function initOptions() {
options.add(["editor"],
"The external text editor",
"string", 'gvim -f +<line> +"sil! call cursor(0, <column>)" <file>', {
}
});
},
- sanitizer: function () {
+ sanitizer: function initSanitizer() {
sanitizer.addItem("registers", {
description: "Register values",
persistent: true,