Comparing version 0.0.1 to 0.0.3
@@ -5,3 +5,3 @@ { | ||
"author": "Christopher Jeffrey", | ||
"version": "0.0.1", | ||
"version": "0.0.3", | ||
"main": "./lib/program.js", | ||
@@ -8,0 +8,0 @@ "repository": "git://github.com/chjj/blessed.git", |
@@ -6,3 +6,5 @@ # blessed | ||
As of right now, it does not read all terminfo. It was designed for one | ||
terminal's terminfo: **xterm**. | ||
terminal's terminfo: **xterm**, but if you understand the differences between | ||
the three popular vt100-based terminals (xterm, screen, rxvt), you should be | ||
able to use it for any terminal. | ||
@@ -15,34 +17,65 @@ I want this library to eventually become a high-level library for terminal | ||
``` js | ||
var Program = require('blessed').Program | ||
, program = new Program; | ||
var blessed = require('blessed') | ||
, program = blessed(); | ||
program.on('key', function(ch, key) { | ||
if (key.ctrl && key.name === 'c') { | ||
console.log('This would have been SIGINT!'); | ||
program.on('keypress', function(ch, key) { | ||
if (key.name === 'q') { | ||
program.clear(); | ||
program.disableMouse(); | ||
program.showCursor(); | ||
program.normalBuffer(); | ||
process.exit(0); | ||
} | ||
}); | ||
program.setMouse({ normalMouse: true }); | ||
program.on('mouse', function(data) { | ||
if (data.action === 'mouseup') return; | ||
program.move(1, program.rows); | ||
program.eraseInLine('right'); | ||
if (data.action === 'wheelup') { | ||
program.write('Mouse wheel up at: ' + data.x + ', ' + data.y); | ||
} else if (data.action === 'wheeldown') { | ||
program.write('Mouse wheel down at: ' + data.x + ', ' + data.y); | ||
} else if (data.action === 'mousedown' && data.button === 'left') { | ||
program.write('Left button down at: ' + data.x + ', ' + data.y); | ||
} else if (data.action === 'mousedown' && data.button === 'right') { | ||
program.write('Right button down at: ' + data.x + ', ' + data.y); | ||
} else { | ||
program.write('Mouse at: ' + data.x + ', ' + data.y); | ||
} | ||
program.move(data.x, data.y); | ||
program.bg('red'); | ||
program.write(' '); | ||
program.bg('!red'); | ||
}); | ||
program.mouse('mouse', function(data) { | ||
console.log('Mouse event received:'); | ||
console.log(data.button, data.x, data.y); | ||
program.on('focus', function() { | ||
program.move(1, program.rows); | ||
program.write('Gained focus.'); | ||
}); | ||
program.on('blur', function() { | ||
program.move(1, program.rows); | ||
program.write('Lost focus.'); | ||
}); | ||
program.alternateBuffer(); | ||
program.enableMouse(); | ||
program.hideCursor(); | ||
program.clear(); | ||
program.bg('white'); | ||
program.fg('blue'); | ||
program.write('Hello world'); | ||
program.fg('!blue'); | ||
program.setx(1); | ||
program.move(1, 1); | ||
program.bg('black'); | ||
program.write('Hello world', 'blue fg'); | ||
program.setx((program.cols / 2 | 0) - 4); | ||
program.down(5); | ||
program.write('Hi again!'); | ||
program.bg('!white'); | ||
program.bg('!black'); | ||
program.feed(); | ||
program.getCursor(function(data) { | ||
console.log('Cursor is at: %s, %s.', data.x, data.y); | ||
program.getCursor(function(err, data) { | ||
if (!err) { | ||
program.write('Cursor is at: ' + data.x + ', ' + data.y + '.'); | ||
program.feed(); | ||
} | ||
@@ -52,12 +85,3 @@ program.charset('SCLD'); | ||
program.charset('US'); | ||
program.setx(0); | ||
setTimeout(function() { | ||
program.eraseInLine('right'); | ||
setTimeout(function() { | ||
program.clear(); | ||
program.normalBuffer(); | ||
program.setMouse({ normalMouse: false }); | ||
}, 2000); | ||
}, 2000); | ||
program.setx(1); | ||
}); | ||
@@ -64,0 +88,0 @@ ``` |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
75131
6
2102
92
0
2