mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 23:57:59 +01:00
Make 'passunknown' a stringlist and localizate mode descriptions.
This commit is contained in:
@@ -1621,7 +1621,16 @@ var Buffer = Module("buffer", {
|
|||||||
function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); },
|
function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add([modes.COMMAND], ["<C-f>", "<PageDown>", "<Space>", "<scroll-page-down>"],
|
mappings.add([modes.COMMAND], ["<Space>"],
|
||||||
|
"Scroll down a full page",
|
||||||
|
function (args) {
|
||||||
|
if (isinstance(content.document.activeElement, [HTMLInputElement, HTMLButtonElement]))
|
||||||
|
return Events.PASS;
|
||||||
|
buffer.scrollVertical("pages", Math.max(args.count, 1));
|
||||||
|
},
|
||||||
|
{ count: true });
|
||||||
|
|
||||||
|
mappings.add([modes.COMMAND], ["<C-f>", "<PageDown>", "<scroll-page-down>"],
|
||||||
"Scroll down a full page",
|
"Scroll down a full page",
|
||||||
function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); },
|
function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|||||||
@@ -428,6 +428,8 @@ var Modes = Module("modes", {
|
|||||||
util.assert(options.bases.every(function (m) m instanceof this, this.constructor),
|
util.assert(options.bases.every(function (m) m instanceof this, this.constructor),
|
||||||
_("mode.invalidBases"), true);
|
_("mode.invalidBases"), true);
|
||||||
|
|
||||||
|
this.description = options.description || name;
|
||||||
|
|
||||||
update(this, {
|
update(this, {
|
||||||
id: 1 << Modes.Mode._id++,
|
id: 1 << Modes.Mode._id++,
|
||||||
name: name,
|
name: name,
|
||||||
@@ -435,6 +437,8 @@ var Modes = Module("modes", {
|
|||||||
}, options);
|
}, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
description: Messages.Localized(""),
|
||||||
|
|
||||||
isinstance: function isinstance(obj)
|
isinstance: function isinstance(obj)
|
||||||
this === obj || this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof obj,
|
this === obj || this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof obj,
|
||||||
|
|
||||||
@@ -452,8 +456,6 @@ var Modes = Module("modes", {
|
|||||||
|
|
||||||
get count() !this.insert,
|
get count() !this.insert,
|
||||||
|
|
||||||
get description() this._display,
|
|
||||||
|
|
||||||
_display: Class.memoize(function _display() this.name.replace("_", " ", "g")),
|
_display: Class.memoize(function _display() this.name.replace("_", " ", "g")),
|
||||||
|
|
||||||
display: function display() this._display,
|
display: function display() this._display,
|
||||||
@@ -470,7 +472,7 @@ var Modes = Module("modes", {
|
|||||||
|
|
||||||
passEvent: function passEvent(event) this.input && event.charCode && !(event.ctrlKey || event.altKey || event.metaKey),
|
passEvent: function passEvent(event) this.input && event.charCode && !(event.ctrlKey || event.altKey || event.metaKey),
|
||||||
|
|
||||||
passUnknown: Class.memoize(function () options.get("passunknown").getKey(this.name)),
|
passUnknown: Class.memoize(function () options.get("passunknown").has(this.name)),
|
||||||
|
|
||||||
get mask() this,
|
get mask() this,
|
||||||
|
|
||||||
@@ -543,12 +545,16 @@ var Modes = Module("modes", {
|
|||||||
options: function initOptions() {
|
options: function initOptions() {
|
||||||
options.add(["passunknown"],
|
options.add(["passunknown"],
|
||||||
"Pass through unknown keys in these modes",
|
"Pass through unknown keys in these modes",
|
||||||
"regexplist", "",
|
"stringlist", "",
|
||||||
{
|
{
|
||||||
regexpFlags: "i",
|
has: function (val) this.value.indexOf(val.toLowerCase()) >= 0,
|
||||||
|
|
||||||
setter: function (val) {
|
setter: function (val) {
|
||||||
modes.all.forEach(function (m) { delete m.passUnknown });
|
modes.all.forEach(function (m) { delete m.passUnknown });
|
||||||
}
|
return val.map(String.toLowerCase);
|
||||||
|
},
|
||||||
|
|
||||||
|
get values() [[m.name.toLowerCase(), m.description] for (m in values(modes._modes)) if (!m.hidden)]
|
||||||
});
|
});
|
||||||
|
|
||||||
options.add(["showmode", "smd"],
|
options.add(["showmode", "smd"],
|
||||||
|
|||||||
Reference in New Issue
Block a user