1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 16:04:12 +01:00

List links in :hi output; provide current/default value completion.

This commit is contained in:
Kris Maglione
2010-12-30 00:46:28 -05:00
parent 1dd8efea4f
commit 4d47da9102
2 changed files with 15 additions and 4 deletions

View File

@@ -643,7 +643,7 @@ var CompletionContext = Class("CompletionContext", {
* interpreted as a method to access on *self*.
*/
fork: function fork(name, offset, self, completer) {
if (typeof completer == "string")
if (isString(completer))
completer = self[completer];
let context = CompletionContext(this, name, offset);
if (this.contextList.indexOf(context) < 0)
@@ -654,7 +654,9 @@ var CompletionContext = Class("CompletionContext", {
else if (completer) {
let res = completer.apply(self || this, [context].concat(Array.slice(arguments, fork.length)));
if (res && !isArray(res) && !isArray(res.__proto__))
return [k for (k in res)];
res = [k for (k in res)];
if (res)
context.completions = res;
return res;
}
if (completer)

View File

@@ -314,11 +314,12 @@ var Highlights = Module("Highlight", {
if (!modify)
modules.commandline.commandOutput(
template.tabular(["Key", "Sample", "CSS"],
template.tabular(["Key", "Sample", "Link", "CSS"],
["padding: 0 1em 0 0; vertical-align: top",
"text-align: center"],
([h.class,
<span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
template.map(h.extends, template.highlight),
template.highlightRegexp(h.value, /\b[-\w]+(?=:)/g)]
for (h in highlight)
if (!key || h.class.indexOf(key) > -1))));
@@ -353,7 +354,15 @@ var Highlights = Module("Highlight", {
names: ["-link", "-l"],
description: "Links this group to another",
type: CommandOption.LIST,
completer: function (context, args) completion.highlightGroup(context)
completer: function (context, args) {
let group = args[0] && highlight.get(args[0]);
if (group)
context.fork("extra", 0, this, function (context) [
[String(group.extends), "Current Value"],
[String(group.defaultExtends) || "", "Default Value"]
]);
context.fork("groups", 0, completion, "highlightGroup");
}
}
],
serialize: function () [