mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 18:42:27 +01:00
Rename some functions. Add options.(set|get|reset|invert)Pref completion
This commit is contained in:
@@ -201,7 +201,7 @@ function Buffer() //{{{
|
|||||||
{
|
{
|
||||||
if (mappings.repeat)
|
if (mappings.repeat)
|
||||||
{
|
{
|
||||||
for (let i in util.rangeInterruptable(0, Math.max(count, 1), 100))
|
for (let i in util.interruptableRange(0, Math.max(count, 1), 100))
|
||||||
mappings.repeat();
|
mappings.repeat();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ function Completion() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.get("wildoptions").has("sort"))
|
if (options.get("wildoptions").has("sort"))
|
||||||
filtered = filtered.sort(function ciCompare(a, b) util.ciCompare(a[0], b[0]));;
|
filtered = filtered.sort(function (a, b) util.ciCompare(a[0], b[0]));;
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,7 +629,7 @@ function Completion() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.get("wildoptions").has("sort"))
|
if (options.get("wildoptions").has("sort"))
|
||||||
filtered = filtered.sort(function ciCompare(a, b) util.ciCompare(a[0], b[0]));;
|
filtered = filtered.sort(function (a, b) util.ciCompare(a[0], b[0]));;
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -767,7 +767,7 @@ function Completion() //{{{
|
|||||||
|
|
||||||
filtered = filtered.concat(additionalCompletions);
|
filtered = filtered.concat(additionalCompletions);
|
||||||
if (options.get("wildoptions").has("sort"))
|
if (options.get("wildoptions").has("sort"))
|
||||||
filtered = filtered.sort(function ciCompare(a, b) util.ciCompare(a[0], b[0]));;
|
filtered = filtered.sort(function (a, b) util.compareIgnoreCase(a[0], b[0]));;
|
||||||
return filtered;
|
return filtered;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ function Hints() //{{{
|
|||||||
var scrollY = doc.defaultView.scrollY;
|
var scrollY = doc.defaultView.scrollY;
|
||||||
|
|
||||||
inner:
|
inner:
|
||||||
for (let i in (util.rangeInterruptable(start, end + 1, 500)))
|
for (let i in (util.interruptableRange(start, end + 1, 500)))
|
||||||
{
|
{
|
||||||
let hint = pageHints[i];
|
let hint = pageHints[i];
|
||||||
[elem, text, span, imgspan] = hint;
|
[elem, text, span, imgspan] = hint;
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ const liberator = (function () //{{{
|
|||||||
let each, eachUnits, totalUnits;
|
let each, eachUnits, totalUnits;
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
for (let i in util.rangeInterruptable(0, count, 500))
|
for (let i in util.interruptableRange(0, count, 500))
|
||||||
{
|
{
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
liberator[method](args);
|
liberator[method](args);
|
||||||
|
|||||||
@@ -690,10 +690,6 @@ function Options() //{{{
|
|||||||
{
|
{
|
||||||
var optionCompletions = [];
|
var optionCompletions = [];
|
||||||
|
|
||||||
// What is this all about then, eh? It's too late to guess... -- djk
|
|
||||||
//if (prefix)
|
|
||||||
// filter = filter.replace(ret.prefix, "");
|
|
||||||
|
|
||||||
if (special) // list completions for about:config entries
|
if (special) // list completions for about:config entries
|
||||||
{
|
{
|
||||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
@@ -851,6 +847,14 @@ function Options() //{{{
|
|||||||
liberator.registerObserver("load_completion", function ()
|
liberator.registerObserver("load_completion", function ()
|
||||||
{
|
{
|
||||||
completion.setFunctionCompleter(options.get, [function () ([o.name, o.description] for (o in options))]);
|
completion.setFunctionCompleter(options.get, [function () ([o.name, o.description] for (o in options))]);
|
||||||
|
let listPrefs = [function () Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIPrefBranch)
|
||||||
|
.getChildList("", { value: 0 })
|
||||||
|
.map(function (pref) [pref, ""])];
|
||||||
|
completion.setFunctionCompleter(options.getPref, listPrefs);
|
||||||
|
completion.setFunctionCompleter(options.setPref, listPrefs);
|
||||||
|
completion.setFunctionCompleter(options.resetPref, listPrefs);
|
||||||
|
completion.setFunctionCompleter(options.invertPref, listPrefs);
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ const util = { //{{{
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
ciCompare: function (a, b)
|
compareIgnoreCase: function (a, b)
|
||||||
{
|
{
|
||||||
return String.localeCompare(a.toLowerCase(), b.toLowerCase());
|
return String.localeCompare(a.toLowerCase(), b.toLowerCase());
|
||||||
},
|
},
|
||||||
@@ -357,7 +357,7 @@ const util = { //{{{
|
|||||||
yield start++;
|
yield start++;
|
||||||
},
|
},
|
||||||
|
|
||||||
rangeInterruptable: function (start, end, time)
|
interruptableRange: function (start, end, time)
|
||||||
{
|
{
|
||||||
let endTime = Date.now() + time;
|
let endTime = Date.now() + time;
|
||||||
while (start < end)
|
while (start < end)
|
||||||
|
|||||||
Reference in New Issue
Block a user