pass in the env to canon.execute to allow multiple editors

This commit is contained in:
Fabian Jakobs 2010-12-14 11:36:21 +01:00
commit 5e0695b588
3 changed files with 8 additions and 8 deletions

View file

@ -56,7 +56,7 @@ var KeyBinding = function(element, editor, config) {
var commandName = (_self.config.reverse[hashId] || {})[(key
|| String.fromCharCode(e.keyCode)).toLowerCase()];
var success = canon.exec(commandName);
var success = canon.exec(commandName, {editor: editor});
if (success) {
return event.stopEvent(e);
}

View file

@ -244,8 +244,10 @@ exports.Assignment = Assignment;
* class
* @constructor
*/
function Requisition() {
function Requisition(env) {
this.env = env;
}
Requisition.prototype = {
/**
* The command that we are about to execute.
@ -377,7 +379,9 @@ exports.Requisition = Requisition;
* if not specified.
* @constructor
*/
function CliRequisition(options) {
function CliRequisition(env, options) {
Requisition.call(this, env);
if (options && options.flags) {
/**
* TODO: We were using a default of keyboard.buildFlags({ });

View file

@ -37,7 +37,6 @@
define(function(require, exports, module) {
var console = require('pilot/console');
var Trace = require('pilot/stacktrace').Trace;
var oop = require('pilot/oop').oop;
@ -70,11 +69,8 @@ var commandExtensionSpec = {
indexOn: 'name'
};
var env;
exports.startup = function(data, reason) {
// TODO: this is probably all kinds of evil, but we need something working
env = data.env;
catalog.addExtensionSpec(commandExtensionSpec);
};
@ -160,7 +156,7 @@ exports.getCommandNames = function() {
* everything it needs to about the command params
* @param command Either a command, or the name of one
*/
exports.exec = function(command, args) {
exports.exec = function(command, env, args) {
if (typeof command === 'string') {
command = commands[command];
}