neo-blessed/test/program-mouse.js

49 lines
1005 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
2013-07-14 13:06:47 +00:00
var blessed = require('../')
, util = require('util')
2013-07-28 19:29:07 +00:00
, program;
program = blessed.program({
dump: __dirname + '/logs/mouse.log'
});
2013-07-14 13:06:47 +00:00
// program.setMouse({
// allMotion: true,
// //utfMouse: true
// urxvtMouse: true
// }, true);
program.alternateBuffer();
program.enableMouse();
program.hideCursor();
program.on('mouse', function(data) {
program.cup(data.y, data.x);
program.write(' ', 'blue bg');
program.cup(0, 0);
program.write(util.inspect(data));
2013-07-14 13:06:47 +00:00
});
program.key(['q', 'escape', 'C-c'], function() {
program.showCursor();
program.disableMouse();
program.normalBuffer();
process.exit(0);
});
program.on('keypress', function(ch, data) {
if (data.name === 'mouse') return;
program.clear();
program.cup(0, 0);
program.write(util.inspect(data));
});
2015-01-31 20:57:21 +00:00
// program.getCursor(function(err, data) {
// program.write(util.inspect(data));
2015-01-31 20:57:21 +00:00
// });
2015-03-14 23:14:39 +00:00
// program.manipulateWindow(18, function(err, data) {
// program.write(util.inspect(data));
// });