mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 22:07:59 +01:00
move initialisation of vimperator.input to the constructor function
This commit is contained in:
@@ -83,13 +83,6 @@ function init() //{{{
|
||||
Vimperator.prototype.echo = vimperator.commandline.echo;
|
||||
Vimperator.prototype.echoerr = vimperator.commandline.echoErr;
|
||||
|
||||
// XXX: move into Vimperator() ?
|
||||
vimperator.input = {
|
||||
buffer: "", // partial command storage
|
||||
pendingMap: null, // pending map storage
|
||||
count: -1 // parsed count from the input buffer
|
||||
};
|
||||
|
||||
// XXX: move elsewhere
|
||||
vimperator.registerCallback("submit", vimperator.modes.EX, function(command) { /*vimperator.*/execute(command); } );
|
||||
vimperator.registerCallback("complete", vimperator.modes.EX, function(str) { return exTabCompletion(str); } );
|
||||
@@ -223,6 +216,12 @@ function Vimperator() //{{{
|
||||
|
||||
this.version = "###VERSION### CVS (created: ###DATE###)";
|
||||
|
||||
this.input = {
|
||||
buffer: "", // partial command storage
|
||||
pendingMap: null, // pending map storage
|
||||
count: -1 // parsed count from the input buffer
|
||||
};
|
||||
|
||||
/////////////// callbacks ////////////////////////////
|
||||
// XXX: shouldn't that callback be moved to commandline? --mst
|
||||
/**
|
||||
@@ -237,6 +236,7 @@ function Vimperator() //{{{
|
||||
// TODO: check if callback is already registered
|
||||
callbacks.push([type, mode, func]);
|
||||
}
|
||||
|
||||
this.triggerCallback = function(type, data)
|
||||
{
|
||||
for (var i in callbacks)
|
||||
@@ -274,12 +274,14 @@ function Vimperator() //{{{
|
||||
if (!silent)
|
||||
showMode();
|
||||
}
|
||||
|
||||
// returns true if "whichmode" is found in either the main or
|
||||
// extended mode
|
||||
this.hasMode = function(whichmode)
|
||||
{
|
||||
return ((mode & whichmode) || (extended_mode & whichmode) > 0) ? true : false;
|
||||
}
|
||||
|
||||
this.addMode = function(main, extended)
|
||||
{
|
||||
if (main)
|
||||
@@ -289,6 +291,7 @@ function Vimperator() //{{{
|
||||
|
||||
showMode();
|
||||
}
|
||||
|
||||
// always show the new mode in the statusline
|
||||
this.removeMode = function(main, extended)
|
||||
{
|
||||
@@ -441,7 +444,7 @@ function Events() //{{{
|
||||
{
|
||||
// BIG TODO: removeEventListeners() to avoid mem leaks
|
||||
window.dump("TODO: remove eventlisteners");
|
||||
};
|
||||
}
|
||||
|
||||
this.onEscape = function()
|
||||
{
|
||||
@@ -453,8 +456,7 @@ function Events() //{{{
|
||||
vimperator.focusContent();
|
||||
vimperator.statusline.updateUrl();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
this.onKeyPress = function(event)
|
||||
{
|
||||
@@ -682,7 +684,7 @@ function Events() //{{{
|
||||
}
|
||||
vimperator.statusline.updateInputBuffer(vimperator.input.buffer);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
window.addEventListener("keypress", this.onKeyPress, true);
|
||||
|
||||
|
||||
@@ -777,6 +779,7 @@ function Events() //{{{
|
||||
setDefaultStatus : function(status) { ; },
|
||||
onLinkIconAvailable: function() { ; }
|
||||
};
|
||||
|
||||
window.XULBrowserWindow = this.progressListener;
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
|
||||
Reference in New Issue
Block a user