1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-08 10:25:46 +01:00

Cleanup dead code. Fix c_<S-Tab> without prior c_<Tab>.

--HG--
extra : rebase_source : a26b5c1540e2c5c28c032ff3892f8d5266c4e0dc
This commit is contained in:
Kris Maglione
2011-10-03 14:54:06 -04:00
parent 0979b8e702
commit a6ee2e4c0c

View File

@@ -1361,9 +1361,7 @@ var CommandLine = Module("commandline", {
this.itemList.itemCount); this.itemList.itemCount);
}, },
tabs: [], tab: function tab(offset, wildmode) {
tab: function tab(count, wildmode) {
this.autocompleteTimer.flush(); this.autocompleteTimer.flush();
this.ignoredCount = 0; this.ignoredCount = 0;
@@ -1375,40 +1373,34 @@ var CommandLine = Module("commandline", {
if (this.context.waitingForTab || this.wildIndex == -1) if (this.context.waitingForTab || this.wildIndex == -1)
this.complete(true, true); this.complete(true, true);
this.tabs.push([count, wildmode || options["wildmode"]]); let count = Math.abs(offset);
let steps = Math.constrain(this.wildtypes.length - this.wildIndex,
1, count);
count = Math.max(1, count - steps);
while (this.tabs.length) { while (steps--) {
[count, this.wildtypes] = this.tabs.shift(); this.wildIndex = Math.min(this.wildIndex, this.wildtypes.length - 1);
let dir = count; switch (this.wildtype.replace(/.*:/, "")) {
count = Math.abs(count); case "":
this.select(this.nextItem(null));
let steps = Math.constrain(this.wildtypes.length - this.wildIndex, 1, count); break;
count = Math.max(1, count - steps); case "longest":
if (this.items.length > 1) {
while (steps--) { if (this.substring && this.substring.length > this.completion.length)
this.wildIndex = Math.min(this.wildIndex, this.wildtypes.length - 1); this.completion = this.substring;
switch (this.wildtype.replace(/.*:/, "")) {
case "":
this.select(this.nextItem(null));
break;
case "longest":
if (this.items.length > 1) {
if (this.substring && this.substring.length > this.completion.length)
this.completion = this.substring;
break;
}
// Fallthrough
case "full":
let c = steps ? 1 : count;
this.select(dir < 0 ? this.UP : this.DOWN, c, true);
break; break;
} }
// Fallthrough
if (this.haveType("list")) case "full":
this.itemList.visible = true; let c = steps ? 1 : count;
this.select(offset < 0 ? this.UP : this.DOWN, c, true);
this.wildIndex++; break;
} }
if (this.haveType("list"))
this.itemList.visible = true;
this.wildIndex++;
} }
if (this.items.length == 0 && !this.waiting) if (this.items.length == 0 && !this.waiting)
@@ -1764,8 +1756,8 @@ var ItemList = Class("ItemList", {
if (offset > 0) if (offset > 0)
tuple = [this.activeGroups[0], -1]; tuple = [this.activeGroups[0], -1];
else { else {
let ctxt = this.activeContexts.slice(-1)[0]; let group = this.activeGroups.slice(-1)[0];
tuple = [ctxt, ctxt.items.length]; tuple = [group, group.itemCount];
} }
} }
if (tuple) if (tuple)
@@ -1801,7 +1793,7 @@ var ItemList = Class("ItemList", {
}, },
getRelativePage: function getRelativePage(offset, tuple, noWrap) { getRelativePage: function getRelativePage(offset, tuple, noWrap) {
return this.getRelativeItem(offset * this.maxItems, tuple); return this.getRelativeItem(offset * this.maxItems, tuple, noWrap);
}, },
open: function open(context) { open: function open(context) {