1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 15:48:00 +01:00

move the global function updateBufferList() to vimperator.tabs until we have

real buffers
This commit is contained in:
Doug Kearns
2007-07-05 06:14:32 +00:00
parent 31f06ea516
commit 54502e9929
3 changed files with 29 additions and 34 deletions

View File

@@ -350,7 +350,8 @@ function Commands() //{{{
} }
)); ));
addDefaultCommand(new Command(["delm[arks]"], addDefaultCommand(new Command(["delm[arks]"],
function(args, special) { function(args, special)
{
if (!special && !args) if (!special && !args)
{ {
vimperator.echoerr("E471: Argument required"); vimperator.echoerr("E471: Argument required");
@@ -515,7 +516,8 @@ function Commands() //{{{
} }
)); ));
addDefaultCommand(new Command(["ma[rk]"], addDefaultCommand(new Command(["ma[rk]"],
function(args) { function(args)
{
if (!args) { if (!args) {
vimperator.echoerr("E471: Argument required"); vimperator.echoerr("E471: Argument required");
return; return;
@@ -538,7 +540,8 @@ function Commands() //{{{
} }
)); ));
addDefaultCommand(new Command(["marks"], addDefaultCommand(new Command(["marks"],
function(args) { function(args)
{
if (args.length > 1 && !/[a-zA-Z]/.test(args)) if (args.length > 1 && !/[a-zA-Z]/.test(args))
{ {
vimperator.echoerr("E283: No marks matching \"" + args + "\""); vimperator.echoerr("E283: No marks matching \"" + args + "\"");
@@ -880,7 +883,8 @@ function Commands() //{{{
} }
)); ));
addDefaultCommand(new Command(["qmarka[dd]", "qma[dd]"], addDefaultCommand(new Command(["qmarka[dd]", "qma[dd]"],
function(args) { function(args)
{
var split = args.split(/\s+/); var split = args.split(/\s+/);
vimperator.quickmarks.add(split[0], split[1] ? split[1] : getCurrentLocation()); vimperator.quickmarks.add(split[0], split[1] ? split[1] : getCurrentLocation());
}, },
@@ -892,9 +896,7 @@ function Commands() //{{{
} }
)); ));
addDefaultCommand(new Command(["qmarkd[el]", "qmd[el]"], addDefaultCommand(new Command(["qmarkd[el]", "qmd[el]"],
function(args) { function(args) { vimperator.quickmarks.remove(args); },
vimperator.quickmarks.remove(args);
},
{ {
usage: ["qmarkd[el] {a-zA-Z0-9}"], usage: ["qmarkd[el] {a-zA-Z0-9}"],
short_help: "Remove a marked URL", short_help: "Remove a marked URL",
@@ -903,9 +905,7 @@ function Commands() //{{{
} }
)); ));
addDefaultCommand(new Command(["qmarks", "qms"], addDefaultCommand(new Command(["qmarks", "qms"],
function(args) { function(args) { vimperator.quickmarks.list(args); },
vimperator.quickmarks.list(args);
},
{ {
usage: ["qmarks"], usage: ["qmarks"],
short_help: "Shows marked URLs", short_help: "Shows marked URLs",
@@ -934,9 +934,7 @@ function Commands() //{{{
} }
)); ));
addDefaultCommand(new Command(["wino[pen]", "w[open]", "wine[dit]"], addDefaultCommand(new Command(["wino[pen]", "w[open]", "wine[dit]"],
function() { function() { vimperator.echo("winopen not implemented yet"); },
vimperator.echo("winopen not implemented yet");
},
{ {
usage: ["wino[pen] [url] [| url]"], usage: ["wino[pen] [url] [| url]"],
short_help: "Open an URL in a new window", short_help: "Open an URL in a new window",
@@ -1324,21 +1322,6 @@ function yankCurrentSelection()
vimperator.echo("Yanked " + sel); vimperator.echo("Yanked " + sel);
} }
/////////////////////////////////////////////////////////////////////}}}
// tab/buffer related functions ////////////////////////////////////////
/////////////////////////////////////////////////////////////////////{{{
// updates the buffer preview in place only if list is visible
function updateBufferList()
{
if (!vimperator.bufferwindow.visible())
return false;
var items = get_buffer_completions("");
vimperator.bufferwindow.show(items);
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
}
/////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////}}}
// scrolling /////////////////////////////////////////////////////////// // scrolling ///////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////{{{

View File

@@ -467,7 +467,8 @@ function Options() //{{{
"</table>" + "</table>" +
"When there is only a single match, it is fully completed regardless of the case.", "When there is only a single match, it is fully completed regardless of the case.",
default_value: "list:full", default_value: "list:full",
validator: function (value) { validator: function (value)
{
if (/^(?:(?:full|longest|list|list:full|list:longest)(?:,(?!,))?){0,3}(?:full|longest|list|list:full|list:longest)?$/.test(value)) if (/^(?:(?:full|longest|list|list:full|list:longest)(?:,(?!,))?){0,3}(?:full|longest|list|list:full|list:longest)?$/.test(value))
return true; return true;
else else

View File

@@ -363,22 +363,22 @@ function Events() //{{{
var tabcontainer = getBrowser().tabContainer; var tabcontainer = getBrowser().tabContainer;
tabcontainer.addEventListener("TabMove", function(event) { tabcontainer.addEventListener("TabMove", function(event) {
vimperator.statusline.updateTabCount() vimperator.statusline.updateTabCount()
updateBufferList(); vimperator.tabs.updateBufferList();
}, false); }, false);
tabcontainer.addEventListener("TabOpen", function(event) { tabcontainer.addEventListener("TabOpen", function(event) {
vimperator.statusline.updateTabCount(); vimperator.statusline.updateTabCount();
updateBufferList(); vimperator.tabs.updateBufferList();
vimperator.setMode(); // trick to reshow the mode in the command line vimperator.setMode(); // trick to reshow the mode in the command line
vimperator.tabs.updateSelectionHistory(); vimperator.tabs.updateSelectionHistory();
}, false); }, false);
tabcontainer.addEventListener("TabClose", function(event) { tabcontainer.addEventListener("TabClose", function(event) {
vimperator.statusline.updateTabCount() vimperator.statusline.updateTabCount()
updateBufferList(); vimperator.tabs.updateBufferList();
vimperator.setMode(); // trick to reshow the mode in the command line vimperator.setMode(); // trick to reshow the mode in the command line
}, false); }, false);
tabcontainer.addEventListener("TabSelect", function(event) { tabcontainer.addEventListener("TabSelect", function(event) {
vimperator.statusline.updateTabCount(); vimperator.statusline.updateTabCount();
updateBufferList(); vimperator.tabs.updateBufferList();
vimperator.setMode(); // trick to reshow the mode in the command line vimperator.setMode(); // trick to reshow the mode in the command line
vimperator.tabs.updateSelectionHistory(); vimperator.tabs.updateSelectionHistory();
}, false); }, false);
@@ -419,7 +419,7 @@ function Events() //{{{
} }
// code which should happen for all (also background) newly loaded tabs goes here: // code which should happen for all (also background) newly loaded tabs goes here:
updateBufferList(); vimperator.tabs.updateBufferList();
//update history //update history
var url = getCurrentLocation(); var url = getCurrentLocation();
@@ -1022,6 +1022,17 @@ function Tabs() //{{{
this.alternate = this.getTab(); this.alternate = this.getTab();
// updates the buffer preview in place only if list is visible
this.updateBufferList = function()
{
if (!vimperator.bufferwindow.visible())
return false;
var items = get_buffer_completions("");
vimperator.bufferwindow.show(items);
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
}
this.reload = function(tab, bypass_cache) this.reload = function(tab, bypass_cache)
{ {
if (bypass_cache) if (bypass_cache)