diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 672ceb1a..edc5e14b 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -422,7 +422,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { echoerr: function echoerr(str, flags) { flags |= commandline.APPEND_TO_MESSAGES; - if (isinstance(str, ["DOMException", "Error", "Exception"]) + if (isinstance(str, ["DOMException", "Error", "Exception", ErrorBase]) || isinstance(str, ["XPCWrappedNative_NoHelper"]) && /^\[Exception/.test(str)) dactyl.reportError(str); diff --git a/common/content/editor.js b/common/content/editor.js index 14a4a11b..0caf5a4f 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -963,7 +963,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { addBeginInsertModeMap(["S"], ["cmd_deleteToEndOfLine", "cmd_deleteToBeginningOfLine"], "Delete the current line and start insert"); addBeginInsertModeMap(["C"], ["cmd_deleteToEndOfLine"], "Delete from the cursor to the end of the line and start insert"); - function addMotionMap(key, desc, select, cmd, mode) { + function addMotionMap(key, desc, select, cmd, mode, caretOk) { function doTxn(range, editor) { try { editor.editor.beginTransaction(); @@ -1007,18 +1007,21 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), { }, { count: true, type: "motion" }); - mappings.add([modes.VISUAL], key, - desc, - function ({ count, motion }) { - dactyl.assert(editor.isTextEdit); - doTxn(editor.selectedRange, editor); - }, - { count: true, type: "motion" }); + mappings.add([modes.VISUAL], key, + desc, + function ({ count, motion }) { + dactyl.assert(caretOk || editor.isTextEdit); + if (modes.isTextEdit) + doTxn(editor.selectedRange, editor); + else + cmd(editor, buffer.selection.getRangeAt(0)); + }, + { count: true, type: "motion" }); } addMotionMap(["d", "x"], "Delete text", true, function (editor) { editor.cut(); }); addMotionMap(["c"], "Change text", true, function (editor) { editor.cut(); }, modes.INSERT); - addMotionMap(["y"], "Yank text", false, function (editor, range) { editor.copy(range); }); + addMotionMap(["y"], "Yank text", false, function (editor, range) { editor.copy(range); }, null, true); addMotionMap(["gu"], "Lowercase text", false, function (editor, range) { diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index b2939a98..1dd3861c 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -557,6 +557,11 @@ var Buffer = Module("Buffer", { 0); }, + /** + * @property {nsISelection} The current document's normal selection. + */ + get selection() this.win.getSelection(), + /** * @property {nsISelectionController} The current document's selection * controller.