mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 22:17:59 +01:00
use the multiline output window for :buffers and move the existing persistent
window functionality to :buffers!
This commit is contained in:
@@ -138,6 +138,50 @@ function Buffer() //{{{
|
||||
return window.content.document.title;
|
||||
});
|
||||
|
||||
// TODO: move to v.buffers.list()
|
||||
this.list = function(fullmode)
|
||||
{
|
||||
if (fullmode)
|
||||
{
|
||||
// toggle the special buffer previw window
|
||||
if (vimperator.bufferwindow.visible())
|
||||
{
|
||||
vimperator.bufferwindow.hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
var items = vimperator.completion.get_buffer_completions("");
|
||||
vimperator.bufferwindow.show(items);
|
||||
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: move this to vimperator.buffers.get()
|
||||
var items = vimperator.completion.get_buffer_completions("");
|
||||
var number, indicator, title, url;
|
||||
|
||||
var list = "<table>"
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
if (i == vimperator.tabs.index())
|
||||
indicator = " % ";
|
||||
else if (i == vimperator.tabs.index(vimperator.tabs.alternate))
|
||||
indicator = " # ";
|
||||
else
|
||||
indicator = " ";
|
||||
|
||||
[number, title] = items[i][0].split(/:\s+/, 2);
|
||||
url = items[i][1];
|
||||
|
||||
list += "<tr><td align=\"right\"> " + number + "</td><td>" + indicator + "</td><td>" + title + "</td><td>" + url + "</td></tr>";
|
||||
}
|
||||
list += "</table>";
|
||||
|
||||
vimperator.commandline.echo(list, true);
|
||||
}
|
||||
}
|
||||
|
||||
this.scrollBottom = function()
|
||||
{
|
||||
scrollToPercentiles(-1, 100);
|
||||
|
||||
@@ -353,21 +353,12 @@ function Commands() //{{{
|
||||
}
|
||||
));
|
||||
addDefaultCommand(new Command(["buffers", "files", "ls", "tabs"],
|
||||
// TODO: move to v.tabs/buffers
|
||||
function()
|
||||
{
|
||||
if (vimperator.bufferwindow.visible())
|
||||
vimperator.bufferwindow.hide();
|
||||
else
|
||||
{
|
||||
var items = vimperator.completion.get_buffer_completions("");
|
||||
vimperator.bufferwindow.show(items);
|
||||
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
|
||||
}
|
||||
},
|
||||
function(args, special) { vimperator.buffer.list(special); },
|
||||
{
|
||||
usage: ["buffers[!]"],
|
||||
short_help: "Show a list of all buffers (=tabs)",
|
||||
help: "If the list is already shown, close the preview window."
|
||||
help: "The special version <code class=\"command\">:buffers!</code> opens the buffer list in a persistent preview window. " +
|
||||
"Call the special version of this command again to close the window."
|
||||
}
|
||||
));
|
||||
addDefaultCommand(new Command(["delbm[arks]"],
|
||||
@@ -561,10 +552,7 @@ function Commands() //{{{
|
||||
}
|
||||
));
|
||||
addDefaultCommand(new Command(["hist[ory]", "hs"],
|
||||
function(args, special)
|
||||
{
|
||||
vimperator.history.list(args, special);
|
||||
},
|
||||
function(args, special) { vimperator.history.list(args, special); },
|
||||
{
|
||||
usage: ["hist[ory] [filter]", "history!"],
|
||||
short_help: "Show recently visited URLs",
|
||||
|
||||
@@ -328,7 +328,7 @@ function Mappings() //{{{
|
||||
}
|
||||
));
|
||||
addDefaultMap(new Map(vimperator.modes.NORMAL, ["B"],
|
||||
function() { vimperator.commands.buffers(); },
|
||||
function() { vimperator.buffer.list(true); },
|
||||
{
|
||||
short_help: "Toggle buffer list",
|
||||
help: "Toggles the display of the buffer list which shows all opened tabs."
|
||||
|
||||
@@ -188,6 +188,7 @@ function Tabs() //{{{
|
||||
this.alternate = alternates[1];
|
||||
}
|
||||
|
||||
// TODO: move to v.buffers
|
||||
this.alternate = this.getTab();
|
||||
|
||||
this.reload = function(tab, bypass_cache)
|
||||
|
||||
Reference in New Issue
Block a user