| 10213 | editor_restore_output_cursor(ed); |
| 10214 | ed->hidden = true; |
| 10215 | return; |
| 10216 | } |
| 10217 | linenoiseHide(&ed->edit); |
| 10218 | if (ed->prompt_below_output) { |
| 10219 | editor_move_to_output_cursor(ed); |
| 10220 | ed->prompt_below_output = false; |
| 10221 | } |
| 10222 | ed->hidden = true; |
| 10223 | } |
| 10224 | |
| 10225 | /* Restore the live prompt after output. The primary path draws it in the |
| 10226 | * reserved bottom rows; the fallback path keeps the older one-row-below-output |
| 10227 | * trick for terminals where scroll regions are unavailable. */ |
| 10228 | static void editor_show(agent_editor *ed) { |
| 10229 | if (!ed->active || !ed->hidden) return; |
| 10230 | if (ed->scroll_region) { |
| 10231 | editor_save_output_cursor(ed); |
| 10232 | editor_move_to_prompt_row(ed); |
| 10233 | write_all(STDOUT_FILENO, "\x1b[0m", 4); |
| 10234 | linenoiseShow(&ed->edit); |
| 10235 | ed->hidden = false; |
| 10236 | return; |
| 10237 | } |
| 10238 | if (ed->output_line_open) { |
| 10239 | write_all(STDOUT_FILENO, "\r\n", 2); |
| 10240 | ed->prompt_below_output = true; |
| 10241 | } else { |
| 10242 | ed->prompt_below_output = false; |
| 10243 | } |
| 10244 | /* Model/tool output can leave SGR attributes active while it streams. |
| 10245 | * Redrawing linenoise always starts from normal attributes; tool rendering |
| 10246 | * re-emits its own color on the next streamed byte if it is still inside a |
nothing calls this directly
no test coverage detected