1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-17 22:23:31 +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) * Lee Hinman (:open ./.. support)
* Bart Trojanowski (Makefile) * Bart Trojanowski (Makefile)
* Hannes Rist (:set titlestring support) * Hannes Rist (:set titlestring support)
* Kris Maglione
* Nikolai Weibull ($VIMPERATOR_HOME) * Nikolai Weibull ($VIMPERATOR_HOME)
* Joseph Xu (supporting multiple top level windows better) * Joseph Xu (supporting multiple top level windows better)
* Raimon Grau Cuscó (document relationship navigation - ]], [[) * Raimon Grau Cuscó (document relationship navigation - ]], [[)

View File

@@ -1,7 +1,11 @@
<pre> <pre>
<b>Note:</b> If you don't wish to appear on this list when making a donation, please tell me. <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: 2008:
* Alexander Klink
* Chaz McGarvey
* Jesse Hathaway
* Takayuki Tsukitani * Takayuki Tsukitani
* Victor Nemkov * Victor Nemkov
* John Lusth * John Lusth

1
NEWS
View File

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

View File

@@ -94,6 +94,18 @@ liberator.Tabs = function () //{{{
return position; 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 // hide tabs initially
if (liberator.config.name == "Vimperator") if (liberator.config.name == "Vimperator")
getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0].collapsed = true; getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0].collapsed = true;
@@ -471,6 +483,15 @@ liberator.Tabs = function () //{{{
}, },
{ completer: function (filter) { return liberator.completion.url(filter); } }); { 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]"], liberator.commands.add(["tabd[uplicate]"],
"Duplicate current tab", "Duplicate current tab",
function (args, special, count) function (args, special, count)
@@ -526,7 +547,6 @@ liberator.Tabs = function () //{{{
var completions = []; var completions = [];
for (var i = 0; i < undoItems.length; i++) 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 url = undoItems[i].state.entries[0].url;
var title = undoItems[i].title; var title = undoItems[i].title;
if (liberator.completion.match([url, title], filter, false)) if (liberator.completion.match([url, title], filter, false))
@@ -879,42 +899,48 @@ liberator.Tabs = function () //{{{
cloneTab: function (tab, activate) 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(); var newTab = getBrowser().addTab();
ss.setTabState(newTab, tabState); copyTab(newTab, tab);
if (activate) if (activate)
getBrowser().mTabContainer.selectedItem = newTab; getBrowser().mTabContainer.selectedItem = newTab;
return 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 () selectAlternateTab: function ()
{ {
if (liberator.tabs.alternate == null || liberator.tabs.getTab() == liberator.tabs.alternate) if (liberator.tabs.alternate == null || liberator.tabs.getTab() == liberator.tabs.alternate)
{ {
liberator.echoerr("E23: No alternate page"); liberator.echoerr("E23: No alternate page");
return; return;
} }
// NOTE: this currently relies on v.tabs.index() returning the // NOTE: this currently relies on v.tabs.index() returning the
// currently selected tab index when passed null // currently selected tab index when passed null
var index = liberator.tabs.index(liberator.tabs.alternate); var index = liberator.tabs.index(liberator.tabs.alternate);
// TODO: since a tab close is more like a bdelete for us we // TODO: since a tab close is more like a bdelete for us we
// should probably reopen the closed tab when a 'deleted' // should probably reopen the closed tab when a 'deleted'
// alternate is selected // alternate is selected
if (index == -1) if (index == -1)
liberator.echoerr("E86: Buffer does not exist"); // TODO: This should read "Buffer N does not exist" liberator.echoerr("E86: Buffer does not exist"); // TODO: This should read "Buffer N does not exist"
else else
liberator.tabs.select(index); liberator.tabs.select(index);
return;
}, },
// NOTE: when restarting a session FF selects the first tab and then the // 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] * [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? //TODO: should the tab commands be moved back here?
See help::open[browsing.html#opening] for other ways to open new tabs. 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| |:tabmove|
||:tabm[ove] [N]|| + ||:tabm[ove] [N]|| +
||:tabm[ove][!] +N | -N|| + ||:tabm[ove][!] +N | -N|| +
________________________________________________________________________________ ________________________________________________________________________________
Move the current tab after tab N. When N is 0 the current tab is made the Move the current tab to a position after tab N. When N is 0, the current tab
first one. Without N the current tab is made the last one. N can also be is made the first one. Without N the current tab is made the last one. N can
prefixed with "+" or "-" to indicate a relative movement. If [!] is 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. specified the movement wraps around the start or end of the tab list.
________________________________________________________________________________ ________________________________________________________________________________