From 58b2bf8f742e4a69b7be1237eae41f4c5c998447 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 31 May 2013 21:44:43 -0500 Subject: [PATCH] example. resize. --- lib/high.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/high.js b/lib/high.js index 19214c2..7f68e97 100644 --- a/lib/high.js +++ b/lib/high.js @@ -7,6 +7,7 @@ API Example: This will render a box with ascii borders containing the text 'Hello world!', centered horizontally and vertically. + var blessed = require('blessed') , program = blessed() , screen; @@ -29,6 +30,12 @@ left: 'center' })); + program.on('keypress', function(ch, key) { + if (key.name === 'escape') { + process.exit(0); + } + }); + screen.render(); */ @@ -81,6 +88,13 @@ function Screen(options) { } this.lines[y].dirty = true; } + + var self = this; + this.program.on('resize', function() { + self.cols = program.cols; + self.rows = program.rows; + self.render(); + }); } Screen.prototype.__proto__ = Node.prototype;