1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 11:58:00 +01:00

Adding :tabduplicate patch from Konstantin Stepanov

This commit is contained in:
Daniel Bainton
2008-07-21 09:36:43 +00:00
parent 33cf937388
commit 01edb272bc
4 changed files with 43 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ Inactive/former developers:
* Viktor Kojouharov (Виктор Кожухаров) * Viktor Kojouharov (Виктор Кожухаров)
Patches (in no special order): Patches (in no special order):
* Konstantin Stepanov (:%foo support) * Konstantin Stepanov (:%foo support, :tabduplicate)
* Lukas Mai * Lukas Mai
* Guido Van Hoecke * Guido Van Hoecke
* Daniel Trstenjak (various things with hints) * Daniel Trstenjak (various things with hints)

1
NEWS
View File

@@ -8,6 +8,7 @@
generous donation which made this behavior possible) generous donation which made this behavior possible)
* IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just * IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just
too unpredictable too unpredictable
* add :tabduplicate command
* new 'urlseparator' option for specifying the regexp used to split the arg to * new 'urlseparator' option for specifying the regexp used to split the arg to
:open, :tabopen and :winopen :open, :tabopen and :winopen
* :set editor now accepts quoting/escaping to use an editor with spaces in the path * :set editor now accepts quoting/escaping to use an editor with spaces in the path

View File

@@ -426,6 +426,23 @@ liberator.Tabs = function () //{{{
liberator.open("about:blank", where); liberator.open("about:blank", where);
}, },
{ completer: function (filter) { return liberator.completion.url(filter); } }); { completer: function (filter) { return liberator.completion.url(filter); } });
liberator.commands.add(["tabd[uplicate]"],
"Duplicate current tab",
function (args, special, count)
{
var tab = liberator.tabs.getTab();
var activate = special ? true : false;
if (/\btabopen\b/.test(liberator.options["activate"]))
activate = !activate;
if (count < 1)
count = 1;
for (var i = 0; i < count; i++)
liberator.tabs.cloneTab(tab, activate);
});
} }
if (liberator.has("session")) if (liberator.has("session"))
@@ -795,6 +812,23 @@ liberator.Tabs = function () //{{{
} }
}, },
cloneTab: function (tab, activate)
{
var ss = Components.classes["@mozilla.org/browser/sessionstore;1"].
getService(Components.interfaces.nsISessionStore);
if (!tab)
tab = getBrowser().mTabContainer.selectedItem;
var tabState = ss.getTabState(tab);
var newTab = getBrowser().addTab();
ss.setTabState(newTab, tabState);
if (activate)
getBrowser().mTabContainer.selectedItem = newTab;
return newTab;
},
// TODO: when restarting a session FF selects the first tab and then the // TODO: when restarting a session FF selects the first tab and then the
// tab that was selected when the session was created. As a result the // tab that was selected when the session was created. As a result the
// alternate after a restart is often incorrectly tab 1 when there // alternate after a restart is often incorrectly tab 1 when there

View File

@@ -71,6 +71,13 @@ in a new tab. When used with [a]![a], the 'tabopen' value of the 'activate' opti
________________________________________________________________________________ ________________________________________________________________________________
|:tabd| |:tabduplicate|
||:[count]tabd[uplicate][!]|| +
________________________________________________________________________________
Duplicates current tab [count] times. Uses 'tabopen' value of the 'activate' to determine
if last cloned tab should be activated. When used with [a]![a], 'tabopen' value is negated.
________________________________________________________________________________
|:winopen| |:wopen| |:winedit| |:winopen| |:wopen| |:winedit|
||:wino[pen][!] [arg1], [arg2], ...|| + ||:wino[pen][!] [arg1], [arg2], ...|| +