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

added :b# for switching to alternative buffer, also finally commited Kipling's patch to use getShortcutOrURI

This commit is contained in:
Martin Stubenschrott
2008-07-28 22:16:04 +00:00
parent 23692e57aa
commit 60f040e54e
7 changed files with 59 additions and 82 deletions

View File

@@ -238,26 +238,7 @@ liberator.Tabs = function () //{{{
liberator.mappings.add([liberator.modes.NORMAL], ["<C-^>", "<C-6>"],
"Select the alternate tab",
function ()
{
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);
// 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);
});
function () { liberator.tabs.selectAlternateTab(); });
}
/////////////////////////////////////////////////////////////////////////////}}}
@@ -748,10 +729,9 @@ liberator.Tabs = function () //{{{
switchTo: function (buffer, allowNonUnique, count, reverse)
{
if (buffer == "")
{
return;
}
else if (buffer != null)
if (buffer != null)
{
// store this command, so it can be repeated with "B"
lastBufferSwitchArgs = buffer;
@@ -764,6 +744,12 @@ liberator.Tabs = function () //{{{
allowNonUnique = lastBufferSwitchSpecial;
}
if (buffer == "#")
{
liberator.tabs.selectAlternateTab();
return;
}
if (!count || count < 1)
count = 1;
if (typeof reverse != "boolean")
@@ -829,6 +815,29 @@ liberator.Tabs = function () //{{{
return newTab;
},
selectAlternateTab: function ()
{
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);
// 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: 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