From 8abc0ec1137dffc2b7d234af6ca02d2f280b0236 Mon Sep 17 00:00:00 2001 From: DanS Date: Wed, 1 Jul 2026 16:43:34 -0500 Subject: [PATCH] feat(console): JSON indent guides on result lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Draw faint vertical guides per 2-space nesting level on result (non-channel) lines, so nested RPC JSON is easier to read. Draw-only in the per-line loop (like the channel bar), so it doesn't touch the text layout or selection. Note: collapsible JSON nodes were intentionally deferred — folding entangles with the wrap cache / filter / selection line indices and warrants a runtime-verified pass. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/ui/windows/console_tab.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ui/windows/console_tab.cpp b/src/ui/windows/console_tab.cpp index c1a3114..d570099 100644 --- a/src/ui/windows/console_tab.cpp +++ b/src/ui/windows/console_tab.cpp @@ -831,6 +831,21 @@ void ConsoleTab::renderOutput() } } + // JSON indent guides — faint vertical lines per 2-space nesting level, on result + // (non-channel) lines only. Draw-only, like the channel bar. + if (line.channel == CH_NONE) { + size_t leading = 0; + while (leading < line.text.size() && line.text[leading] == ' ') ++leading; + if (leading >= 2) { + float spaceW = font->CalcTextSizeA(fontSize, FLT_MAX, 0.0f, " ").x; + for (size_t c = 2; c < leading; c += 2) { + float gx = lineOrigin.x + static_cast(c) * spaceW; + dl->AddLine(ImVec2(gx, lineOrigin.y), ImVec2(gx, lineOrigin.y + totalH), + IM_COL32(255, 255, 255, 20), 1.0f); + } + } + } + // Determine byte-level selection range for this line int selByteStart = 0, selByteEnd = 0; bool lineSelected = false;