* Writes a string to stdout, ensuring it starts on a new line. * If the previous output did not end with a newline, one will be added. * This prevents adding extra blank lines if a newline already exists. * @param str The string to write.
(str: string)
| 41 | * @param str The string to write. |
| 42 | */ |
| 43 | writeOnNewLine(str: string): void { |
| 44 | if (!this.atStartOfLine) { |
| 45 | this.write('\n'); |
| 46 | } |
| 47 | this.write(str); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Ensures that the output ends with a newline. If the last character |