mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 10:57:58 +01:00
Fix gb and friends.
This commit is contained in:
@@ -1600,13 +1600,21 @@ var Buffer = Module("buffer", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
context.pushProcessor(0, function (item, text, next) <>
|
context.pushProcessor(0, function (item, text, next) <>
|
||||||
<span highlight="Indicator" style="display: inline-block;">{item.item.indicator}</span>
|
<span highlight="Indicator" style="display: inline-block;">{item.indicator}</span>
|
||||||
{ next.call(this, item, text) }
|
{ next.call(this, item, text) }
|
||||||
</>);
|
</>);
|
||||||
context.process[1] = function (item, text) template.bookmarkDescription(item, template.highlightFilter(text, this.filter));
|
context.process[1] = function (item, text) template.bookmarkDescription(item, template.highlightFilter(text, this.filter));
|
||||||
|
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.keys = { text: "text", description: "url", icon: "icon", id: "id", command: function () "tabs.select" };
|
context.keys = {
|
||||||
|
text: "text",
|
||||||
|
description: "url",
|
||||||
|
indicator: function (item) item.tab === tabs.getTab() ? "%" :
|
||||||
|
item.tab === tabs.alternate ? "#" : " ",
|
||||||
|
icon: "icon",
|
||||||
|
id: "id",
|
||||||
|
command: function () "tabs.select"
|
||||||
|
};
|
||||||
context.compare = CompletionContext.Sort.number;
|
context.compare = CompletionContext.Sort.number;
|
||||||
context.filters = [CompletionContext.Filter.textDescription];
|
context.filters = [CompletionContext.Filter.textDescription];
|
||||||
|
|
||||||
@@ -1627,9 +1635,9 @@ var Buffer = Module("buffer", {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
text: [i + ": " + (tab.label || "(Untitled)"), i + ": " + url],
|
text: [i + ": " + (tab.label || "(Untitled)"), i + ": " + url],
|
||||||
|
tab: tab,
|
||||||
id: i - 1,
|
id: i - 1,
|
||||||
url: url,
|
url: url,
|
||||||
indicator: indicator,
|
|
||||||
icon: tab.image || DEFAULT_FAVICON
|
icon: tab.image || DEFAULT_FAVICON
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -456,8 +456,8 @@ var Tabs = Module("tabs", {
|
|||||||
if (buffer == "#")
|
if (buffer == "#")
|
||||||
return tabs.selectAlternateTab();
|
return tabs.selectAlternateTab();
|
||||||
|
|
||||||
count = Math.max(1, count || 1);
|
|
||||||
reverse = Boolean(reverse);
|
reverse = Boolean(reverse);
|
||||||
|
count = Math.max(1, count || 1) * (1 + -2 * reverse);
|
||||||
|
|
||||||
let matches = buffer.match(/^(\d+):?/);
|
let matches = buffer.match(/^(\d+):?/);
|
||||||
if (matches)
|
if (matches)
|
||||||
@@ -467,17 +467,21 @@ var Tabs = Module("tabs", {
|
|||||||
if (matches)
|
if (matches)
|
||||||
return tabs.select(matches, false);
|
return tabs.select(matches, false);
|
||||||
|
|
||||||
matches = completion.runCompleter("buffer", buffer);
|
matches = completion.runCompleter("buffer", buffer).map(function (obj) obj.tab);
|
||||||
|
|
||||||
if (matches.length == 0)
|
if (matches.length == 0)
|
||||||
dactyl.echoerr("E94: No matching buffer for " + buffer);
|
dactyl.echoerr("E94: No matching buffer for " + buffer);
|
||||||
else if (matches.length > 1 && !allowNonUnique)
|
else if (matches.length > 1 && !allowNonUnique)
|
||||||
dactyl.echoerr("E93: More than one match for " + buffer);
|
dactyl.echoerr("E93: More than one match for " + buffer);
|
||||||
else {
|
else {
|
||||||
let index = (count - 1) % matches.length;
|
let start = matches.indexOf(tabs.getTab());
|
||||||
if (reverse)
|
if (start == -1 && reverse)
|
||||||
index = matches.length - index - 1;
|
start++;
|
||||||
tabs.select(matches[index].id, false);
|
|
||||||
|
let index = (start + count) % matches.length;
|
||||||
|
if (index < 0)
|
||||||
|
index = matches.length + index;
|
||||||
|
tabs.select(matches[index], false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user