1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 20:07:59 +01:00

move the execute() global function to a slot of vimperator

This commit is contained in:
Doug Kearns
2007-08-02 05:10:55 +00:00
parent f22430b57d
commit aca44dc9d2
2 changed files with 21 additions and 23 deletions

View File

@@ -421,7 +421,7 @@ function Commands() //{{{
}
));
addDefaultCommand(new Command(["exe[cute]"],
execute,
function(args) { vimperator.execute(args) },
{
usage: ["exe[cute] {expr1} [ ... ]"],
short_help: "Execute the string that results from the evaluation of {expr1} as an Ex command.",
@@ -541,7 +541,7 @@ function Commands() //{{{
if (/^:/.test(rhs))
{
vimperator.mappings.add(
new Map(vimperator.modes.NORMAL, [lhs], function() { execute(rhs); }, { rhs: rhs })
new Map(vimperator.modes.NORMAL, [lhs], function() { vimperator.execute(rhs); }, { rhs: rhs })
);
}
else
@@ -651,7 +651,7 @@ function Commands() //{{{
if (/^:/.test(rhs))
{
vimperator.mappings.add(
new Map(vimperator.modes.NORMAL, [lhs], function() { execute(rhs); }, { rhs: rhs })
new Map(vimperator.modes.NORMAL, [lhs], function() { vimperator.execute(rhs); }, { rhs: rhs })
);
}
else
@@ -933,7 +933,7 @@ function Commands() //{{{
}
));
addDefaultCommand(new Command(["tab"],
function() { execute(arguments[0], null, null, {inTab: true}); },
function(args) { vimperator.execute(args, { inTab: true }); },
{
usage: ["tab {cmd}"],
short_help: "Execute {cmd} and tell it to output in a new tab",
@@ -1195,19 +1195,6 @@ function tokenize_ex(string, tag)
return matches;
}
function execute(string)
{
if (!string)
return;
var tokens = tokenize_ex(string.replace(/^'(.*)'$/, '$1'));
tokens[4] = arguments[3];
return execute_command.apply(this, tokens);
}
/* takes a string like 'google bla, www.osnews.com'
* and returns an array ['www.google.com/search?q=bla', 'www.osnews.com']
*/

View File

@@ -207,7 +207,18 @@ const vimperator = (function() //{{{
sound_service.beep();
},
// After pressing Escape, put focus on a non-input field of the browser document
execute: function(string, modifiers)
{
if (!string)
return;
var tokens = tokenize_ex(string.replace(/^'(.*)'$/, '$1'));
tokens[4] = modifiers;
return execute_command.apply(this, tokens);
},
// after pressing Escape, put focus on a non-input field of the browser document
focusContent: function()
{
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
@@ -491,7 +502,7 @@ const vimperator = (function() //{{{
var s = fd.read();
fd.close();
// handle pure javascript files special
// handle pure javascript files specially
if (filename.search("\.js$") != -1)
eval(s);
else
@@ -580,7 +591,7 @@ const vimperator = (function() //{{{
vimperator.echoerr = vimperator.commandline.echoErr;
// TODO: 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); } );
//TODO: move most of the following code to Options constructor
@@ -637,7 +648,7 @@ const vimperator = (function() //{{{
{
window.dump("Vimperator shutdown\n");
/*** save our preferences ***/
// save our preferences
vimperator.commandline.destroy();
vimperator.events.destroy();
vimperator.quickmarks.destroy();