mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 22:07:58 +01:00
Don't derive Text Edit mode from Operator mode. Allow escaping from Operator mode.
This commit is contained in:
@@ -1753,11 +1753,7 @@ var Buffer = Module("buffer", {
|
|||||||
mappings.add([modes.NORMAL], ["<Space>"],
|
mappings.add([modes.NORMAL], ["<Space>"],
|
||||||
"Scroll down a full page",
|
"Scroll down a full page",
|
||||||
function (args) {
|
function (args) {
|
||||||
if (isinstance(services.focus.activeWindow.document.activeElement,
|
if (isinstance((services.focus.focusedWindow || content).document.activeElement,
|
||||||
[HTMLInputElement, HTMLButtonElement, Ci.nsIDOMXULButtonElement]))
|
|
||||||
return Events.PASS;
|
|
||||||
|
|
||||||
if (isinstance(buffer.focusedFrame.document.activeElement,
|
|
||||||
[HTMLInputElement, HTMLButtonElement, Ci.nsIDOMXULButtonElement]))
|
[HTMLInputElement, HTMLButtonElement, Ci.nsIDOMXULButtonElement]))
|
||||||
return Events.PASS;
|
return Events.PASS;
|
||||||
|
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ var Editor = Module("editor", {
|
|||||||
},
|
},
|
||||||
extraInfo);
|
extraInfo);
|
||||||
|
|
||||||
mappings.add([modes.OPERATOR], keys, description,
|
mappings.add([modes.TEXT_EDIT, modes.OPERATOR], keys, description,
|
||||||
function ({ count }) {
|
function ({ count }) {
|
||||||
if (!count)
|
if (!count)
|
||||||
count = 1;
|
count = 1;
|
||||||
@@ -538,14 +538,14 @@ var Editor = Module("editor", {
|
|||||||
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) {
|
||||||
mappings.add([modes.OPERATOR], [key],
|
mappings.add([modes.TEXT_EDIT], [key],
|
||||||
desc,
|
desc,
|
||||||
function ({ count, motion }) {
|
function ({ count, motion }) {
|
||||||
modes.push(modes.OPERATOR, null, {
|
modes.push(modes.OPERATOR, null, {
|
||||||
count: count,
|
count: count,
|
||||||
|
|
||||||
leave: function leave(stack) {
|
leave: function leave(stack) {
|
||||||
if (stack.push)
|
if (stack.push || stack.fromEscape)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -743,7 +743,7 @@ var Editor = Module("editor", {
|
|||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
let bind = function bind(names, description, action, params)
|
let bind = function bind(names, description, action, params)
|
||||||
mappings.add([modes.OPERATOR], names, description,
|
mappings.add([modes.TEXT_EDIT, modes.OPERATOR], names, description,
|
||||||
action, update({ type: "editor" }, params));
|
action, update({ type: "editor" }, params));
|
||||||
|
|
||||||
// finding characters
|
// finding characters
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ var Modes = Module("modes", {
|
|||||||
char: "v",
|
char: "v",
|
||||||
description: "Active when text is selected",
|
description: "Active when text is selected",
|
||||||
display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : ""),
|
display: function () "VISUAL" + (this._extended & modes.LINE ? " LINE" : ""),
|
||||||
bases: [this.COMMAND, this.OPERATOR],
|
bases: [this.COMMAND],
|
||||||
ownsFocus: true
|
ownsFocus: true
|
||||||
}, {
|
}, {
|
||||||
leave: function (stack, newMode) {
|
leave: function (stack, newMode) {
|
||||||
@@ -102,7 +102,7 @@ var Modes = Module("modes", {
|
|||||||
this.addMode("TEXT_EDIT", {
|
this.addMode("TEXT_EDIT", {
|
||||||
char: "t",
|
char: "t",
|
||||||
description: "Vim-like editing of input elements",
|
description: "Vim-like editing of input elements",
|
||||||
bases: [this.OPERATOR, this.COMMAND],
|
bases: [this.COMMAND],
|
||||||
ownsFocus: true
|
ownsFocus: true
|
||||||
}, {
|
}, {
|
||||||
onKeyPress: function (eventList) {
|
onKeyPress: function (eventList) {
|
||||||
@@ -452,8 +452,7 @@ var Modes = Module("modes", {
|
|||||||
while (this._modeStack.length > 1 && this.main != mode) {
|
while (this._modeStack.length > 1 && this.main != mode) {
|
||||||
let a = this._modeStack.pop();
|
let a = this._modeStack.pop();
|
||||||
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params,
|
this.set(this.topOfStack.main, this.topOfStack.extended, this.topOfStack.params,
|
||||||
update({ pop: a },
|
update({ pop: a }, args));
|
||||||
args || {}));
|
|
||||||
|
|
||||||
if (mode == null)
|
if (mode == null)
|
||||||
return;
|
return;
|
||||||
@@ -595,10 +594,10 @@ var Modes = Module("modes", {
|
|||||||
"Return to Normal mode",
|
"Return to Normal mode",
|
||||||
function () { modes.reset(); });
|
function () { modes.reset(); });
|
||||||
|
|
||||||
mappings.add([modes.INPUT, modes.COMMAND, modes.PASS_THROUGH, modes.QUOTE],
|
mappings.add([modes.INPUT, modes.COMMAND, modes.OPERATOR, modes.PASS_THROUGH, modes.QUOTE],
|
||||||
["<Esc>", "<C-[>"],
|
["<Esc>", "<C-[>"],
|
||||||
"Return to the previous mode",
|
"Return to the previous mode",
|
||||||
function () { modes.pop(); });
|
function () { modes.pop(null, { fromEscape: true }); });
|
||||||
|
|
||||||
mappings.add([modes.MENU], ["<C-c>"],
|
mappings.add([modes.MENU], ["<C-c>"],
|
||||||
"Leave Menu mode",
|
"Leave Menu mode",
|
||||||
|
|||||||
Reference in New Issue
Block a user