1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 01:47:59 +01:00

Enable v_y in caret mode. Closes issue #685.

This commit is contained in:
Kris Maglione
2011-10-09 05:34:18 -04:00
parent 0307817e4d
commit cd9605af3b
3 changed files with 18 additions and 10 deletions

View File

@@ -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);

View File

@@ -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();
@@ -1010,15 +1010,18 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
mappings.add([modes.VISUAL], key,
desc,
function ({ count, motion }) {
dactyl.assert(editor.isTextEdit);
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) {

View File

@@ -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.