Move tree forward correctly by gBrowser.moveTabForward()

This commit is contained in:
Piro / YUKI Hiroshi 2013-01-04 03:56:47 +09:00
parent 318ad0ee52
commit 251674258d
2 changed files with 17 additions and 4 deletions

View File

@ -14,7 +14,7 @@ License.
The Original Code is the Tree Style Tab. The Original Code is the Tree Style Tab.
The Initial Developer of the Original Code is YUKI "Piro" Hiroshi. The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
Portions created by the Initial Developer are Copyright (C) 2007-2012 Portions created by the Initial Developer are Copyright (C) 2007-2013
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex@gmail.com> Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex@gmail.com>

View File

@ -409,11 +409,24 @@ var TreeStyleTabWindowHelper = {
'tabPos + 1', 'nextTab._tPos' 'tabPos + 1', 'nextTab._tPos'
); );
} }
else {
source = source.replace(
'if (nextTab)',
'(function() {\n' +
' if (this.treeStyleTab.hasChildTabs(this.mCurrentTab)) {\n' +
' let descendant = this.treeStyleTab.getDescendantTabs(this.mCurrentTab);\n' +
' if (descendant.length)\n' +
' nextTab = this.treeStyleTab.getNextTab(descendant[descendant.length-1]);\n' +
' }\n' +
'}).call(this);' +
'$&'
);
}
eval('b.moveTabForward = '+ eval('b.moveTabForward = '+
source.replace( source.replace(
/(this.moveTabTo\([^;]+\);)/, /(this.moveTabTo\([^;]+\);)/,
'(function() {\n' + '(function() {\n' +
' var descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' + ' let descendant = this.treeStyleTab.getDescendantTabs(nextTab);\n' +
' if (descendant.length) {\n' + ' if (descendant.length) {\n' +
' nextTab = descendant[descendant.length-1];\n' + ' nextTab = descendant[descendant.length-1];\n' +
' }\n' + ' }\n' +
@ -423,7 +436,7 @@ var TreeStyleTabWindowHelper = {
'this.moveTabToStart();', 'this.moveTabToStart();',
'(function() {\n' + '(function() {\n' +
' this.treeStyleTab.internallyTabMovingCount++;\n' + ' this.treeStyleTab.internallyTabMovingCount++;\n' +
' var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' + ' let parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' +
' if (parentTab) {\n' + ' if (parentTab) {\n' +
' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getFirstChildTab(parentTab)._tPos);\n' + ' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getFirstChildTab(parentTab)._tPos);\n' +
' this.mCurrentTab.focus();\n' + ' this.mCurrentTab.focus();\n' +
@ -453,7 +466,7 @@ var TreeStyleTabWindowHelper = {
'this.moveTabToEnd();', 'this.moveTabToEnd();',
'(function() {\n' + '(function() {\n' +
' this.treeStyleTab.internallyTabMovingCount++;\n' + ' this.treeStyleTab.internallyTabMovingCount++;\n' +
' var parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' + ' let parentTab = this.treeStyleTab.getParentTab(this.mCurrentTab);\n' +
' if (parentTab) {\n' + ' if (parentTab) {\n' +
' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getLastChildTab(parentTab)._tPos);\n' + ' this.moveTabTo(this.mCurrentTab, this.treeStyleTab.getLastChildTab(parentTab)._tPos);\n' +
' this.mCurrentTab.focus();\n' + ' this.mCurrentTab.focus();\n' +