diff --git a/content/buffer.js b/content/buffer.js
index 84c374ad..df1e96c2 100644
--- a/content/buffer.js
+++ b/content/buffer.js
@@ -490,8 +490,15 @@ function Buffer() //{{{
commands.add(["pa[geinfo]"],
"Show various page information",
- function () { buffer.showPageInfo(true); },
- { argCount: "0" });
+ function (args) { buffer.showPageInfo(true, args[0]); },
+ {
+ argCount: "?",
+ completer: function (context)
+ {
+ context.title = ["Page Info"];
+ completion.optionValue(context, "pageinfo", "+", "");
+ }
+ });
commands.add(["pagest[yle]"],
"Select the author style sheet to apply",
@@ -1263,7 +1270,7 @@ function Buffer() //{{{
liberator.echo(<>Element:
{util.objectToString(elem, true)}>, commandline.FORCE_MULTILINE);
},
- showPageInfo: function (verbose)
+ showPageInfo: function (verbose, sections)
{
// Ctrl-g single line output
if (!verbose)
@@ -1283,7 +1290,7 @@ function Buffer() //{{{
return;
}
- let option = options["pageinfo"];
+ let option = sections || options["pageinfo"];
let list = template.map(option, function (option) {
let opt = pageInfo[option];
if (opt)
diff --git a/content/completion.js b/content/completion.js
index bf09591b..bc1928c7 100644
--- a/content/completion.js
+++ b/content/completion.js
@@ -1340,6 +1340,53 @@ function Completion() //{{{
option: function option(filter) commands.get("set").completer(filter), // XXX
+ optionValue: function (context, name, op, curValue)
+ {
+ let opt = options.get(name);
+ let completer = opt.completer;
+
+ let curValues = curValue != null ? opt.parseValues(curValue) : opt.values;
+ let newValues = opt.parseValues(context.filter);
+
+ let len = context.filter.length;
+ switch (opt.type)
+ {
+ case "boolean":
+ if (!completer)
+ completer = function () [["true", ""], ["false", ""]];
+ break;
+ case "stringlist":
+ len = newValues.pop().length;
+ break;
+ case "charlist":
+ len = 0;
+ break;
+ }
+ // TODO: Highlight when invalid
+ context.advance(context.filter.length - len);
+
+ /* Not vim compatible, but is a significant enough improvement
+ * that it's worth breaking compatibility.
+ */
+ let completions = completer(context);
+ if (!completions)
+ return;
+ if (newValues instanceof Array)
+ {
+ completions = completions.filter(function (val) newValues.indexOf(val[0]) == -1);
+ switch (op)
+ {
+ case "+":
+ completions = completions.filter(function (val) curValues.indexOf(val[0]) == -1);
+ break;
+ case "-":
+ completions = completions.filter(function (val) curValues.indexOf(val[0]) > -1);
+ break;
+ }
+ }
+ context.completions = completions;
+ },
+
preference: function preference(filter) commands.get("set").completer(filter, true), // XXX
search: function search(context, noSuggest)
diff --git a/content/options.js b/content/options.js
index 7936425b..aa93fde2 100644
--- a/content/options.js
+++ b/content/options.js
@@ -708,9 +708,9 @@ function Options() //{{{
return;
let [name, value] = filter.split("=", 2);
- let offset = name.length + 1;
let opt = options.parseOpt(filter, modifiers);
let option = opt.option;
+ context.advance(name.length + 1);
if (!option)
context.highlight(0, name.length, "SPELLCHECK");
@@ -718,56 +718,16 @@ function Options() //{{{
if (opt.get || opt.reset || !option || prefix)
return;
- let completer = option.completer;
-
- let len = opt.value.length;
-
- switch (option.type)
- {
- case "boolean":
- completer = function () [["true", ""], ["false", ""]];
- break;
- case "stringlist":
- len = opt.values.pop().length;
- break;
- case "charlist":
- len = 0;
- break;
- }
-
- context.advance(filter.length - len);
- filter = context.filter;
-
- /* Not vim compatible, but is a significant enough improvement
- * that it's worth breaking compatibility.
- */
- let completions = [];
if (!opt.value)
- completions = [[option.value, "Current value"], [option.defaultValue, "Default value"]].filter(function (f) f[0]);
+ {
+ context.fork("default", 0, this, function (context) {
+ context.title = ["Extra Completions"];
+ context.completions = [[option.value, "Current value"], [option.defaultValue, "Default value"]].filter(function (f) f[0])
+ });
+ }
context.title = ["Option Value"];
- if (completer)
- {
- let res = completer(context);
- if (!res)
- return;
- completions = completions.concat(res);
- if (option.values instanceof Array)
- {
- completions = completions.filter(function (val) opt.values.indexOf(val[0]) == -1);
- switch (opt.operator)
- {
- case "+":
- completions = completions.filter(function (val) opt.optionValues.indexOf(val[0]) == -1);
- break;
- case "-":
- completions = completions.filter(function (val) opt.optionValues.indexOf(val[0]) > -1);
- break;
- }
- }
- }
- context.compare = function (a, b) 0;
- context.completions = completions;
+ completion.optionValue(context, opt.name, opt.operator);
},
literal: true,
serial: function () [
diff --git a/content/template.js b/content/template.js
index 8eda579e..0d86f2b4 100644
--- a/content/template.js
+++ b/content/template.js
@@ -48,7 +48,7 @@ const template = {
var desc = this.process[1].call(this, item, this.getKey(item, "description"));
}
- return