fix program.getCursor. fixes #25.

This commit is contained in:
Christopher Jeffrey 2015-01-31 12:57:21 -08:00
parent a980a295bf
commit f055496161
2 changed files with 5 additions and 30 deletions

View File

@ -872,7 +872,7 @@ Program.prototype._bindResponse = function(s) {
// Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI
// ? r ; c R (assumes page is zero).
if (parts = /^\x1b\[(\?)?(\d+);(\d+)R/.exec(s)) {
out.event = 'device-status-report';
out.event = 'device-status';
out.code = 'DSR';
out.type = 'cursor-status';
@ -1158,35 +1158,6 @@ Program.prototype._bindResponse = function(s) {
}
};
Program.prototype.receive = function(text, callback) {
var listeners = (this._events && this._events['keypress']) || []
, bak = listeners.slice()
, self = this;
if (!this.input.isRaw) {
throw new Error('Input must be raw.');
}
listeners.length = 0;
if (!callback) {
callback = text;
text = null;
}
this.input.once('data', function(data) {
listeners.push.apply(listeners, bak);
if (typeof data !== 'string') {
data = data.toString('utf8');
}
return callback(null, data);
});
if (text != null) {
return this._write(text);
}
};
Program.prototype.response = function(name, text, callback) {
if (arguments.length === 2) {
callback = text;

View File

@ -35,3 +35,7 @@ program.on('keypress', function(ch, data) {
program.cup(0, 0);
console.log(data);
});
// program.getCursor(function(err, data) {
// console.log(data);
// });