If cli-width returns 0, which is possible in certain environments, Inquirer will crash on line 108 of lib/utils/screen-manager.js:
var regex = new RegExp('.{1,' + cliWidth() + '}', 'g');
/.{1,0}/g is an invalid regex as the max number of characters is smaller than the minimum. This throws an error:
SyntaxError: Invalid regular expression: /.{1,0}/: numbers out of order in {} quantifier.
The cli-width package supports setting the default width to a number other than 0 by setting the value of cliWidth.defaultWidth. It seems reasonable to have a default of 80 instead of 0.
:+1: got this bug on WIndows.
@SBoudrias is there any news about this bug?
@artem-malko Feel free to send a PR.
Just encountered this one too when users of my app were attempting to execute a script in the Intellij shell.
I've sent a PR for setting the default value to 80. I've experimented with it in a Windows 10 PC and seems to be working fine.
Omitting tests since screen-manager.js it not being unit tested at all.
A temporary fix is setting an environment variable named CLI_WIDTH to anything greater than 1.
Most helpful comment
:+1: got this bug on WIndows.