(text: string, columns: number)
| 1598 | * Clears all lines taken up by the specified `text`. |
| 1599 | */ |
| 1600 | const eraseText = (text: string, columns: number): string => { |
| 1601 | if (columns === 0) { |
| 1602 | return Ansi.eraseLine + Ansi.cursorTo(0) |
| 1603 | } |
| 1604 | let rows = 0 |
| 1605 | const lines = text.split(NEWLINE_REGEXP) |
| 1606 | for (const line of lines) { |
| 1607 | rows += 1 + Math.floor(Math.max(line.length - 1, 0) / columns) |
| 1608 | } |
| 1609 | return Ansi.eraseLines(rows) |
| 1610 | } |
| 1611 | |
| 1612 | const lines = (prompt: string, columns: number): number => { |
| 1613 | const lines = prompt.split(NEWLINE_REGEXP) |
no test coverage detected