Skip to content

Commit 96a027f

Browse files
Quicksavergkatsev
authored andcommitted
fixes and notes for Tab Groups 2 (#524)
1 parent 13056b5 commit 96a027f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

vimperator/content/tabgroup.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ var TabGroup = Module("tabGroup", {
7070
else
7171
test = function (g) g.getTitle().toLowerCase() == name;
7272
}
73+
// Using shim, iterate tabView.GroupItems itself
7374
for (let group of this.tabView.GroupItems.groupItems) {
7475
if (test(group)) {
7576
i++;
@@ -90,8 +91,9 @@ var TabGroup = Module("tabGroup", {
9091
return;
9192

9293
const GI = tabGroup.tabView.GroupItems;
93-
let current = GI.getActiveGroupItem() || GI.getActiveOrphanTab();
94-
let groups = GI.groupItems;
94+
// getActiveOrphanTab no longer exists in Tab Groups 2
95+
let current = GI.getActiveGroupItem() || (GI.getActiveOrphanTab && GI.getActiveOrphanTab());
96+
let groups = GI.groupItems; // Using shim, use GroupItems.sortBySlot()
9597
let offset = 1, relative = false, index;
9698
if (typeof spec === "number")
9799
index = parseInt(spec, 10);
@@ -159,11 +161,7 @@ var TabGroup = Module("tabGroup", {
159161
if (!tabGroup.TV)
160162
return null;
161163

162-
let pageBounds = tabGroup.tabView.Items.getPageBounds();
163-
pageBounds.inset(20, 20);
164-
let box = new tabGroup.tabView.Rect(pageBounds);
165-
box.width = 125;
166-
box.height = 110;
164+
let box = new tabGroup.tabView.Rect(20, 20, 125, 110);
167165
let group = new tabGroup.tabView.GroupItem([], { bounds: box, title: name });
168166

169167
if (tab && !tab.pinned)
@@ -439,15 +437,15 @@ var TabGroup = Module("tabGroup", {
439437
}
440438

441439
const GI = tabGroup.tabView.GroupItems;
442-
let groupItems = GI.groupItems;
440+
let groupItems = GI.groupItems; // Using shim, use GroupItems.sortBySlot()
443441
if (excludeActiveGroup) {
444442
let activeGroup = GI.getActiveGroupItem();
445443
if (activeGroup)
446444
groupItems = groupItems.filter(function(group) group.id != activeGroup.id);
447445
}
448446
context.completions = groupItems.map(function(group) {
449447
let title = group.id + ": " + (group.getTitle() || "(Untitled)");
450-
let desc = "Tabs: " + group.getChildren().length;
448+
let desc = "Tabs: " + group.getChildren().length; // Using shim, use group.children
451449

452450
return [title, desc];
453451
});

0 commit comments

Comments
 (0)