diff options
author | Florrie <towerofnix@gmail.com> | 2018-06-02 23:28:57 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-06-02 23:28:57 -0300 |
commit | 60131bd74b505803bba2db7bef78d9945d4087bd (patch) | |
tree | 790cf22c54ed02f03a426223c58aa4718a067610 /index.js | |
parent | 662ab7324567e093ff432991cefbd3293a68cea6 (diff) |
Terminal resize detection
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/index.js b/index.js index ca62f17..b46edb6 100644 --- a/index.js +++ b/index.js @@ -23,8 +23,7 @@ async function main() { const size = await interfacer.getScreenSize() const flushable = new Flushable(process.stdout, true) - flushable.screenLines = size.lines - flushable.screenCols = size.cols + flushable.resizeScreen(size) flushable.shouldShowCompressionStatistics = process.argv.includes('--show-ansi-stats') flushable.write(ansi.clearScreen()) flushable.flush() @@ -33,6 +32,13 @@ async function main() { root.w = size.width root.h = size.height + interfacer.on('resize', newSize => { + root.w = newSize.width + root.h = newSize.height + flushable.resizeScreen(newSize) + root.fixAllLayout() + }) + const appElement = new AppElement() root.addChild(appElement) root.select(appElement) |