mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 02:07:59 +01:00
Adding :tabduplicate patch from Konstantin Stepanov
This commit is contained in:
2
AUTHORS
2
AUTHORS
@@ -12,7 +12,7 @@ Inactive/former developers:
|
||||
* Viktor Kojouharov (Виктор Кожухаров)
|
||||
|
||||
Patches (in no special order):
|
||||
* Konstantin Stepanov (:%foo support)
|
||||
* Konstantin Stepanov (:%foo support, :tabduplicate)
|
||||
* Lukas Mai
|
||||
* Guido Van Hoecke
|
||||
* Daniel Trstenjak (various things with hints)
|
||||
|
||||
1
NEWS
1
NEWS
@@ -8,6 +8,7 @@
|
||||
generous donation which made this behavior possible)
|
||||
* IMPORTANT: ctrl-x/a never take possible negative URLs into account, it was just
|
||||
too unpredictable
|
||||
* add :tabduplicate command
|
||||
* new 'urlseparator' option for specifying the regexp used to split the arg to
|
||||
:open, :tabopen and :winopen
|
||||
* :set editor now accepts quoting/escaping to use an editor with spaces in the path
|
||||
|
||||
@@ -426,6 +426,23 @@ liberator.Tabs = function () //{{{
|
||||
liberator.open("about:blank", where);
|
||||
},
|
||||
{ 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"))
|
||||
@@ -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
|
||||
// tab that was selected when the session was created. As a result the
|
||||
// alternate after a restart is often incorrectly tab 1 when there
|
||||
|
||||
@@ -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|
|
||||
||:wino[pen][!] [arg1], [arg2], ...|| +
|
||||
|
||||
Reference in New Issue
Block a user