1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-04-03 01:03:34 +02:00

Allow binding keys in "menu" modes.

This commit is contained in:
Kris Maglione
2010-12-25 19:45:05 -05:00
parent dca9f2df86
commit 1c9d1b2548
3 changed files with 12 additions and 7 deletions

View File

@@ -1168,9 +1168,9 @@ var CommandLine = Module("commandline", {
availableHeight -= extra || 0; availableHeight -= extra || 0;
doc.body.style.minWidth = this.widgets.commandbar.commandline.scrollWidth + "px"; doc.body.style.minWidth = this.widgets.commandbar.commandline.scrollWidth + "px";
this.widgets.mowContainer.height = Math.min(doc.height, availableHeight) + "px"; this.widgets.mowContainer.height = Math.min(doc.body.clientHeight, availableHeight) + "px";
this.timeout(function () this.timeout(function ()
this.widgets.mowContainer.height = Math.min(doc.height, availableHeight) + "px", this.widgets.mowContainer.height = Math.min(doc.body.clientHeight, availableHeight) + "px",
0); 0);
doc.body.style.minWidth = ""; doc.body.style.minWidth = "";

View File

@@ -106,7 +106,8 @@ var Events = Module("events", {
*/ */
wrapListener: function wrapListener(method, self) { wrapListener: function wrapListener(method, self) {
self = self || this; self = self || this;
return function wrappedListener(event) { method.wrapped = wrappedListener;
function wrappedListener(event) {
try { try {
method.apply(self, arguments); method.apply(self, arguments);
} }
@@ -118,6 +119,7 @@ var Events = Module("events", {
dactyl.echoerr("Processing " + event.type + " event: " + (e.echoerr || e)); dactyl.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
} }
}; };
return wrappedListener;
}, },
/** /**
@@ -865,11 +867,13 @@ var Events = Module("events", {
this._input = null; this._input = null;
if (!input) { if (!input) {
let ignore = false; let ignore = false;
let overrideMode = null;
// menus have their own command handlers // menus have their own command handlers
if (modes.extended & modes.MENU) if (modes.extended & modes.MENU)
ignore = true; overrideMode = modes.MENU;
else if (modes.main == modes.PASS_THROUGH)
if (modes.main == modes.PASS_THROUGH)
ignore = !Events.isEscape(key) && key != "<C-v>"; ignore = !Events.isEscape(key) && key != "<C-v>";
else if (modes.main == modes.QUOTE) { else if (modes.main == modes.QUOTE) {
if (modes.getStack(1).main == modes.PASS_THROUGH) { if (modes.getStack(1).main == modes.PASS_THROUGH) {
@@ -896,7 +900,7 @@ var Events = Module("events", {
if (key in config.ignoreKeys && (config.ignoreKeys[key] & mode.main)) if (key in config.ignoreKeys && (config.ignoreKeys[key] & mode.main))
return null; return null;
input = Events.KeyProcessor(mode.params.mainMode || mode.main, mode.extended); input = Events.KeyProcessor(overrideMode || mode.params.mainMode || mode.main, mode.extended);
if (mode.params.preExecute) if (mode.params.preExecute)
input.preExecute = mode.params.preExecute; input.preExecute = mode.params.preExecute;
if (mode.params.postExecute) if (mode.params.postExecute)

View File

@@ -68,7 +68,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
__noSuchMethod__: function (meth, args) { __noSuchMethod__: function (meth, args) {
let win = util.activeWindow; let win = util.activeWindow;
var dactyl = global && global.dactyl || win && win.dactyl; var dactyl = global && global.dactyl || win && win.dactyl;
if (!win) if (!dactyl)
return null; return null;
let prop = dactyl[meth]; let prop = dactyl[meth];
@@ -102,6 +102,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
} }
catch (e) {} catch (e) {}
} }
Class.replaceProperty(obj, "observe", Class.replaceProperty(obj, "observe",
function (subject, target, data) { function (subject, target, data) {
try { try {