mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 17:17:58 +01:00
Rename TEXTAREA mode to TEXT EDIT mode, and move it from :imap to :tmap.
--HG-- branch : mode-refactoring
This commit is contained in:
@@ -19,7 +19,7 @@ const Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
get isCaret() modes.getStack(1).main === modes.CARET,
|
get isCaret() modes.getStack(1).main === modes.CARET,
|
||||||
get isTextArea() modes.getStack(1).main === modes.TEXTAREA,
|
get isTextEdit() modes.getStack(1).main === modes.TEXT_EDIT,
|
||||||
|
|
||||||
line: function () {
|
line: function () {
|
||||||
let line = 1;
|
let line = 1;
|
||||||
@@ -189,16 +189,16 @@ const Editor = Module("editor", {
|
|||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case "d":
|
case "d":
|
||||||
this.executeCommand("cmd_delete", 1);
|
this.executeCommand("cmd_delete", 1);
|
||||||
modes.pop(modes.TEXTAREA);
|
modes.pop(modes.TEXT_EDIT);
|
||||||
break;
|
break;
|
||||||
case "c":
|
case "c":
|
||||||
this.executeCommand("cmd_delete", 1);
|
this.executeCommand("cmd_delete", 1);
|
||||||
modes.pop(modes.TEXTAREA);
|
modes.pop(modes.TEXT_EDIT);
|
||||||
modes.push(modes.INSERT);
|
modes.push(modes.INSERT);
|
||||||
break;
|
break;
|
||||||
case "y":
|
case "y":
|
||||||
this.executeCommand("cmd_copy", 1);
|
this.executeCommand("cmd_copy", 1);
|
||||||
modes.pop(modes.TEXTAREA);
|
modes.pop(modes.TEXT_EDIT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -436,8 +436,8 @@ const Editor = Module("editor", {
|
|||||||
mappings: function () {
|
mappings: function () {
|
||||||
var myModes = [modes.INSERT, modes.COMMAND_LINE];
|
var myModes = [modes.INSERT, modes.COMMAND_LINE];
|
||||||
|
|
||||||
// add mappings for commands like h,j,k,l,etc. in CARET, VISUAL and TEXTAREA mode
|
// add mappings for commands like h,j,k,l,etc. in CARET, VISUAL and TEXT_EDIT mode
|
||||||
function addMovementMap(keys, hasCount, caretModeMethod, caretModeArg, textareaCommand, visualTextareaCommand) {
|
function addMovementMap(keys, hasCount, caretModeMethod, caretModeArg, textEditCommand, visualTextEditCommand) {
|
||||||
let extraInfo = {};
|
let extraInfo = {};
|
||||||
if (hasCount)
|
if (hasCount)
|
||||||
extraInfo.count = true;
|
extraInfo.count = true;
|
||||||
@@ -483,11 +483,11 @@ const Editor = Module("editor", {
|
|||||||
|
|
||||||
let controller = buffer.selectionController;
|
let controller = buffer.selectionController;
|
||||||
while (count-- && modes.main == modes.VISUAL) {
|
while (count-- && modes.main == modes.VISUAL) {
|
||||||
if (editor.isTextArea) {
|
if (editor.isTextEdit) {
|
||||||
if (typeof visualTextareaCommand == "function")
|
if (typeof visualTextEditCommand == "function")
|
||||||
visualTextareaCommand();
|
visualTextEditCommand();
|
||||||
else
|
else
|
||||||
editor.executeCommand(visualTextareaCommand);
|
editor.executeCommand(visualTextEditCommand);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
caretExecute(true, true);
|
caretExecute(true, true);
|
||||||
@@ -495,19 +495,19 @@ const Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
extraInfo);
|
extraInfo);
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA], keys, "",
|
mappings.add([modes.TEXT_EDIT], keys, "",
|
||||||
function (count) {
|
function (count) {
|
||||||
if (typeof count != "number" || count < 1)
|
if (typeof count != "number" || count < 1)
|
||||||
count = 1;
|
count = 1;
|
||||||
|
|
||||||
editor.executeCommand(textareaCommand, count);
|
editor.executeCommand(textEditCommand, count);
|
||||||
},
|
},
|
||||||
extraInfo);
|
extraInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add mappings for commands like i,a,s,c,etc. in TEXTAREA mode
|
// add mappings for commands like i,a,s,c,etc. in TEXT_EDIT mode
|
||||||
function addBeginInsertModeMap(keys, commands) {
|
function addBeginInsertModeMap(keys, commands) {
|
||||||
mappings.add([modes.TEXTAREA], keys, "",
|
mappings.add([modes.TEXT_EDIT], keys, "",
|
||||||
function (count) {
|
function (count) {
|
||||||
commands.forEach(function (cmd)
|
commands.forEach(function (cmd)
|
||||||
editor.executeCommand(cmd, 1));
|
editor.executeCommand(cmd, 1));
|
||||||
@@ -516,7 +516,7 @@ const Editor = Module("editor", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addMotionMap(key) {
|
function addMotionMap(key) {
|
||||||
mappings.add([modes.TEXTAREA], [key],
|
mappings.add([modes.TEXT_EDIT], [key],
|
||||||
"Motion command",
|
"Motion command",
|
||||||
function (motion, count) { editor.executeCommandWithMotion(key, motion, count); },
|
function (motion, count) { editor.executeCommandWithMotion(key, motion, count); },
|
||||||
{ count: true, motion: true });
|
{ count: true, motion: true });
|
||||||
@@ -532,7 +532,7 @@ const Editor = Module("editor", {
|
|||||||
editor.executeCommand("cmd_selectLineNext");
|
editor.executeCommand("cmd_selectLineNext");
|
||||||
}
|
}
|
||||||
|
|
||||||
// KEYS COUNT CARET TEXTAREA VISUAL_TEXTAREA
|
// KEYS COUNT CARET TEXT_EDIT VISUAL_TEXT_EDIT
|
||||||
addMovementMap(["k", "<Up>"], true, "lineMove", false, "cmd_linePrevious", selectPreviousLine);
|
addMovementMap(["k", "<Up>"], true, "lineMove", false, "cmd_linePrevious", selectPreviousLine);
|
||||||
addMovementMap(["j", "<Down>", "<Return>"], true, "lineMove", true, "cmd_lineNext", selectNextLine);
|
addMovementMap(["j", "<Down>", "<Return>"], true, "lineMove", true, "cmd_lineNext", selectNextLine);
|
||||||
addMovementMap(["h", "<Left>", "<BS>"], true, "characterMove", false, "cmd_charPrevious", "cmd_selectCharPrevious");
|
addMovementMap(["h", "<Left>", "<BS>"], true, "characterMove", false, "cmd_charPrevious", "cmd_selectCharPrevious");
|
||||||
@@ -612,8 +612,8 @@ const Editor = Module("editor", {
|
|||||||
mappings.add([modes.INSERT],
|
mappings.add([modes.INSERT],
|
||||||
["<C-t>"], "Edit text field in Vi mode",
|
["<C-t>"], "Edit text field in Vi mode",
|
||||||
function () {
|
function () {
|
||||||
if (!editor.isTextArea)
|
if (!editor.isTextEdit)
|
||||||
modes.push(modes.TEXTAREA);
|
modes.push(modes.TEXT_EDIT);
|
||||||
else
|
else
|
||||||
dactyl.beep();
|
dactyl.beep();
|
||||||
});
|
});
|
||||||
@@ -631,8 +631,8 @@ const Editor = Module("editor", {
|
|||||||
["<C-]>", "<C-5>"], "Expand insert mode abbreviation",
|
["<C-]>", "<C-5>"], "Expand insert mode abbreviation",
|
||||||
function () { editor.expandAbbreviation(modes.INSERT); });
|
function () { editor.expandAbbreviation(modes.INSERT); });
|
||||||
|
|
||||||
// textarea mode
|
// text edit mode
|
||||||
mappings.add([modes.TEXTAREA],
|
mappings.add([modes.TEXT_EDIT],
|
||||||
["u"], "Undo",
|
["u"], "Undo",
|
||||||
function (count) {
|
function (count) {
|
||||||
editor.executeCommand("cmd_undo", count);
|
editor.executeCommand("cmd_undo", count);
|
||||||
@@ -640,7 +640,7 @@ const Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA],
|
mappings.add([modes.TEXT_EDIT],
|
||||||
["<C-r>"], "Redo",
|
["<C-r>"], "Redo",
|
||||||
function (count) {
|
function (count) {
|
||||||
editor.executeCommand("cmd_redo", count);
|
editor.executeCommand("cmd_redo", count);
|
||||||
@@ -648,11 +648,11 @@ const Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA],
|
mappings.add([modes.TEXT_EDIT],
|
||||||
["D"], "Delete the characters under the cursor until the end of the line",
|
["D"], "Delete the characters under the cursor until the end of the line",
|
||||||
function () { editor.executeCommand("cmd_deleteToEndOfLine"); });
|
function () { editor.executeCommand("cmd_deleteToEndOfLine"); });
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA],
|
mappings.add([modes.TEXT_EDIT],
|
||||||
["o"], "Open line below current",
|
["o"], "Open line below current",
|
||||||
function (count) {
|
function (count) {
|
||||||
editor.executeCommand("cmd_endLine", 1);
|
editor.executeCommand("cmd_endLine", 1);
|
||||||
@@ -660,7 +660,7 @@ const Editor = Module("editor", {
|
|||||||
events.feedkeys("<Return>");
|
events.feedkeys("<Return>");
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA],
|
mappings.add([modes.TEXT_EDIT],
|
||||||
["O"], "Open line above current",
|
["O"], "Open line above current",
|
||||||
function (count) {
|
function (count) {
|
||||||
editor.executeCommand("cmd_beginLine", 1);
|
editor.executeCommand("cmd_beginLine", 1);
|
||||||
@@ -669,18 +669,18 @@ const Editor = Module("editor", {
|
|||||||
editor.executeCommand("cmd_linePrevious", 1);
|
editor.executeCommand("cmd_linePrevious", 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA],
|
mappings.add([modes.TEXT_EDIT],
|
||||||
["X"], "Delete character to the left",
|
["X"], "Delete character to the left",
|
||||||
function (count) { editor.executeCommand("cmd_deleteCharBackward", count); },
|
function (count) { editor.executeCommand("cmd_deleteCharBackward", count); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA],
|
mappings.add([modes.TEXT_EDIT],
|
||||||
["x"], "Delete character to the right",
|
["x"], "Delete character to the right",
|
||||||
function (count) { editor.executeCommand("cmd_deleteCharForward", count); },
|
function (count) { editor.executeCommand("cmd_deleteCharForward", count); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
// visual mode
|
// visual mode
|
||||||
mappings.add([modes.CARET, modes.TEXTAREA],
|
mappings.add([modes.CARET, modes.TEXT_EDIT],
|
||||||
["v"], "Start visual mode",
|
["v"], "Start visual mode",
|
||||||
function (count) { modes.push(modes.VISUAL); });
|
function (count) { modes.push(modes.VISUAL); });
|
||||||
|
|
||||||
@@ -688,7 +688,7 @@ const Editor = Module("editor", {
|
|||||||
["v"], "End visual mode",
|
["v"], "End visual mode",
|
||||||
function (count) { events.onEscape(); });
|
function (count) { events.onEscape(); });
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA],
|
mappings.add([modes.TEXT_EDIT],
|
||||||
["V"], "Start visual line mode",
|
["V"], "Start visual line mode",
|
||||||
function (count) {
|
function (count) {
|
||||||
modes.push(modes.VISUAL, modes.LINE);
|
modes.push(modes.VISUAL, modes.LINE);
|
||||||
@@ -699,15 +699,15 @@ const Editor = Module("editor", {
|
|||||||
mappings.add([modes.VISUAL],
|
mappings.add([modes.VISUAL],
|
||||||
["c", "s"], "Change selected text",
|
["c", "s"], "Change selected text",
|
||||||
function (count) {
|
function (count) {
|
||||||
dactyl.assert(editor.isTextArea);
|
dactyl.assert(editor.isTextEdit);
|
||||||
editor.executeCommand("cmd_cut");
|
editor.executeCommand("cmd_cut");
|
||||||
modes.replace(modes.INSERT, modes.TEXTAREA);
|
modes.replace(modes.INSERT, modes.TEXT_EDIT);
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.VISUAL],
|
mappings.add([modes.VISUAL],
|
||||||
["d"], "Delete selected text",
|
["d"], "Delete selected text",
|
||||||
function (count) {
|
function (count) {
|
||||||
if (editor.isTextArea) {
|
if (editor.isTextEdit) {
|
||||||
editor.executeCommand("cmd_cut");
|
editor.executeCommand("cmd_cut");
|
||||||
modes.pop();
|
modes.pop();
|
||||||
}
|
}
|
||||||
@@ -718,7 +718,7 @@ const Editor = Module("editor", {
|
|||||||
mappings.add([modes.VISUAL],
|
mappings.add([modes.VISUAL],
|
||||||
["y"], "Yank selected text",
|
["y"], "Yank selected text",
|
||||||
function (count) {
|
function (count) {
|
||||||
if (editor.isTextArea) {
|
if (editor.isTextEdit) {
|
||||||
editor.executeCommand("cmd_copy");
|
editor.executeCommand("cmd_copy");
|
||||||
modes.pop();
|
modes.pop();
|
||||||
}
|
}
|
||||||
@@ -726,7 +726,7 @@ const Editor = Module("editor", {
|
|||||||
dactyl.clipboardWrite(buffer.getCurrentWord(), true);
|
dactyl.clipboardWrite(buffer.getCurrentWord(), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add([modes.VISUAL, modes.TEXTAREA],
|
mappings.add([modes.VISUAL, modes.TEXT_EDIT],
|
||||||
["p"], "Paste clipboard contents",
|
["p"], "Paste clipboard contents",
|
||||||
function (count) {
|
function (count) {
|
||||||
dactyl.assert(!editor.isCaret);
|
dactyl.assert(!editor.isCaret);
|
||||||
@@ -734,11 +734,11 @@ const Editor = Module("editor", {
|
|||||||
count = 1;
|
count = 1;
|
||||||
while (count--)
|
while (count--)
|
||||||
editor.executeCommand("cmd_paste");
|
editor.executeCommand("cmd_paste");
|
||||||
modes.pop(modes.TEXTAREA);
|
modes.pop(modes.TEXT_EDIT);
|
||||||
});
|
});
|
||||||
|
|
||||||
// finding characters
|
// finding characters
|
||||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
mappings.add([modes.TEXT_EDIT, modes.VISUAL],
|
||||||
["f"], "Move to a character on the current line after the cursor",
|
["f"], "Move to a character on the current line after the cursor",
|
||||||
function (count, arg) {
|
function (count, arg) {
|
||||||
let pos = editor.findCharForward(arg, count);
|
let pos = editor.findCharForward(arg, count);
|
||||||
@@ -747,7 +747,7 @@ const Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
{ arg: true, count: true });
|
{ arg: true, count: true });
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
mappings.add([modes.TEXT_EDIT, modes.VISUAL],
|
||||||
["F"], "Move to a charater on the current line before the cursor",
|
["F"], "Move to a charater on the current line before the cursor",
|
||||||
function (count, arg) {
|
function (count, arg) {
|
||||||
let pos = editor.findCharBackward(arg, count);
|
let pos = editor.findCharBackward(arg, count);
|
||||||
@@ -756,7 +756,7 @@ const Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
{ arg: true, count: true });
|
{ arg: true, count: true });
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
mappings.add([modes.TEXT_EDIT, modes.VISUAL],
|
||||||
["t"], "Move before a character on the current line",
|
["t"], "Move before a character on the current line",
|
||||||
function (count, arg) {
|
function (count, arg) {
|
||||||
let pos = editor.findCharForward(arg, count);
|
let pos = editor.findCharForward(arg, count);
|
||||||
@@ -765,7 +765,7 @@ const Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
{ arg: true, count: true });
|
{ arg: true, count: true });
|
||||||
|
|
||||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
mappings.add([modes.TEXT_EDIT, modes.VISUAL],
|
||||||
["T"], "Move before a character on the current line, backwards",
|
["T"], "Move before a character on the current line, backwards",
|
||||||
function (count, arg) {
|
function (count, arg) {
|
||||||
let pos = editor.findCharBackward(arg, count);
|
let pos = editor.findCharBackward(arg, count);
|
||||||
@@ -774,8 +774,8 @@ const Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
{ arg: true, count: true });
|
{ arg: true, count: true });
|
||||||
|
|
||||||
// textarea and visual mode
|
// text edit and visual mode
|
||||||
mappings.add([modes.TEXTAREA, modes.VISUAL],
|
mappings.add([modes.TEXT_EDIT, modes.VISUAL],
|
||||||
["~"], "Switch case of the character under the cursor and move the cursor to the right",
|
["~"], "Switch case of the character under the cursor and move the cursor to the right",
|
||||||
function (count) {
|
function (count) {
|
||||||
if (modes.main == modes.VISUAL)
|
if (modes.main == modes.VISUAL)
|
||||||
@@ -794,7 +794,7 @@ const Editor = Module("editor", {
|
|||||||
text.substring(pos + 1);
|
text.substring(pos + 1);
|
||||||
editor.moveToPosition(pos + 1, true, false);
|
editor.moveToPosition(pos + 1, true, false);
|
||||||
}
|
}
|
||||||
modes.pop(modes.TEXTAREA);
|
modes.pop(modes.TEXT_EDIT);
|
||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -633,7 +633,7 @@ const Events = Module("events", {
|
|||||||
case modes.INSERT:
|
case modes.INSERT:
|
||||||
case modes.PASS_THROUGH:
|
case modes.PASS_THROUGH:
|
||||||
case modes.QUOTE:
|
case modes.QUOTE:
|
||||||
case modes.TEXTAREA:
|
case modes.TEXT_EDIT:
|
||||||
case modes.VISUAL:
|
case modes.VISUAL:
|
||||||
modes.pop();
|
modes.pop();
|
||||||
break;
|
break;
|
||||||
@@ -708,7 +708,7 @@ const Events = Module("events", {
|
|||||||
if (options["insertmode"])
|
if (options["insertmode"])
|
||||||
modes.set(modes.INSERT);
|
modes.set(modes.INSERT);
|
||||||
else {
|
else {
|
||||||
modes.set(modes.TEXTAREA);
|
modes.set(modes.TEXT_EDIT);
|
||||||
if (elem.selectionEnd - elem.selectionStart > 0)
|
if (elem.selectionEnd - elem.selectionStart > 0)
|
||||||
modes.push(modes.VISUAL);
|
modes.push(modes.VISUAL);
|
||||||
}
|
}
|
||||||
@@ -937,7 +937,7 @@ const Events = Module("events", {
|
|||||||
else { // if the key is neither a mapping nor the start of one
|
else { // if the key is neither a mapping nor the start of one
|
||||||
// the mode checking is necessary so that things like g<esc> do not beep
|
// the mode checking is necessary so that things like g<esc> do not beep
|
||||||
if (this._input.buffer != "" && !event.skipmap &&
|
if (this._input.buffer != "" && !event.skipmap &&
|
||||||
(mode & (modes.INSERT | modes.COMMAND_LINE | modes.TEXTAREA)))
|
(mode & (modes.INSERT | modes.COMMAND_LINE | modes.TEXT_EDIT)))
|
||||||
events.feedkeys(this._input.buffer, { noremap: true, skipmap: true });
|
events.feedkeys(this._input.buffer, { noremap: true, skipmap: true });
|
||||||
|
|
||||||
this._input.buffer = "";
|
this._input.buffer = "";
|
||||||
@@ -947,7 +947,7 @@ const Events = Module("events", {
|
|||||||
|
|
||||||
if (!isEscape(key)) {
|
if (!isEscape(key)) {
|
||||||
// allow key to be passed to the host app if we can't handle it
|
// allow key to be passed to the host app if we can't handle it
|
||||||
stop = (mode == modes.TEXTAREA);
|
stop = (mode == modes.TEXT_EDIT);
|
||||||
|
|
||||||
if (mode == modes.COMMAND_LINE) {
|
if (mode == modes.COMMAND_LINE) {
|
||||||
if (!(modes.extended & modes.INPUT_MULTILINE))
|
if (!(modes.extended & modes.INPUT_MULTILINE))
|
||||||
@@ -1015,7 +1015,7 @@ const Events = Module("events", {
|
|||||||
modes.pop(); // Really not ideal.
|
modes.pop(); // Really not ideal.
|
||||||
}
|
}
|
||||||
else if (couldCopy) {
|
else if (couldCopy) {
|
||||||
if (modes.main == modes.TEXTAREA && !options["insertmode"])
|
if (modes.main == modes.TEXT_EDIT && !options["insertmode"])
|
||||||
modes.push(modes.VISUAL);
|
modes.push(modes.VISUAL);
|
||||||
else if (dactyl.mode == modes.CARET)
|
else if (dactyl.mode == modes.CARET)
|
||||||
modes.push(modes.VISUAL);
|
modes.push(modes.VISUAL);
|
||||||
@@ -1091,7 +1091,7 @@ const Events = Module("events", {
|
|||||||
["<Tab>"], "Advance keyboard focus",
|
["<Tab>"], "Advance keyboard focus",
|
||||||
function () { document.commandDispatcher.advanceFocus(); });
|
function () { document.commandDispatcher.advanceFocus(); });
|
||||||
|
|
||||||
mappings.add([modes.NORMAL, modes.PLAYER, modes.VISUAL, modes.CARET, modes.INSERT, modes.TEXTAREA],
|
mappings.add([modes.NORMAL, modes.PLAYER, modes.VISUAL, modes.CARET, modes.INSERT, modes.TEXT_EDIT],
|
||||||
["<S-Tab>"], "Rewind keyboard focus",
|
["<S-Tab>"], "Rewind keyboard focus",
|
||||||
function () { document.commandDispatcher.rewindFocus(); });
|
function () { document.commandDispatcher.rewindFocus(); });
|
||||||
|
|
||||||
|
|||||||
@@ -189,14 +189,14 @@ const RangeFinder = Module("rangefinder", {
|
|||||||
["N"], "Find previous",
|
["N"], "Find previous",
|
||||||
function () { rangefinder.findAgain(true); });
|
function () { rangefinder.findAgain(true); });
|
||||||
|
|
||||||
mappings.add(myModes.concat([modes.CARET, modes.TEXTAREA]), ["*"],
|
mappings.add(myModes.concat([modes.CARET, modes.TEXT_EDIT]), ["*"],
|
||||||
"Find word under cursor",
|
"Find word under cursor",
|
||||||
function () {
|
function () {
|
||||||
rangefinder.find(buffer.getCurrentWord(), false);
|
rangefinder.find(buffer.getCurrentWord(), false);
|
||||||
rangefinder.findAgain();
|
rangefinder.findAgain();
|
||||||
});
|
});
|
||||||
|
|
||||||
mappings.add(myModes.concat([modes.CARET, modes.TEXTAREA]), ["#"],
|
mappings.add(myModes.concat([modes.CARET, modes.TEXT_EDIT]), ["#"],
|
||||||
"Find word under cursor backwards",
|
"Find word under cursor backwards",
|
||||||
function () {
|
function () {
|
||||||
rangefinder.find(buffer.getCurrentWord(), true);
|
rangefinder.find(buffer.getCurrentWord(), true);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ const Modes = Module("modes", {
|
|||||||
this.pref = false;
|
this.pref = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.addMode("TEXTAREA", { char: "i", ownsFocus: true });
|
this.addMode("TEXT_EDIT", { char: "t", ownsFocus: true });
|
||||||
this.addMode("EMBED", { input: true, ownsFocus: true });
|
this.addMode("EMBED", { input: true, ownsFocus: true });
|
||||||
this.addMode("PASS_THROUGH");
|
this.addMode("PASS_THROUGH");
|
||||||
this.addMode("QUOTE", {
|
this.addMode("QUOTE", {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ This file contains a list of all available commands, mappings and options.
|
|||||||
<dl>
|
<dl>
|
||||||
<dt><k mode="i">i</k></dt> <dd>Start Insert mode in text areas when <o>insertmode</o> is not set</dd>
|
<dt><k mode="i">i</k></dt> <dd>Start Insert mode in text areas when <o>insertmode</o> is not set</dd>
|
||||||
<dt><k name="C-i" mode="i"/></dt> <dd>Launch the external editor</dd>
|
<dt><k name="C-i" mode="i"/></dt> <dd>Launch the external editor</dd>
|
||||||
<dt><k name="C-t" mode="i"/></dt> <dd>Enter Textarea mode</dd>
|
<dt><k name="C-t" mode="i"/></dt> <dd>Enter TextEdit mode</dd>
|
||||||
<dt><k name="C-]" mode="i"/></dt> <dd>Expand an Insert-mode abbreviation</dd>
|
<dt><k name="C-]" mode="i"/></dt> <dd>Expand an Insert-mode abbreviation</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<tags>i_i</tags>
|
<tags>t_i</tags>
|
||||||
<spec>i_i</spec>
|
<spec>t_i</spec>
|
||||||
<description short="true">
|
<description short="true">
|
||||||
<p>Starts Insert mode in text areas when <o>insertmode</o> is not set.</p>
|
<p>Starts Insert mode in text areas when <o>insertmode</o> is not set.</p>
|
||||||
</description>
|
</description>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<spec><C-t></spec>
|
<spec><C-t></spec>
|
||||||
<description short="true">
|
<description short="true">
|
||||||
<p>
|
<p>
|
||||||
Enter Textarea mode. This is useful for quick editing of text fields
|
Enter TextEdit mode. This is useful for quick editing of text fields
|
||||||
with basic Vim-keys support. See also <o>insertmode</o>.
|
with basic Vim-keys support. See also <o>insertmode</o>.
|
||||||
</p>
|
</p>
|
||||||
</description>
|
</description>
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
<dt>n</dt> <dd>Normal mode: When browsing normally</dd>
|
<dt>n</dt> <dd>Normal mode: When browsing normally</dd>
|
||||||
<dt>v</dt> <dd>Visual mode: When selecting text with the cursor keys</dd>
|
<dt>v</dt> <dd>Visual mode: When selecting text with the cursor keys</dd>
|
||||||
<dt>i</dt> <dd>Insert mode: When interacting with text fields on a website</dd>
|
<dt>i</dt> <dd>Insert mode: When interacting with text fields on a website</dd>
|
||||||
|
<dt>t</dt> <dd>TextEdit mode: When editing text fields in Vim-like NORMAL mode</dd>
|
||||||
<dt>c</dt> <dd>Command-line mode: When typing into the &dactyl.appName; command line</dd>
|
<dt>c</dt> <dd>Command-line mode: When typing into the &dactyl.appName; command line</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@@ -82,6 +83,8 @@
|
|||||||
<spec>:vm<oa>ap</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:vm<oa>ap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<tags>:im :imap</tags>
|
<tags>:im :imap</tags>
|
||||||
<spec>:im<oa>ap</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:im<oa>ap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
|
<tags>:tm :tmap</tags>
|
||||||
|
<spec>:tm<oa>ap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<tags>:cm :cmap</tags>
|
<tags>:cm :cmap</tags>
|
||||||
<spec>:cm<oa>ap</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:cm<oa>ap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<description>
|
<description>
|
||||||
@@ -126,6 +129,8 @@
|
|||||||
<spec>:vn<oa>oremap</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:vn<oa>oremap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<tags>:ino :inoremap</tags>
|
<tags>:ino :inoremap</tags>
|
||||||
<spec>:ino<oa>remap</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:ino<oa>remap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
|
<tags>:tno :tnoremap</tags>
|
||||||
|
<spec>:tno<oa>remap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<tags>:cno :cnoremap</tags>
|
<tags>:cno :cnoremap</tags>
|
||||||
<spec>:cno<oa>remap</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:cno<oa>remap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<description>
|
<description>
|
||||||
@@ -150,6 +155,8 @@
|
|||||||
<spec>:vun<oa>map</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:vun<oa>map</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<tags>:iu :iunmap</tags>
|
<tags>:iu :iunmap</tags>
|
||||||
<spec>:iu<oa>nmap</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:iu<oa>nmap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
|
<tags>:tu :tunmap</tags>
|
||||||
|
<spec>:tu<oa>nmap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<tags>:cu :cunmap</tags>
|
<tags>:cu :cunmap</tags>
|
||||||
<spec>:cu<oa>nmap</oa> <a>lhs</a> <a>rhs</a></spec>
|
<spec>:cu<oa>nmap</oa> <a>lhs</a> <a>rhs</a></spec>
|
||||||
<description>
|
<description>
|
||||||
@@ -166,6 +173,8 @@
|
|||||||
<spec>:vmapc<oa>lear</oa></spec>
|
<spec>:vmapc<oa>lear</oa></spec>
|
||||||
<tags>:imapc :imapclear</tags>
|
<tags>:imapc :imapclear</tags>
|
||||||
<spec>:imapc<oa>lear</oa></spec>
|
<spec>:imapc<oa>lear</oa></spec>
|
||||||
|
<tags>:tmapc :tmapclear</tags>
|
||||||
|
<spec>:tmapc<oa>lear</oa></spec>
|
||||||
<tags>:cmapc :cmapclear</tags>
|
<tags>:cmapc :cmapclear</tags>
|
||||||
<spec>:cmapc<oa>lear</oa></spec>
|
<spec>:cmapc<oa>lear</oa></spec>
|
||||||
<description>
|
<description>
|
||||||
@@ -180,6 +189,7 @@
|
|||||||
<spec>:nm<oa>ap</oa></spec>
|
<spec>:nm<oa>ap</oa></spec>
|
||||||
<spec>:vm<oa>ap</oa></spec>
|
<spec>:vm<oa>ap</oa></spec>
|
||||||
<spec>:im<oa>ap</oa></spec>
|
<spec>:im<oa>ap</oa></spec>
|
||||||
|
<spec>:tm<oa>ap</oa></spec>
|
||||||
<spec>:cm<oa>ap</oa></spec>
|
<spec>:cm<oa>ap</oa></spec>
|
||||||
<description>
|
<description>
|
||||||
<p>List all mappings for the applicable mode(s).</p>
|
<p>List all mappings for the applicable mode(s).</p>
|
||||||
@@ -195,6 +205,8 @@
|
|||||||
<spec>:vm<oa>ap</oa> <a>lhs</a></spec>
|
<spec>:vm<oa>ap</oa> <a>lhs</a></spec>
|
||||||
<tags>:imap_l</tags>
|
<tags>:imap_l</tags>
|
||||||
<spec>:im<oa>ap</oa> <a>lhs</a></spec>
|
<spec>:im<oa>ap</oa> <a>lhs</a></spec>
|
||||||
|
<tags>:tmap_l</tags>
|
||||||
|
<spec>:tm<oa>ap</oa> <a>lhs</a></spec>
|
||||||
<tags>:cmap_l</tags>
|
<tags>:cmap_l</tags>
|
||||||
<spec>:cm<oa>ap</oa> <a>lhs</a></spec>
|
<spec>:cm<oa>ap</oa> <a>lhs</a></spec>
|
||||||
<description>
|
<description>
|
||||||
@@ -224,6 +236,7 @@
|
|||||||
:nmap :nnoremap :nunmap :nmapclear – Normal mode
|
:nmap :nnoremap :nunmap :nmapclear – Normal mode
|
||||||
:vmap :vnoremap :vunmap :vmapclear – Visual mode
|
:vmap :vnoremap :vunmap :vmapclear – Visual mode
|
||||||
:imap :inoremap :iunmap :imapclear – Insert mode
|
:imap :inoremap :iunmap :imapclear – Insert mode
|
||||||
|
:tmap :tnoremap :tunmap :tmapclear – TextArea mode
|
||||||
:cmap :cnoremap :cunmap :cmapclear – Command-line mode
|
:cmap :cnoremap :cunmap :cmapclear – Command-line mode
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
|||||||
@@ -833,7 +833,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Textarea mode can be entered with <k name="C-t" mode="i"/> from Insert mode.
|
TextEdit mode can be entered with <k name="C-t" mode="i"/> from Insert mode.
|
||||||
</p>
|
</p>
|
||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const Util = Module("Util", {
|
|||||||
if (services.get("threadManager").isMainThread)
|
if (services.get("threadManager").isMainThread)
|
||||||
callback.call(self);
|
callback.call(self);
|
||||||
else
|
else
|
||||||
mainThread.dispatch(Runnable(self, callback), mainThread.DISPATCH_NORMAL);
|
mainThread.dispatch(Runnable(self, callback, Array.slice(arguments, 2)), mainThread.DISPATCH_NORMAL);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user