Begining of key binding
This commit is contained in:
@@ -181,6 +181,13 @@ function Buffer (client, buffId, path) {
|
||||
this.remove = function (off, length, callback) {
|
||||
client.callFunction("remove", buffId, Types.position(off), length, callback);
|
||||
};
|
||||
|
||||
var keysCallback = {};
|
||||
|
||||
this.registerKey = function (key, callback) {
|
||||
client.specialKeys(key);
|
||||
Object.defineProperty(keysCallback, key, { value: callback, configurable: true});
|
||||
};
|
||||
}
|
||||
|
||||
util.inherits(Buffer, EventEmitter);
|
||||
|
||||
@@ -277,6 +277,18 @@ function Controler(socket, authentication) {
|
||||
buffers[buffId].emit.apply(buffers[buffId], Array.prototype.slice.call(arguments, 1));
|
||||
delete buffers[buffId];
|
||||
}
|
||||
break;
|
||||
case event.keyAtPos :
|
||||
//Call the key registered callback if it exists.
|
||||
var buffer = getBuffer(buffId);
|
||||
|
||||
if (keysCallback.indexOf(arguments[2]) >= 0) {
|
||||
keysCallback.call(null, buffer, arguments[3].split("/")[0], arguments[3].split("/")[1]);
|
||||
}
|
||||
else if (buffer === undefined) {
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case event.fileOpened :
|
||||
//File opened. Check if it's already managed by controler.
|
||||
@@ -401,7 +413,7 @@ function Controler(socket, authentication) {
|
||||
client.callFunction("getCursor", 0, callback);
|
||||
};
|
||||
|
||||
/* CONNTROLER CONTROL */
|
||||
/* CONTROLER CONTROL */
|
||||
|
||||
//Close the underlying connexion with Vim, but not Vim
|
||||
this.detach = function () {
|
||||
@@ -430,6 +442,14 @@ function Controler(socket, authentication) {
|
||||
return buffers[buffId];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var keysCallback = {};
|
||||
|
||||
this.registerKey = function (key, callback) {
|
||||
self.specialKeys(key);
|
||||
Object.defineProperty(keysCallback, key, { value: callback, configurable: true});
|
||||
}
|
||||
}
|
||||
|
||||
util.inherits(Controler, EventEmitter);
|
||||
|
||||
Reference in New Issue
Block a user