mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-23 09:20:05 +00:00
allow VTE mouse access to cells up to 287. see #89.
This commit is contained in:
parent
1d900c928d
commit
e9b3bdac34
@ -401,6 +401,27 @@ Program.prototype._bindMouse = function(s, buf) {
|
||||
}
|
||||
}
|
||||
|
||||
// XTerm / X10 for buggy VTE
|
||||
// VTE can only send unsigned chars and no unicode for coords. This limits
|
||||
// them to 0xff. However, normally the x10 protocol does not allow a byte
|
||||
// under 0x20, but since VTE can have the bytes overflow, we can consider
|
||||
// bytes below 0x20 to be up to 0xff + 0x20. This gives a limit of 287. Since
|
||||
// characters ranging from 223 to 248 confuse javascript's utf parser, we
|
||||
// need to parse the raw binary.
|
||||
if (this.isVTE && buf[0] === 0x1b && buf[1] === 0x5b && buf[2] === 0x4d) {
|
||||
var b = buf[3]
|
||||
, x = buf[4]
|
||||
, y = buf[5];
|
||||
|
||||
if (x < 0x20) x += 255;
|
||||
if (y < 0x20) y += 255;
|
||||
|
||||
s = '\x1b[M'
|
||||
+ String.fromCharCode(b)
|
||||
+ String.fromCharCode(x)
|
||||
+ String.fromCharCode(y);
|
||||
}
|
||||
|
||||
// XTerm / X10
|
||||
if (parts = /^\x1b\[M([\x00\u0020-\uffff]{3})/.exec(s)) {
|
||||
var b = parts[1].charCodeAt(0)
|
||||
|
@ -36,9 +36,10 @@ program.on('keypress', function(ch, data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
program.on('mousebuf', function(buf) {
|
||||
program.on('mouse-debug', function(data) {
|
||||
program.cup(20, 0);
|
||||
console.log(buf);
|
||||
data = Array.prototype.slice.call(data);
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
// program.getCursor(function(err, data) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user