MCPcopy Create free account
hub / github.com/antirez/ds4 / main

Function main

ds4_agent.c:10215–10243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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. */
10228static 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

Callers

nothing calls this directly

Calls 7

ds4_engine_openFunction · 0.85
run_agentFunction · 0.85
ds4_engine_closeFunction · 0.85
parse_optionsFunction · 0.70
log_context_memoryFunction · 0.70
sigactionClass · 0.70

Tested by

no test coverage detected