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

move initialisation of vimperator.input to the constructor function

This commit is contained in:
Doug Kearns
2007-07-12 07:48:27 +00:00
parent fbc88ab606
commit 8d1e4ef276

View File

@@ -83,13 +83,6 @@ function init() //{{{
Vimperator.prototype.echo = vimperator.commandline.echo; Vimperator.prototype.echo = vimperator.commandline.echo;
Vimperator.prototype.echoerr = vimperator.commandline.echoErr; 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 // XXX: move elsewhere
vimperator.registerCallback("submit", vimperator.modes.EX, function(command) { /*vimperator.*/execute(command); } ); vimperator.registerCallback("submit", vimperator.modes.EX, function(command) { /*vimperator.*/execute(command); } );
vimperator.registerCallback("complete", vimperator.modes.EX, function(str) { return exTabCompletion(str); } ); vimperator.registerCallback("complete", vimperator.modes.EX, function(str) { return exTabCompletion(str); } );
@@ -223,6 +216,12 @@ function Vimperator() //{{{
this.version = "###VERSION### CVS (created: ###DATE###)"; 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 //////////////////////////// /////////////// callbacks ////////////////////////////
// XXX: shouldn't that callback be moved to commandline? --mst // XXX: shouldn't that callback be moved to commandline? --mst
/** /**
@@ -237,6 +236,7 @@ function Vimperator() //{{{
// TODO: check if callback is already registered // TODO: check if callback is already registered
callbacks.push([type, mode, func]); callbacks.push([type, mode, func]);
} }
this.triggerCallback = function(type, data) this.triggerCallback = function(type, data)
{ {
for (var i in callbacks) for (var i in callbacks)
@@ -274,12 +274,14 @@ function Vimperator() //{{{
if (!silent) if (!silent)
showMode(); showMode();
} }
// returns true if "whichmode" is found in either the main or // returns true if "whichmode" is found in either the main or
// extended mode // extended mode
this.hasMode = function(whichmode) this.hasMode = function(whichmode)
{ {
return ((mode & whichmode) || (extended_mode & whichmode) > 0) ? true : false; return ((mode & whichmode) || (extended_mode & whichmode) > 0) ? true : false;
} }
this.addMode = function(main, extended) this.addMode = function(main, extended)
{ {
if (main) if (main)
@@ -289,6 +291,7 @@ function Vimperator() //{{{
showMode(); showMode();
} }
// always show the new mode in the statusline // always show the new mode in the statusline
this.removeMode = function(main, extended) this.removeMode = function(main, extended)
{ {
@@ -441,7 +444,7 @@ function Events() //{{{
{ {
// BIG TODO: removeEventListeners() to avoid mem leaks // BIG TODO: removeEventListeners() to avoid mem leaks
window.dump("TODO: remove eventlisteners"); window.dump("TODO: remove eventlisteners");
}; }
this.onEscape = function() this.onEscape = function()
{ {
@@ -453,8 +456,7 @@ function Events() //{{{
vimperator.focusContent(); vimperator.focusContent();
vimperator.statusline.updateUrl(); vimperator.statusline.updateUrl();
} }
}; }
this.onKeyPress = function(event) this.onKeyPress = function(event)
{ {
@@ -682,7 +684,7 @@ function Events() //{{{
} }
vimperator.statusline.updateInputBuffer(vimperator.input.buffer); vimperator.statusline.updateInputBuffer(vimperator.input.buffer);
return false; return false;
}; }
window.addEventListener("keypress", this.onKeyPress, true); window.addEventListener("keypress", this.onKeyPress, true);
@@ -777,6 +779,7 @@ function Events() //{{{
setDefaultStatus : function(status) { ; }, setDefaultStatus : function(status) { ; },
onLinkIconAvailable: function() { ; } onLinkIconAvailable: function() { ; }
}; };
window.XULBrowserWindow = this.progressListener; window.XULBrowserWindow = this.progressListener;
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation) .getInterface(Components.interfaces.nsIWebNavigation)