mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 18:25:46 +01:00
Highlighting and stuff.
--HG-- branch : groups
This commit is contained in:
@@ -119,7 +119,7 @@ var AutoCommands = Module("autocommands", {
|
|||||||
template.map(items, function (item, i)
|
template.map(items, function (item, i)
|
||||||
<tr>
|
<tr>
|
||||||
<td highlight="Title" style="padding-right: 1em;">{i == 0 ? event : ""}</td>
|
<td highlight="Title" style="padding-right: 1em;">{i == 0 ? event : ""}</td>
|
||||||
<td>{item.filter}</td>
|
<td>{item.filter.toXML ? item.filter.toXML() : item.filter}</td>
|
||||||
<td>{item.command}</td>
|
<td>{item.command}</td>
|
||||||
</tr>) +
|
</tr>) +
|
||||||
<tr style="height: .5ex;"/>) +
|
<tr style="height: .5ex;"/>) +
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ var Group = Class("Group", {
|
|||||||
return update(siteFilter, {
|
return update(siteFilter, {
|
||||||
toString: function () this.filters.join(","),
|
toString: function () this.filters.join(","),
|
||||||
|
|
||||||
|
toXML: function () template.map(this.filters, function (f) <span highlight={f(buffer.uri) ? "Filter" : ""}>{f}</span>, <>,</>),
|
||||||
|
|
||||||
filters: patterns.map(function (pattern) {
|
filters: patterns.map(function (pattern) {
|
||||||
let [, res, filter] = /^(!?)(.*)/.exec(pattern);
|
let [, res, filter] = /^(!?)(.*)/.exec(pattern);
|
||||||
|
|
||||||
@@ -400,9 +402,21 @@ var Contexts = Module("contexts", {
|
|||||||
completion: function initCompletion() {
|
completion: function initCompletion() {
|
||||||
completion.group = function group(context, active) {
|
completion.group = function group(context, active) {
|
||||||
context.title = ["Group"];
|
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))
|
context.completions = (active === undefined ? contexts.groupList : contexts.activeGroups(active))
|
||||||
.slice(0, -1);
|
.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);
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -417,12 +417,12 @@ var Mappings = Module("mappings", {
|
|||||||
</tr>
|
</tr>
|
||||||
<col style="min-width: 6em; padding-right: 1em;"/>
|
<col style="min-width: 6em; padding-right: 1em;"/>
|
||||||
{
|
{
|
||||||
template.map(hives, function (hive) let (i = 0)
|
template.map(hives, function (hive)
|
||||||
<tr style="height: .5ex;"/> +
|
<tr style="height: .5ex;"/> +
|
||||||
template.map(maps(hive), function (map)
|
template.map(maps(hive), function (map)
|
||||||
template.map(map.names, function (name)
|
template.map(map.names, function (name, i)
|
||||||
<tr>
|
<tr>
|
||||||
<td highlight="Title">{!i++ ? hive.name : ""}</td>
|
<td highlight="Title">{!i ? hive.group.name : ""}</td>
|
||||||
<td>{modeSign}</td>
|
<td>{modeSign}</td>
|
||||||
<td>{name}</td>
|
<td>{name}</td>
|
||||||
<td>{map.rhs || map.action.toSource()}</td>
|
<td>{map.rhs || map.action.toSource()}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user