mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 04:07:58 +01:00
added option value completion; small typos.
This commit is contained in:
@@ -178,7 +178,15 @@ liberator.Buffer = function () //{{{
|
||||
"Show the destination of the link under the cursor in the status bar",
|
||||
"number", 1,
|
||||
{
|
||||
validator: function (value) { return (value >= 0 && value <= 2); }
|
||||
validator: function (value) { return (value >= 0 && value <= 2); },
|
||||
completer: function (filter)
|
||||
{
|
||||
return [
|
||||
["0", "Don't show link destination"],
|
||||
["1", "Show the link in the status line"],
|
||||
["2", "Show the link in the command line"],
|
||||
];
|
||||
},
|
||||
});
|
||||
|
||||
liberator.options.add(["usermode", "um"],
|
||||
|
||||
@@ -589,7 +589,12 @@ liberator.Hints = function () //{{{
|
||||
"How links are matched",
|
||||
"string", "contains",
|
||||
{
|
||||
validator: function (value) { return /^(?:contains|wordstartswith|firstletters|custom)$/.test(value); }
|
||||
validator: function (value) { return /^(?:contains|wordstartswith|firstletters|custom)$/.test(value); },
|
||||
completer: function (filter)
|
||||
{
|
||||
return ["contains","wordstartswith","firstletters","custom"]
|
||||
.map(function(m){ return [m,""] });
|
||||
},
|
||||
});
|
||||
|
||||
liberator.options.add(["wordseparators", "wsp"],
|
||||
|
||||
@@ -360,7 +360,7 @@ liberator.Options = function () //{{{
|
||||
value = false;
|
||||
break;
|
||||
default:
|
||||
if (/^(\d+)$/.test(value))
|
||||
if (/^\d+$/.test(value))
|
||||
value = parseInt(value, 10);
|
||||
}
|
||||
liberator.options.setPref(name, value);
|
||||
@@ -612,7 +612,11 @@ liberator.Options = function () //{{{
|
||||
for (var option in liberator.options)
|
||||
{
|
||||
if (option.hasName(filter))
|
||||
{
|
||||
if (option.completer)
|
||||
return [filter.length + 1, option.completer(filter)];
|
||||
return [filter.length + 1, [[option.value + "", ""]]];
|
||||
}
|
||||
}
|
||||
return [0, optionCompletions];
|
||||
}
|
||||
@@ -684,7 +688,7 @@ liberator.Options = function () //{{{
|
||||
extraInfo = {};
|
||||
|
||||
var option = new liberator.Option(names, description, type, defaultValue,
|
||||
extraInfo.getter, extraInfo.setter, extraInfo.validator);
|
||||
extraInfo.getter, extraInfo.setter, extraInfo.validator, extraInfo.completer);
|
||||
|
||||
// quickly access options with liberator.options["wildmode"]:
|
||||
this.__defineGetter__(option.name, function () { return option.value; });
|
||||
|
||||
@@ -126,7 +126,15 @@ liberator.Tabs = function () //{{{
|
||||
tabs.collapsed = false;
|
||||
}
|
||||
},
|
||||
validator: function (value) { return (value >= 0 && value <= 2); }
|
||||
validator: function (value) { return (value >= 0 && value <= 2); },
|
||||
completer: function (filter)
|
||||
{
|
||||
return [
|
||||
["0", "Never show tab bar"],
|
||||
["1", "Show tab bar only if more than one tab is open"],
|
||||
["2", "Always show tab bar"],
|
||||
];
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -328,7 +328,18 @@ liberator.CommandLine = function () //{{{
|
||||
validator: function (value)
|
||||
{
|
||||
return value.split(",").every(function (item) { return /^(full|longest|list|list:full|list:longest|)$/.test(item); });
|
||||
}
|
||||
},
|
||||
completer: function (filter)
|
||||
{
|
||||
return [
|
||||
["", "Complete only the first match"],
|
||||
["full", "Complete the next full match"],
|
||||
["longest", "Complete to longest common string"],
|
||||
["list", "If more than one match, list all matches"],
|
||||
["list:full", "List all and complete first match"],
|
||||
["list:longest", "List all and complete common string"],
|
||||
];
|
||||
},
|
||||
});
|
||||
|
||||
liberator.options.add(["wildoptions", "wop"],
|
||||
@@ -1280,7 +1291,15 @@ liberator.StatusLine = function () //{{{
|
||||
else
|
||||
document.getElementById("status-bar").collapsed = false;
|
||||
},
|
||||
validator: function (value) { return (value >= 0 && value <= 2); }
|
||||
validator: function (value) { return (value in [0,1,2]); },
|
||||
completer: function (filter)
|
||||
{
|
||||
return [
|
||||
["0", "Never display status line"],
|
||||
["1", "Display status line only if there are multiple windows"],
|
||||
["2", "Always display status line"],
|
||||
];
|
||||
},
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
|
||||
Reference in New Issue
Block a user