(text: string, columns: number)
| 1418 | * Clears all lines taken up by the specified `text`. |
| 1419 | */ |
| 1420 | const eraseText = (text: string, columns: number): string => { |
| 1421 | if (columns === 0) { |
| 1422 | return Ansi.eraseLine + Ansi.cursorTo(0) |
| 1423 | } |
| 1424 | let rows = 0 |
| 1425 | const lines = text.split(NEWLINE_REGEXP) |
| 1426 | for (const line of lines) { |
| 1427 | rows += 1 + Math.floor(Math.max(line.length - 1, 0) / columns) |
| 1428 | } |
| 1429 | return Ansi.eraseLines(rows) |
| 1430 | } |
| 1431 | |
| 1432 | const lines = (prompt: string, columns: number): number => { |
| 1433 | const lines = prompt.split(NEWLINE_REGEXP) |
no test coverage detected