Skip to content

Instantly share code, notes, and snippets.

@cblgh
Created July 4, 2018 19:26
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 cblgh/0818e31b633b8ae82ca20ebc08bb9456 to your computer and use it in GitHub Desktop.
Save cblgh/0818e31b633b8ae82ca20ebc08bb9456 to your computer and use it in GitHub Desktop.
testing neat-log's re-rendering on resize
var neatLog = require('..')
var output = require("diffy/trim")
var log = neatLog(headerView, {fullscreen: true})
log.render() // force an immediate render
function headerView (state) {
return output(`
Hello World!
rows ${process.stdout.rows}
columns ${process.stdout.columns}
${Array(process.stdout.rows - 4).fill("#").join("\n")}
`)
}
@cblgh
Copy link
Author

cblgh commented Jul 4, 2018

or even simpler:

var neatLog = require('..')
var output = require("diffy/trim")

var log = neatLog(headerView, {fullscreen:  true})
log.render() // force an immediate render

function headerView (state) {
  return output(`
    Hello World!
    rows ${process.stdout.rows}
    columns ${process.stdout.columns}
    #
    #
    #
    #
    #
    #
    #
    #
    #
    #
  `)
}

try resizing past a certain height and it breaks rerendering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment