tree structure should be restored even if there are any extra tab
This commit is contained in:
parent
f500a66092
commit
db286777de
@ -2345,7 +2345,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
!treeStructure.state ||
|
!treeStructure.state ||
|
||||||
!treeStructure.state.length ||
|
!treeStructure.state.length ||
|
||||||
!treeStructure.tree ||
|
!treeStructure.tree ||
|
||||||
!treeStructure.tree.length
|
!treeStructure.tree.length ||
|
||||||
|
treeStructure.state.length != treeStructure.tree.length
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2353,13 +2354,21 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
var actualTabs = tabs.map(function(aTab) {
|
var actualTabs = tabs.map(function(aTab) {
|
||||||
return this.getTabValue(aTab, this.kID);
|
return this.getTabValue(aTab, this.kID);
|
||||||
}, this).join('\n');
|
}, this).join('\n')+'\n';
|
||||||
var expectedTabs = treeStructure.state.map(function(aState) {
|
var restoringTabs = treeStructure.state.map(function(aState) {
|
||||||
return aState.id;
|
return aState.id;
|
||||||
}).join('\n');
|
}).join('\n')+'\n';
|
||||||
if (actualTabs != expectedTabs)
|
if (actualTabs.indexOf(restoringTabs) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var preTabs = actualTabs
|
||||||
|
.split(restoringTabs)[0]
|
||||||
|
.replace(/\n$/, '')
|
||||||
|
.split('\n')
|
||||||
|
.filter(function(aId) { return aId; })
|
||||||
|
.length;
|
||||||
|
tabs = tabs.slice(preTabs, preTabs + treeStructure.tree.length-1);
|
||||||
|
|
||||||
var relations = tabs.map(function(aTab) {
|
var relations = tabs.map(function(aTab) {
|
||||||
return {
|
return {
|
||||||
id : this.getTabValue(aTab, this.kID),
|
id : this.getTabValue(aTab, this.kID),
|
||||||
@ -2369,7 +2378,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
insertAfter : this.getTabValue(aTab, this.kINSERT_AFTER)
|
insertAfter : this.getTabValue(aTab, this.kINSERT_AFTER)
|
||||||
};
|
};
|
||||||
}, this);
|
}, this);
|
||||||
this.applyTreeStructureToTabBrowser(this.mTabBrowser, treeStructure.tree);
|
this.applyTreeStructureToTabs(tabs, treeStructure.tree);
|
||||||
|
|
||||||
this.updateAllTabsIndent(true);
|
this.updateAllTabsIndent(true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user