Created
June 17, 2014 06:26
-
-
Save t3h2mas/38a08101114ef7095e0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var blessed = require('blessed'); | |
var screen = blessed.screen(); | |
var box = blessed.box({ | |
bottom: 0, | |
left: 'center', | |
height: 3, | |
width: '100%', | |
tags: true, | |
}); | |
var bufferBox = blessed.box({ | |
top: 0, | |
width: '100%', | |
height: '93%' | |
}); | |
screen.append(bufferBox); | |
screen.append(box); | |
form = blessed.Form({ | |
}); | |
box.append(form); | |
var buffer = blessed.Textbox({ | |
border: { | |
type: 'line' | |
} | |
}); | |
bufferBox.append(buffer); | |
var text = blessed.Textbox({ | |
name: 'input', | |
inputOnFocus: true, | |
keys: true, | |
border: { | |
type: 'line' | |
} | |
}); | |
box.append(text); | |
text.key('enter', function (ch, key) { | |
// do work with text.getValue() | |
msg = buffer.getValue() + text.getValue() | |
buffer.setValue(msg); | |
text.clearValue() | |
text.focus() | |
screen.render(); | |
}); | |
screen.key(['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