[Pkg-mozext-commits] [tabmixplus] 76/107: Follow up changeset 8f7534dea438, duplicated tab not opened next to original when openDuplicateNext is true if openTabNext is false

David Prévot taffit at moszumanska.debian.org
Tue Dec 29 19:02:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit e8e978e670b955f3657d05f6254020ae18987563
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sat Nov 14 23:32:16 2015 +0200

    Follow up changeset 8f7534dea438, duplicated tab not opened next to original when openDuplicateNext is true if openTabNext is false
---
 chrome/content/minit/tablib.js | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 132c6d9..6008c72 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -192,7 +192,7 @@ var tablib = { // eslint-disable-line
 
     Tabmix.dontMoveNewTab = function(caller) {
       if (caller == "ssi_restoreWindow" ||
-          caller == "ssi_duplicateTab" && !Tabmix._moveDuplicatedTab) {
+          caller == "ssi_duplicateTab") {
         return true;
       }
       return false;
@@ -568,23 +568,29 @@ var tablib = { // eslint-disable-line
     window.duplicateTabIn = function(aTab, where) {
       if (where == "window" && Tabmix.getSingleWindowMode()) {
         where = "tab";
-        arguments[1] = where;
       }
-      if (where != window) {
-        let pref = Tabmix.isCallerInList("gotoHistoryIndex", "BrowserForward", "BrowserBack") ?
-            "openTabNext" : "openDuplicateNext";
-        // we prevent SessionStore.duplicateTab from moving the tab
-        // see Tabmix.dontMoveNewTab
-        Tabmix._moveDuplicatedTab = Tabmix.prefs.getBoolPref(pref);
+      // we prevent SessionStore.duplicateTab from moving the tab
+      // see gBrowser.addTab
+      // always set where to 'tabshifted' to prevent original function from
+      // selecting the new tab
+      if (where == "tab") {
+        arguments[1] = "tabshifted";
       }
 
       let result = Tabmix.originalFunctions.duplicateTabIn.apply(this, arguments);
+
       if (where != window) {
-        delete Tabmix._dontMoveDuplicatedTab;
+        let pref = Tabmix.isCallerInList("gotoHistoryIndex", "BrowserForward", "BrowserBack") ?
+            "openTabNext" : "openDuplicateNext";
+        let newTab = gBrowser.getTabForLastPanel();
+        if (Tabmix.prefs.getBoolPref(pref)) {
+          let pos = newTab._tPos > aTab._tPos ? 1 : 0;
+          gBrowser.moveTabTo(newTab, aTab._tPos + pos);
+        }
         let bgLoad = Tabmix.prefs.getBoolPref("loadDuplicateInBackground");
         let selectNewTab = where == "tab" ? !bgLoad : bgLoad;
         if (selectNewTab) {
-          gBrowser.selectedTab = gBrowser.getTabForLastPanel();
+          gBrowser.selectedTab = newTab;
         }
       }
       return result;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list