Hide the live prompt before model output is written. In scroll-region mode * the output cursor was saved before the prompt was drawn, so restoring it is * enough to append more model/tool bytes without touching the prompt rows. */
| 9179 | } else { |
| 9180 | snprintf(line, sizeof(line), |
| 9181 | "output_path=%s (%zu bytes, %d lines)\n", |
| 9182 | job->path[0] ? job->path : "<unavailable>", |
| 9183 | job->bytes, display_lines); |
| 9184 | agent_buf_puts(&out, line); |
| 9185 | snprintf(line, sizeof(line), "<head -%d %s>\n", |
| 9186 | AGENT_BASH_HEAD_LINES, job->path); |
| 9187 | agent_buf_puts(&out, line); |
| 9188 | agent_buf_puts(&out, head); |
| 9189 | if (head[0] && head[strlen(head) - 1] != '\n') agent_buf_puts(&out, "\n"); |
| 9190 | agent_buf_puts(&out, "</head>\n"); |
| 9191 | } |
| 9192 | free(head); |
| 9193 | } else { |
| 9194 | int tail_lines = job->running ? AGENT_BASH_PROGRESS_TAIL_LINES : |
| 9195 | AGENT_BASH_FINAL_TAIL_LINES; |
| 9196 | char *tail = agent_bash_read_tail_lines(job, tail_lines); |
| 9197 | snprintf(line, sizeof(line), |
| 9198 | "output_path=%s (%zu bytes, %d lines)\n", |
no test coverage detected