| 3531 | } |
| 3532 | |
| 3533 | const renderTextError = ( |
| 3534 | nextState: TextState, |
| 3535 | pointer: string, |
| 3536 | renderOptions?: RenderOptions | undefined |
| 3537 | ): string => { |
| 3538 | if (Option.isSome(nextState.error)) { |
| 3539 | return Arr.match(nextState.error.value.split(NEWLINE_REGEXP), { |
| 3540 | onEmpty: () => "", |
| 3541 | onNonEmpty: (errorLines) => { |
| 3542 | if (renderOptions?.plain === true) { |
| 3543 | return `${pointer} ${errorLines.join("\n")}` |
| 3544 | } |
| 3545 | const prefix = Ansi.annotate(pointer, Ansi.red) + " " |
| 3546 | const lines = Arr.map(errorLines, (str) => annotateErrorLine(str)) |
| 3547 | return Ansi.cursorSavePosition + "\n" + prefix + lines.join("\n") + Ansi.cursorRestorePosition |
| 3548 | } |
| 3549 | }) |
| 3550 | } |
| 3551 | return "" |
| 3552 | } |
| 3553 | |
| 3554 | const renderTextOutput = ( |
| 3555 | nextState: TextState, |