Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
var _ = require('lodash');
var util = require('./readline');
var cliWidth = require('cli-width');
var stripAnsi = require('strip-ansi');
// Prevent crashes on environments where the width can't be properly detected
cliWidth.defaultWidth = 80;
var ScreenManager = module.exports = function (rl) {
// These variables are keeping information to allow correct prompt re-rendering
this.height = 0;
this.extraLinesUnderPrompt = 0;
this.rl = rl;
};
ScreenManager.prototype.render = function (content, opt) {
opt = _.extend({ cursor: 0 }, opt || {});
var cursorPos = this.rl._getCursorPos();
this.rl.output.unmute();
this.clean(this.extraLinesUnderPrompt);