Skip to content

fix: keep Memory label visible above the memory graph - #5

Merged
rustfuture merged 2 commits into
mainfrom
fix/tui-memory-label
Sep 11, 2026
Merged

rustfuture merged 2 commits into
mainfrom
fix/tui-memory-label

Conversation

@rustfuture

Copy link
Copy Markdown
Owner

Problem

demos/verification_2026-09-11.md records that the Memory: ... label is drawn but never visible in the rendered TUI. Root cause in src/ui.rs: the label was drawn at mem_rect.y (line 160) and the memory graph's clear pass then rewrote every cell in mem_rect.y..mem_rect.y + mem_rect.height (lines 182-185), followed by draw_braille_line, which also rewrites every cell in the rect. The network label survives because it is drawn at net_rect.y - 1, outside its graph rect.

New behavior

  • The memory label is drawn one row above mem_rect, via a small testable helper DashboardLayout::memory_label_y() (src/rendering.rs). Layout rects, graph heights, y-scaling, and all other labels are unchanged.
  • New pure regression test tests/tui_memory_label.rs: for multiple terminal sizes it asserts memory_label_y() is outside the memory graph rectangle (clear/braille region) and below the CPU graph clear pass. It fails on the pre-fix value (memory label row 10 overlaps memory graph rows 10..14 at 60x20).
  • Network label semantics are untouched: Network I/O: RX .. KB TX .. KB (last interval) remains a per-interval byte delta, no KB/s.
  • New capture pair under demos/ (tui_capture_2026-09-11-memory.raw / .txt) plus build identity in demos/tui_capture_2026-09-11-memory.md. Older captures and READMEs are untouched.

Test commands and evidence

cargo fmt --check                                      PASS
cargo check --locked --all-targets                     PASS
cargo clippy --locked --all-targets -- -D warnings     PASS
cargo test --locked                                    PASS (45 lib + 2 bin + 13 integration + 1 new, 0 failed)
cargo bench --locked --no-run                          PASS

Real render under a pty (binary built from 42f4602, clean tree), rendered with pyte 0.8.2 at 110x50:

python3 -m venv /tmp/grainx-c-render-venv
/tmp/grainx-c-render-venv/bin/pip install pyte==0.8.2
/tmp/grainx-c-render-venv/bin/python demos/capture_tui.py \
  target/debug/grainx \
  demos/tui_capture_2026-09-11-memory.raw \
  demos/tui_capture_2026-09-11-memory.txt \
  5 110 50

Final frame now contains (row 18): Memory: 52.4% (12.6GB/24.0GB), and row 26 keeps
Network I/O: RX 14.0 KB TX 1.0 KB (last interval). Binary SHA-256
8572c7e189a5736733869c337482a6a348838c9148d44831ff1048f991f7bbcc, rustc 1.94.1.

Limits

  • Values are one host and one instant; the host snapshot contains real process names, PIDs, memory and disk labels (no credentials/paths/tokens; pattern scan clean).
  • The CPU Usage: label has the same pre-existing overlap with the CPU graph clear pass; out of scope for this fix and noted in the capture doc.
  • No change to data semantics or other UI sections; no README changes (owned by others).

rustfuture added 2 commits September 11, 2026 23:36
The memory label was drawn at mem_rect.y and then erased by the graph's
clear and braille passes, which rewrite every cell inside mem_rect. Draw
the label one row above the rect, matching the network label pattern, and
add a pure layout regression test.
@rustfuture
rustfuture merged commit 2067359 into main Sep 11, 2026
3 checks passed
@rustfuture
rustfuture deleted the fix/tui-memory-label branch September 11, 2026 20:46
Repository owner deleted a comment from coderabbitai Bot Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant