We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When input unicode characters,the number of input line is not correct. see screenshot below for more details.
Please use [email protected] to strip characters instead of the simple strip function in the source code below to compute the width of characters
[email protected]
The path of source code below is lib/util/strip.js
lib/util/strip.js
'use strict'; module.exports = str => { const pattern = [ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' ].join('|'); const RGX = new RegExp(pattern, 'g'); return typeof str === 'string' ? str.replace(RGX, '') : str; };
The changes maybe like this
The path of source code below is lib/util/clear.js
lib/util/clear.js
'use strict'; //const strip = require('./strip'); const { erase, cursor } = require('sisteransi'); const stringWidth = require('string-width'); //const width = str => [...strip(str)].length; /** * @param {string} prompt * @param {number} perLine */ module.exports = function(prompt, perLine) { if (!perLine) return erase.line + cursor.to(0); let rows = 0; const lines = prompt.split(/\r?\n/); for (let line of lines) { rows += 1 + Math.floor(Math.max(stringWidth(line) - 1, 0) / perLine); } return erase.lines(rows); };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When input unicode characters,the number of input line is not correct. see screenshot below for more details.
Please use
[email protected]
to strip characters instead of the simple strip function in the source code below to compute the width of charactersThe path of source code below is
lib/util/strip.js
The changes maybe like this
The path of source code below is
lib/util/clear.js
The text was updated successfully, but these errors were encountered: