Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blessed

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blessed - npm Package Compare versions

Comparing version 0.0.1 to 0.0.3

example/index.js

2

package.json

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc