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) { echoerr: function echoerr(str, flags) {
flags |= commandline.APPEND_TO_MESSAGES; 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)) || isinstance(str, ["XPCWrappedNative_NoHelper"]) && /^\[Exception/.test(str))
dactyl.reportError(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(["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"); 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) { function doTxn(range, editor) {
try { try {
editor.editor.beginTransaction(); editor.editor.beginTransaction();
@@ -1007,18 +1007,21 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
}, },
{ count: true, type: "motion" }); { count: true, type: "motion" });
mappings.add([modes.VISUAL], key, mappings.add([modes.VISUAL], key,
desc, desc,
function ({ count, motion }) { function ({ count, motion }) {
dactyl.assert(editor.isTextEdit); dactyl.assert(caretOk || editor.isTextEdit);
doTxn(editor.selectedRange, editor); if (modes.isTextEdit)
}, doTxn(editor.selectedRange, editor);
{ count: true, type: "motion" }); else
cmd(editor, buffer.selection.getRangeAt(0));
},
{ count: true, type: "motion" });
} }
addMotionMap(["d", "x"], "Delete text", true, function (editor) { editor.cut(); }); 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(); }, 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, addMotionMap(["gu"], "Lowercase text", false,
function (editor, range) { function (editor, range) {

View File

@@ -557,6 +557,11 @@ var Buffer = Module("Buffer", {
0); 0);
}, },
/**
* @property {nsISelection} The current document's normal selection.
*/
get selection() this.win.getSelection(),
/** /**
* @property {nsISelectionController} The current document's selection * @property {nsISelectionController} The current document's selection
* controller. * controller.