refactor(console): phase 5 — decompose renderOutput into focused sub-steps

renderOutput() was a ~410-line method doing filter-building, mouse/keyboard
interaction, the per-line draw loop, the new-output pill, and the right-click
context menu all inline. Split it into a thin orchestrator that calls five
single-purpose private methods (pure code motion, no behavior change):

  - computeVisibleLines()      -> the filter -> visible_indices_ + match count
  - handleOutputInteraction()  -> wheel-up, selection drag lifecycle, Ctrl+C/A
  - drawVisibleLines()         -> accent bars, JSON indent guides, selection +
                                  filter highlight, scanline capture, text
  - drawOutputContextMenu()    -> the right-click menu
  - drawNewOutputIndicator()   -> the jump-to-bottom pill

Ordering and every operation are preserved exactly (interaction still runs
after layout build and before the draw; selection bounds are recomputed post-
interaction; scanline_rows_ cleared before the draw pushes to it). Full-node +
lite build clean; ctest green; source hygiene clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-01 19:16:36 -05:00
parent 18c1de87db
commit 57291ef28c
2 changed files with 218 additions and 199 deletions

View File

@@ -101,9 +101,17 @@ private:
void addFormattedResult(const std::string& result, bool is_error);
void renderStatusHeader(ConsoleCommandExecutor& exec);
void renderToolbar(ConsoleCommandExecutor& exec);
void renderOutput();
void renderInput(ConsoleCommandExecutor& exec);
void renderCommandsPopup();
// renderOutput() orchestrates the scrollable output area; these are its sub-steps:
void renderOutput();
void computeVisibleLines(bool& hasTextFilter, std::string& filterLower); // -> visible_indices_
void handleOutputInteraction(ImVec2 mousePos, bool mouseInOutput); // wheel/selection/keys
void drawVisibleLines(float padX, float lineHeight, bool hasTextFilter,
const std::string& filterLower); // bars/guides/highlight/text
void drawNewOutputIndicator(); // jump-to-bottom pill
void drawOutputContextMenu(); // right-click menu
// Map a screen point to a raw {line, col} position via this frame's wrapped layout.
// (View-side because it needs layout_ + output_origin_; feeds the selection controller.)