summaryrefslogtreecommitdiff
path: root/internal/display/display_test.go
AgeCommit message (Collapse)Author
2026-03-02Refactor display iteration/state and harden collector runtimePaul Buetow
2026-02-18fix: make disk bars visible when idle, filter zram devices, add rendering testPaul Buetow
- Draw dim purple background (#180028) instead of black so disk bar slots are visible even when the disk is idle - First sample no longer returns early; records baseline and still draws the bar background - Filter out zram devices from whole-disk detection - Add TestDiskBar_Rendering: end-to-end pixel test verifying purple bars appear after two disk data samples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18feat: add disk I/O stats (read/write throughput bars, hotkey 5, auto-scale)Paul Buetow
Add a new disk stats category that reads /proc/diskstats, shows read/write throughput as colored bars (purple/darker purple like network RX/TX), with optional utilization % overlay in extended mode. Hotkey 5 cycles: aggregate (sum all whole-disk devices) → per-device → off. Auto-scale with decay and optional fixed override via --diskmax / diskmax config key. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18refactor: enforce Go best practices (function size, ordering, formatting)Paul Buetow
- config: split set() (62L) into setSizeAndTuning() + setDisplayFlags() - collector: split Run() (70L) into Run + startLocalScanner + startRemoteScanner + parseCollectorStream + dispatchCollectorLine; each <30L - collector: remove unused script_embed.go (RemoteScript was dead code) - display: move newRunState constructor before Run() per constructor-first rule - display: replace loadPeak IIFE with a plain initLoadPeak variable - display: split handleKey() (114L) into handleToggleKeys + handleAdjustAndSave + handleResizeKeys; add nil guard in handleResizeKeys for test safety - display: split drawNetBarSmoothed() (75L) into drawNetBarSmoothed + smoothNetUtilization + drawNetHalves; each <30L - all: gofmt -w to fix formatting drift in display and config files All tests pass (go test ./...). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18feat: add load average bar visualization (4/l hotkey)0.12.0Paul Buetow
Adds a new teal bar type showing /proc/loadavg data per host. The 1-min average fills from the top downward; yellow and white 1px reference lines mark the 5-min and 15-min averages. A global loadPeak tracker (floor 2.0, slow per-frame decay) keeps the scale meaningful across hosts and after spikes. Toggle with 4 or l; persisted to ~/.loadbarsrc as showload=1. Bump version to 0.12.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18feat: triple-toggle CPU display mode via 1 key; add tooltip, font, hit-testPaul Buetow
CPU display now cycles through three states with each press of 1: 0 = CPUModeAverage – aggregate bar only (default) 1 = CPUModeCores – individual core bars + aggregate 2 = CPUModeOff – all CPU bars hidden Config file stores cpumode=N (integer); old showcores=0/1 is read for backward compatibility. CLI flag --showcores replaced by --cpumode. Other improvements landed in this commit: - internal/display: add font.go (text rendering), hittest.go (bar hit testing), tooltip.go (mouse-over tooltip), tooltip_test.go - internal/display: mouse tracking and drawOverlay hook in display.go - internal/display: update build tags to //go:build form - internal/collector: embed remote script via script_embed.go / scriptdata/loadbars-remote.sh - internal/collector: CPULine.Total() changed to value receiver - internal/collector: table test improvements (name field, t.Run) - internal/constants: BytesPerSec consts promoted from var to const - Magefile.go: fix error formatting and install path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-17Bump version to 0.11.0, change separator color to red0.11.0Paul Buetow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17Add multi-row bar layout with maxbarsperrow config optionPaul Buetow
When monitoring many servers, bars can become too thin to read. The new maxbarsperrow setting (default 0 = unlimited) wraps bars into multiple rows of equal height when the count exceeds the limit. The last row may have fewer, wider bars filling the full window width. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16Add toggleable host separator lines (hotkey s)Paul Buetow
Draw 1px yellow vertical lines between hosts when monitoring multiple servers, making it easy to see where one host's bars end and the next begins. Toggled with hotkey 's', persisted via 'w' to ~/.loadbarsrc. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16Add global I/O avg line (hotkey i) and m/n hotkey aliasesPaul Buetow
Add a pink 1px line drawn from the top showing mean iowait+IRQ+softIRQ across all hosts, toggled with hotkey i and persistable to ~/.loadbarsrc. Also add m as alias for 2 (memory toggle) and n as alias for 3 (network toggle) for easier single-hand operation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16Add global average CPU line toggled with hotkey gv0.10.0Paul Buetow
Draw a 1px red horizontal line spanning the full window width showing the mean CPU usage across all monitored hosts. Toggled with 'g' hotkey and persistable to ~/.loadbarsrc via 'w'. Bump version to 0.10.0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16Fix multi-core display bug: distribute remainder pixels evenlyv0.9.1Paul Buetow
Fixes issue where integer division (winW / numBars) left unused pixels on the right side of the window. The more cores displayed, the more obvious the gap became. Changes: - Add barBounds() helper to calculate exact position and width for each bar - Distribute remainder pixels evenly using scaled division - Update drawing functions to use pre-calculated positions - Update test to verify bars now fill entire window width Increment version to 0.9.1 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14Aggregate all net interfaces, remove n hotkey, fix net bar decay bugv0.9.0Paul Buetow
Sum RX/TX across all non-lo interfaces instead of picking a single one. Remove the n hotkey (cycle interface), netint config field, and --netint flag since they are no longer needed. Fix pre-existing bug where net bars decayed to zero between collector updates (~19 of 20 frames had target=0, making bars invisible even during heavy downloads). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14Implement f/v hotkeys for link scale and add hotkey unit testsPaul Buetow
Add missing f/v hotkey handlers to cycle NetLink through mbit/10mbit/100mbit/gbit/10gbit, closing the gap between README documentation and actual implementation. Add 13 unit tests covering all hotkey behaviors including visual pixel assertions for toggles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14Fix stale pixels at right edge when toggling bar layoutv0.8.3Paul Buetow
drawFrame() only cleared the window on layout changes, leaving remainder pixels (from integer division winW/numBars) with stale content from the double-buffered back buffer. Now clears every frame per SDL2 best practice. Adds comprehensive SDL visual test harness using software renderer with pixel spot-checking for CPU, memory, network bars, and the remainder bug. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>