Fixup tree structure after tab move correctly.
Keyboard shortcuts Ctrl-Shift-PageUp/PageDown sometimes broke the tree. This commit fixes following cases: case 1: * [-] A * A-1 <= Ctrl-Shift-PageDown at here * [+] B then they should be: * A * [+] B * A-1 but actually: * [-] A * [+] B * A-1 <= still a child of A! case 2: * A * [-] B * [+] B-1 <= Ctrl-Shift-PageUp at here then they should be: * A * [+] B-1 * B but actually: * A * [+] B-1 <= still a child of B! * [-] B
This commit is contained in:
parent
1623bc43a9
commit
28ba3b54ad
@ -455,22 +455,16 @@ var TreeStyleTabWindowHelper = {
|
|||||||
return eval(aName+' = '+aSource.replace(
|
return eval(aName+' = '+aSource.replace(
|
||||||
'if (nextTab)',
|
'if (nextTab)',
|
||||||
'(function() {\n' +
|
'(function() {\n' +
|
||||||
' if (this.treeStyleTab.hasChildTabs(this.mCurrentTab)) {\n' +
|
' let descendants = this.treeStyleTab.getDescendantTabs(this.mCurrentTab);\n' +
|
||||||
' let descendant = this.treeStyleTab.getDescendantTabs(this.mCurrentTab);\n' +
|
' if (descendants.indexOf(nextTab) > -1) {\n' +
|
||||||
' if (descendant.length)\n' +
|
' let lastDescendant = this.treeStyleTab.getLastDescendantTab(this.mCurrentTab);\n' +
|
||||||
' nextTab = this.treeStyleTab.getNextTab(descendant[descendant.length-1]);\n' +
|
' nextTab = this.treeStyleTab.getNextVisibleTab(lastDescendant || this.mCurrentTab);\n' +
|
||||||
|
' }\n' +
|
||||||
|
' if (this.treeStyleTab.hasChildTabs(nextTab) && this.treeStyleTab.isSubtreeCollapsed(nextTab)) {\n' +
|
||||||
|
' nextTab = this.treeStyleTab.getLastDescendantTab(nextTab);\n' +
|
||||||
' }\n' +
|
' }\n' +
|
||||||
'}).call(this);' +
|
'}).call(this);' +
|
||||||
'$&'
|
'$&'
|
||||||
).replace(
|
|
||||||
/(this.moveTabTo\([^;]+\);)/,
|
|
||||||
'(function() {\n' +
|
|
||||||
' let descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' +
|
|
||||||
' if (descendant.length) {\n' +
|
|
||||||
' nextTab = descendant[descendant.length-1];\n' +
|
|
||||||
' }\n' +
|
|
||||||
' $1\n' +
|
|
||||||
'}).call(this);'
|
|
||||||
).replace(
|
).replace(
|
||||||
'this.moveTabToStart();',
|
'this.moveTabToStart();',
|
||||||
'(function() {\n' +
|
'(function() {\n' +
|
||||||
@ -490,6 +484,12 @@ var TreeStyleTabWindowHelper = {
|
|||||||
|
|
||||||
TreeStyleTabUtils.doPatching(b.moveTabBackward, 'b.moveTabBackward', function(aName, aSource) {
|
TreeStyleTabUtils.doPatching(b.moveTabBackward, 'b.moveTabBackward', function(aName, aSource) {
|
||||||
return eval(aName+' = '+aSource.replace(
|
return eval(aName+' = '+aSource.replace(
|
||||||
|
'if (previousTab)',
|
||||||
|
'(function() {\n' +
|
||||||
|
' previousTab = this.treeStyleTab.getPreviousVisibleTab(this.mCurrentTab);\n' +
|
||||||
|
'}).call(this);' +
|
||||||
|
'$&'
|
||||||
|
).replace(
|
||||||
'this.moveTabToEnd();',
|
'this.moveTabToEnd();',
|
||||||
'(function() {\n' +
|
'(function() {\n' +
|
||||||
' this.treeStyleTab.internallyTabMovingCount++;\n' +
|
' this.treeStyleTab.internallyTabMovingCount++;\n' +
|
||||||
|
@ -3678,9 +3678,10 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
aOldPosition = aTab._tPos;
|
aOldPosition = aTab._tPos;
|
||||||
|
|
||||||
var pos = this.getChildIndex(aTab, parent);
|
var pos = this.getChildIndex(aTab, parent);
|
||||||
var oldPos = this.getChildIndex(this.getAllTabs(this.mTabBrowser)[aOldPosition], parent);
|
var oldPositionTab = this.getAllTabs(this.mTabBrowser)[aOldPosition];
|
||||||
|
var oldPos = this.getChildIndex(oldPositionTab, parent);
|
||||||
var delta;
|
var delta;
|
||||||
if (pos == oldPos) { // no move?
|
if (oldPositionTab == aTab && pos == oldPos) { // no move?
|
||||||
mydump(' => no move\n');
|
mydump(' => no move\n');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3693,8 +3694,8 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
|
|
||||||
mydump((new Error()).stack.replace(/^/gm, ' ')+'\n');
|
mydump((new Error()).stack.replace(/^/gm, ' ')+'\n');
|
||||||
|
|
||||||
var prevTab = this.getPreviousTab(aTab);
|
var prevTab = this.getPreviousVisibleTab(aTab);
|
||||||
var nextTab = this.getNextTab(aTab);
|
var nextTab = this.getNextVisibleTab(aTab);
|
||||||
|
|
||||||
var tabs = this.getDescendantTabs(aTab);
|
var tabs = this.getDescendantTabs(aTab);
|
||||||
if (tabs.length) {
|
if (tabs.length) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user