1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-06 22:35:45 +01:00

added :tabdetach, thanks Kris

This commit is contained in:
Martin Stubenschrott
2008-08-24 22:10:30 +00:00
parent 5dd44343ed
commit 1704adc334
5 changed files with 75 additions and 29 deletions

View File

@@ -24,6 +24,7 @@ Patches (in no special order):
* Lee Hinman (:open ./.. support)
* Bart Trojanowski (Makefile)
* Hannes Rist (:set titlestring support)
* Kris Maglione
* Nikolai Weibull ($VIMPERATOR_HOME)
* Joseph Xu (supporting multiple top level windows better)
* Raimon Grau Cuscó (document relationship navigation - ]], [[)

View File

@@ -1,7 +1,11 @@
<pre>
<b>Note:</b> If you don't wish to appear on this list when making a donation, please tell me.
Also drop me a note, if you want the donated amount to be displayed.
2008:
* Alexander Klink
* Chaz McGarvey
* Jesse Hathaway
* Takayuki Tsukitani
* Victor Nemkov
* John Lusth

1
NEWS
View File

@@ -1,6 +1,7 @@
<pre>
2008-08-16:
* version 2.0 (probably)
* add :tabdetach command
* new ;b extended hint mode (thanks Daniel Schaffrath)
* many bug fixes

View File

@@ -94,6 +94,18 @@ liberator.Tabs = function () //{{{
return position;
}
function copyTab(to, from)
{
var ss = Components.classes["@mozilla.org/browser/sessionstore;1"].
getService(Components.interfaces.nsISessionStore);
if (!from)
from = getBrowser().mTabContainer.selectedItem;
var tabState = ss.getTabState(from);
ss.setTabState(to, tabState);
}
// hide tabs initially
if (liberator.config.name == "Vimperator")
getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0].collapsed = true;
@@ -471,6 +483,15 @@ liberator.Tabs = function () //{{{
},
{ completer: function (filter) { return liberator.completion.url(filter); } });
liberator.commands.add(["tabde[tach]"],
"Detach current tab to its own window",
function (args, special, count)
{
liberator.tabs.detachTab(null);
},
{ argCount: "0" });
liberator.commands.add(["tabd[uplicate]"],
"Duplicate current tab",
function (args, special, count)
@@ -526,7 +547,6 @@ liberator.Tabs = function () //{{{
var completions = [];
for (var i = 0; i < undoItems.length; i++)
{
// undoItems[i].image is also available if needed for favicons
var url = undoItems[i].state.entries[0].url;
var title = undoItems[i].title;
if (liberator.completion.match([url, title], filter, false))
@@ -879,42 +899,48 @@ 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);
copyTab(newTab, tab);
if (activate)
getBrowser().mTabContainer.selectedItem = newTab;
return newTab;
},
detachTab: function (tab)
{
if (!tab)
tab = getBrowser().mTabContainer.selectedItem;
window.open();
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
copyTab(win.getBrowser().mCurrentTab, tab);
this.remove(tab, 1, false, 1);
},
selectAlternateTab: function ()
{
if (liberator.tabs.alternate == null || liberator.tabs.getTab() == liberator.tabs.alternate)
{
liberator.echoerr("E23: No alternate page");
return;
}
if (liberator.tabs.alternate == null || liberator.tabs.getTab() == liberator.tabs.alternate)
{
liberator.echoerr("E23: No alternate page");
return;
}
// NOTE: this currently relies on v.tabs.index() returning the
// currently selected tab index when passed null
var index = liberator.tabs.index(liberator.tabs.alternate);
// NOTE: this currently relies on v.tabs.index() returning the
// currently selected tab index when passed null
var index = liberator.tabs.index(liberator.tabs.alternate);
// TODO: since a tab close is more like a bdelete for us we
// should probably reopen the closed tab when a 'deleted'
// alternate is selected
if (index == -1)
liberator.echoerr("E86: Buffer does not exist"); // TODO: This should read "Buffer N does not exist"
else
liberator.tabs.select(index);
return;
// TODO: since a tab close is more like a bdelete for us we
// should probably reopen the closed tab when a 'deleted'
// alternate is selected
if (index == -1)
liberator.echoerr("E86: Buffer does not exist"); // TODO: This should read "Buffer N does not exist"
else
liberator.tabs.select(index);
},
// NOTE: when restarting a session FF selects the first tab and then the

View File

@@ -31,6 +31,13 @@ support it, currently:
* [c]:tab downloads[c]
________________________________________________________________________________
|:tabd[uplicate]| +
|:[count]:tab[duplicate]
________________________________________________________________________________
Duplicate the current tab and switch to the duplicate. If [count] is given,
duplicate the tab [count] times.
________________________________________________________________________________
//TODO: should the tab commands be moved back here?
See help::open[browsing.html#opening] for other ways to open new tabs.
@@ -113,13 +120,20 @@ Switch to the last tab.
________________________________________________________________________________
|:tabde[tach]| +
||:tabde[tach]||
________________________________________________________________________________
Detach the current tab, and open it in its own window.
________________________________________________________________________________
|:tabm| |:tabmove|
||:tabm[ove] [N]|| +
||:tabm[ove][!] +N | -N|| +
________________________________________________________________________________
Move the current tab after tab N. When N is 0 the current tab is made the
first one. Without N the current tab is made the last one. N can also be
prefixed with "+" or "-" to indicate a relative movement. If [!] is
Move the current tab to a position after tab N. When N is 0, the current tab
is made the first one. Without N the current tab is made the last one. N can
also be prefixed with "+" or "-" to indicate a relative movement. If [!] is
specified the movement wraps around the start or end of the tab list.
________________________________________________________________________________