diff --git a/common/content/autocommands.js b/common/content/autocommands.js index 347a77a2..05f17678 100644 --- a/common/content/autocommands.js +++ b/common/content/autocommands.js @@ -119,7 +119,7 @@ var AutoCommands = Module("autocommands", { template.map(items, function (item, i) {i == 0 ? event : ""} - {item.filter} + {item.filter.toXML ? item.filter.toXML() : item.filter} {item.command} ) + ) + diff --git a/common/content/contexts.js b/common/content/contexts.js index b743cab9..f86d6a1f 100644 --- a/common/content/contexts.js +++ b/common/content/contexts.js @@ -36,6 +36,8 @@ var Group = Class("Group", { return update(siteFilter, { toString: function () this.filters.join(","), + toXML: function () template.map(this.filters, function (f) {f}, <>,), + filters: patterns.map(function (pattern) { let [, res, filter] = /^(!?)(.*)/.exec(pattern); @@ -400,9 +402,21 @@ var Contexts = Module("contexts", { completion: function initCompletion() { completion.group = function group(context, active) { context.title = ["Group"]; - context.keys = { text: "name", description: function (h) h.description || h.filter }; + let uri = buffer.uri; + context.keys = { + active: function (group) group.filter(uri), + text: "name", + description: function (g) <>{g.filter.toXML ? g.filter.toXML() + <>  : ""}{g.description || ""} + }; context.completions = (active === undefined ? contexts.groupList : contexts.activeGroups(active)) .slice(0, -1); + + iter({ Active: true, Inactive: false }).forEach(function ([name, active]) { + context.split(name, null, function (context) { + context.title[0] = name + " Groups"; + context.filters.push(function (item) item.active == active); + }); + }); }; } }); diff --git a/common/content/mappings.js b/common/content/mappings.js index 7c7884e4..7ca3b61e 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -417,12 +417,12 @@ var Mappings = Module("mappings", { { - template.map(hives, function (hive) let (i = 0) + template.map(hives, function (hive) + template.map(maps(hive), function (map) - template.map(map.names, function (name) + template.map(map.names, function (name, i) - {!i++ ? hive.name : ""} + {!i ? hive.group.name : ""} {modeSign} {name} {map.rhs || map.action.toSource()}