Commits

Anonymous committed 05b4b38

'ignore group position' sorting working, and so graceful!

Comments (0)

Files changed (1)

chrome/content/gst.list.js

 
 // will have to make a new one of these on sort changes...
 GST.SortedTabList = function SortedTabList() {
+	this.s = new Array();
+	this.p = new Array();
+	
 	this.__defineGetter__("list", function() {
 		if (GST.glob.isSortGroups()) return this.s;
 		else if (GST.glob.isSortBetween()) return this.p;
 		else return this.s;
 	});
-	this.s = new Array();
-	this.p = new Array();
 	
 	this.__defineGetter__("outer", function() { return this.getSort(false)[0]; });
 	this.__defineGetter__("oGetter", function() { return this.getSort(false)[1]; });
 	}
 	else {	// when not an exact find, index from binarySearch is where it belongs
 		group = new Array(tab);
-		this.s.splice(oIdx, 0, group);	// add to a, keeping it sorted so our binarySearch works)
+		this.s.splice(oIdx, 0, group);	// add to s, keeping it sorted so our binarySearch works
 		if (GST.glob.isSortBetween()) {
-			let r = this.p.binarySearch(group, this.iGetter);	// add the group to this list based on group position
+			let r = this.p.binarySearch(group, function(group) {
+				if (GST.list.ssTabsOpened && group[0] == tab)	// how in the !@#$ does this work? I would expect invalid scope
+					return gBrowser.selectedTab._tPos + 1;
+				return group[0]._tPos;
+			}
+			);	// add the group to this list based on group position
 			this.p.splice(r[1], 0, group);
 		}
 	}
 	
 	positionTab : function positionTab(tab) {
 		GST.list.tabInList(GST.list.sorted.list, tab, function(list, absIdx, g, t) {
-			GST.list.moveTab(tab, 0);
-			GST.list.moveTab(tab, absIdx);
+			if (GST.list.ssTabsOpened) {	// should only check this if isSortBetween()? Maybe not
+				GST.list.moveTab(tab, 0);
+				GST.list.moveTab(tab, absIdx);
+			}
 			
 			GST.list.separateGroup(list, g - 1);
 			GST.list.separateGroup(list, g);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.