Skip to content

Instantly share code, notes, and snippets.

@t3h2mas
Created June 17, 2014 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t3h2mas/c4c6f13113c8b79dec75 to your computer and use it in GitHub Desktop.
Save t3h2mas/c4c6f13113c8b79dec75 to your computer and use it in GitHub Desktop.
var blessed = require('blessed');
var screen = blessed.screen();
var box = blessed.box({
bottom: 0,
left: 'center',
height: 5,
width: '100%',
content: 'Hello {bold}world{/bold}',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'green',
bg: 'black',
border: {
fg: '#cccccc'
},
}
});
screen.append(box);
form = blessed.Form({
});
box.append(form);
var text = blessed.Textbox({
name: 'input',
inputOnFocus: true,
keys: true,
// vi: true,
border: {
type: 'line'
}
});
box.append(text);
//text.key('enter', function (ch, key) {
// text.setContent(text.getValue() + ' SENT');
// screen.render();
// text.focus()
//});
text.on('sumbit', function () {
text.setContent('winning');
});
text.key('enter', function(ch, key) {
form.submit();
});
screen.key(['q', 'escape'], function (ch, key) {
return process.exit(0);
});
text.focus();
screen.render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment