feat(console): JSON indent guides on result lines

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) <noreply@anthropic.com>
This commit is contained in:
2026-07-01 16:43:34 -05:00
parent 5a677f6202
commit 8abc0ec113

View File

@@ -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<float>(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;