diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-13 23:39:02 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-13 23:39:02 +0200 |
| commit | c37cb5350b60e1ee9d8c7b9f1a661d35d02a3bda (patch) | |
| tree | 75bc228e72b8180556ffce7e21aea06649757fa7 | |
| parent | f7e03c864addd6c46f49558275cbb2e7050783d6 (diff) | |
Remove 1px gaps between bars to fix vertical line artifacts
- barWidth = winW/numBars (no -1), advance x by barW only
- Eliminates uncleared 1px columns that showed as vertical lines
Co-authored-by: Cursor <cursoragent@cursor.com>
| -rw-r--r-- | internal/display/display.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/display/display.go b/internal/display/display.go index 33120dc..a4fcc3c 100644 --- a/internal/display/display.go +++ b/internal/display/display.go @@ -201,7 +201,7 @@ func Run(ctx context.Context, cfg *config.Config, src stats.Source) error { numBars = 1 } - barWidth := (winW / int32(numBars)) - 1 + barWidth := winW / int32(numBars) if barWidth < 1 { barWidth = 1 } @@ -367,7 +367,7 @@ func normalizePcts9(s *[9]float64) { // drawCPUBarFromPcts draws one CPU bar from 9 smoothed segment percentages. If s is nil, advances x only. // When extended is true and peakPct > 0, draws a 1px peak line (max system+user over history). func drawCPUBarFromPcts(renderer *sdl.Renderer, s *[9]float64, barW int32, x *int32, winH int32, extended bool, peakPct float64) { - defer func() { *x += barW + 1 }() + defer func() { *x += barW }() // Clear this slot so we never leave previous (e.g. mem/net) content visible renderer.SetDrawColor(constants.Black.R, constants.Black.G, constants.Black.B, 255) renderer.FillRect(&sdl.Rect{X: *x, Y: 0, W: barW, H: winH}) @@ -416,7 +416,7 @@ func drawCPUBarFromPcts(renderer *sdl.Renderer, s *[9]float64, barW int32, x *in // drawMemBarSmoothed blends mem stats toward target and draws one memory bar (RAM left, Swap right). func drawMemBarSmoothed(renderer *sdl.Renderer, h *stats.HostStats, smoothed *struct{ ramUsed, swapUsed float64 }, factor float64, barW int32, x *int32, winH int32) { - defer func() { *x += barW + 1 }() + defer func() { *x += barW }() // Clear this slot so we never leave previous (e.g. CPU/net) content visible renderer.SetDrawColor(constants.Black.R, constants.Black.G, constants.Black.B, 255) renderer.FillRect(&sdl.Rect{X: *x, Y: 0, W: barW, H: winH}) @@ -554,7 +554,7 @@ func chooseNetIface(h *stats.HostStats, cfg *config.Config, host string, netIntI } func drawNetBarSmoothed(renderer *sdl.Renderer, h *stats.HostStats, cfg *config.Config, smoothed *struct{ rxPct, txPct float64 }, prev stats.NetStamp, netIntIndex map[string]int, host string, factor float64, barW int32, x *int32, winH int32) stats.NetStamp { - defer func() { *x += barW + 1 }() + defer func() { *x += barW }() // Clear this slot so we never leave previous (e.g. CPU/mem) content visible renderer.SetDrawColor(constants.Black.R, constants.Black.G, constants.Black.B, 255) renderer.FillRect(&sdl.Rect{X: *x, Y: 0, W: barW, H: winH}) |
