ui: styled-output-line mechanism (ADR-0028 step 1)

OutputLine gains an optional styled-runs payload — a
Vec<OutputSpan> of { byte_range, OutputStyleClass } over the
line text. render_output_line gains a branch: when the payload
is present it renders the text span-by-span, each run's
semantic class (Neutral / Efficient / Expensive /
AutomaticIndex) resolved to a theme colour at render time;
otherwise the existing whole-line kind styling. The echo path
is untouched.

Theme gains `plan_efficient` — a green deliberately distinct
from `system` so green never reads as two things (ADR-0028 §6);
`warning` is reused for expensive steps.

A general per-span output-styling capability (ADR-0016's OOS-3
realized); the query-plan renderer will be its first consumer.
No user-visible change on its own. 1133 passing, clippy clean.
This commit is contained in:
claude@clouddev1
2026-05-19 10:45:43 +00:00
parent a1e4932858
commit 03d8a09457
3 changed files with 152 additions and 3 deletions
+9 -1
View File
@@ -40,8 +40,14 @@ pub struct Theme {
pub error: Color,
/// Validity-indicator WARNING colour (ADR-0027 §4) — an
/// amber distinct from `error`'s red. Drives the `[WRN]`
/// label; `[ERR]` reuses `error`.
/// label; `[ERR]` reuses `error`. Also the query-plan
/// "expensive step" colour (ADR-0028 §6).
pub warning: Color,
/// Query-plan "efficient step" colour (ADR-0028 §6) — a
/// green deliberately distinct from `system` so green never
/// reads as two things. Indexed lookups carry it; expensive
/// steps reuse `warning`.
pub plan_efficient: Color,
// ---- Per-token-class colours (ADR-0022 §3) -------------------
pub tok_keyword: Color,
pub tok_identifier: Color,
@@ -67,6 +73,7 @@ impl Theme {
system: Color::Rgb(0x9F, 0xD8, 0x91),
error: Color::Rgb(0xFF, 0x6B, 0x6B),
warning: Color::Rgb(0xF5, 0xA9, 0x4B), // amber
plan_efficient: Color::Rgb(0x4D, 0xD0, 0xA8), // teal-green
// Token classes — distinct enough to tell apart at a
// glance, quiet enough that 80-char lines don't read
@@ -99,6 +106,7 @@ impl Theme {
system: Color::Rgb(0x2E, 0x7C, 0x3C),
error: Color::Rgb(0xC0, 0x39, 0x2B),
warning: Color::Rgb(0xA6, 0x5A, 0x00), // burnt amber
plan_efficient: Color::Rgb(0x0B, 0x80, 0x6A), // deep teal-green
// Light-theme token palette: same intent as dark —
// identifier/punct close to fg/muted; warm tones for