Revert "add workarounds for libvte mouse events. see #89."

This reverts commit bb61e5c144.
This commit is contained in:
Christopher Jeffrey 2015-01-31 01:51:12 -08:00
parent bb61e5c144
commit df73eb5e3e
3 changed files with 6 additions and 38 deletions

View File

@ -117,12 +117,6 @@ function emitKey(stream, s) {
}
}
// libvte sometimes sends mouse events in chunks.
// deal with this in a better way later.
if (process.env.VTE_VERSION) {
if (~s.indexOf('\x1b[M')) return;
}
key.sequence = s;
if (s === '\r') {

View File

@ -355,19 +355,13 @@ Program.prototype.bindMouse = function() {
, self = this;
this.on('data', function(data) {
var text = decoder.write(data);
if (!text) return;
self._bindMouse(text, data);
data = decoder.write(data);
if (!data) return;
self._bindMouse(data);
});
};
Program.saneMouse = /^\x1b\[M([\x00\u0020-\uffff]{3})/;
Program.vteMouse = /^\x1b\[M([\u0000-\uffff]{3})/;
Program.x10Mouse = !process.env.VTE_VERSION
? Program.saneMouse
: Program.vteMouse;
Program.prototype._bindMouse = function(s, buf) {
Program.prototype._bindMouse = function(s) {
var self = this
, key
, parts;
@ -389,24 +383,12 @@ Program.prototype._bindMouse = function(s, buf) {
}
// XTerm / X10
if (parts = Program.x10Mouse.exec(s)) {
if (parts = /^\x1b\[M([\x00\u0020-\uffff]{3})/.exec(s)) {
var b = parts[1].charCodeAt(0)
, x = parts[1].charCodeAt(1)
, y = parts[1].charCodeAt(2)
, mod;
if (process.env.VTE_VERSION) {
if (x > 65000) {
x = buf[4];
}
// if libvte goes over 255, it sends this.
// it can't go beyond 262 with this:
if (x > 0x00 && x < 0x20) {
x += 223;
}
}
key.name = 'mouse';
key.type = 'X10';

View File

@ -22,14 +22,6 @@ program.on('mouse', function(data) {
console.log(data);
});
program.input.on('data', function(data) {
program.cup(10, 0);
program.write(JSON.stringify(data + ''));
program.nel();
program.cr();
program.write(JSON.stringify(Array.prototype.slice.call(data)));
});
program.key(['q', 'escape', 'C-c'], function() {
program.showCursor();
program.disableMouse();
@ -40,6 +32,6 @@ program.key(['q', 'escape', 'C-c'], function() {
program.on('keypress', function(ch, data) {
if (data.name === 'mouse') return;
program.clear();
program.cup(20, 0);
program.cup(0, 0);
console.log(data);
});