Skip to content

fix(ui): remove margin from progress bar grids to use full terminal width#6

Merged
narthur merged 6 commits into
mainfrom
copilot/fix-progress-bar-widths
Feb 6, 2026
Merged

fix(ui): remove margin from progress bar grids to use full terminal width#6
narthur merged 6 commits into
mainfrom
copilot/fix-progress-bar-widths

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 6, 2026

Fix progress bar widths to use full terminal width

  • Explore repository structure and understand the issue
  • Identify the root cause (margin calculation)
  • Update main stats grid width calculation (line 160)
  • Update CPU cores grid width calculation (line 199)
  • Add tests to validate width calculations
  • Verify all tests pass
  • Test the changes manually with visual verification
  • Address code review feedback (remove trailing whitespace)
  • Update .gitignore to exclude build binaries
  • Run security checks (CodeQL - no alerts found)
  • Final verification (all tests pass, build successful)
  • Refactor tests to use actual View() rendering instead of duplicating logic
  • Clarify test naming and error messages

Summary

Problem: Progress bars for CPU/Memory and GPU stats weren't using the full terminal width, leaving empty space on the right side of both grids, while the process list was using full width.

Root Cause: The width calculation used m.width - 2 (leaving a 2-character margin) instead of m.width.

Solution: Changed two lines in main.go:

  • Line 160: availableWidth := m.width - 2availableWidth := m.width
  • Line 199: availableWidth = m.width - 2availableWidth = m.width

Impact:

  • Main stats grid now uses full terminal width (gains 2 characters)
  • CPU cores grid now uses full terminal width (gains up to 2 characters)
  • All UI elements are now visually consistent

Testing:

  • Refactored tests to use actual View() rendering for validation
  • Added helper function to strip ANSI codes for accurate width measurement
  • Improved test naming and error messages for clarity
  • All existing and new tests pass
  • Manual testing confirmed correct behavior
  • No security vulnerabilities detected (CodeQL scan)
Original prompt

Currently the "progress bar" widths aren't ideal.

Example:

CPU Usage                   91.2%  GPU Usage                      2%
Memory                      70.6%  GPU Memory                   9.8%

CPU00     71.0%  CPU01     94.9%  CPU02     87.3%  CPU03     69.6%
CPU04     86.9%  CPU05    100.0%  CPU06     75.3%  CPU07    100.0%
CPU08     98.0%  CPU09     95.0%  CPU10     96.9%  CPU11     86.3%
CPU12    100.0%  CPU13     99.0%  CPU14     99.0%  CPU15    100.0%

PID          CPU%   MEM%  COMMAND
1698673    1326.9    0.1  ...es/app/node_modules/@vscode/ripgrep/bin/rg
1697839      22.4   18.7  /usr/share/cursor/cursor
1783609      16.3    0.8  ...arthur/.local/share/claude/versions/2.1.34
1686831       7.7    0.9  ...arthur/.local/share/claude/versions/2.1.34

The process lines use the full terminal width. But the progress bar grids don't. There is empty space at the far right of both grids.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 6, 2026 16:02
Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix widths of progress bar grids for better display fix(ui): remove margin from progress bar grids to use full terminal width Feb 6, 2026
Copilot AI requested a review from narthur February 6, 2026 16:07
@narthur narthur marked this pull request as ready for review February 6, 2026 16:37
Copilot AI review requested due to automatic review settings February 6, 2026 16:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a visual inconsistency where progress bar grids (CPU/Memory stats and CPU cores) had a 2-character right margin while the process list used the full terminal width. The fix removes this margin to make all UI elements consistent.

Changes:

  • Remove 2-character margin from main stats grid and CPU cores grid width calculations
  • Add tests validating width calculations across different terminal sizes
  • Add sysmon-* pattern to .gitignore to exclude versioned binaries

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
main.go Remove 2-character margin from availableWidth calculations for both main stats and CPU cores grids (lines 160, 199)
main_test.go Add TestProgressBarWidths to validate width math and TestViewRendersCorrectly to verify basic view rendering
.gitignore Add pattern to ignore versioned binaries like sysmon-v1.0.0

Comment thread main_test.go
Comment thread main_test.go Outdated
@narthur
Copy link
Copy Markdown
Contributor

narthur commented Feb 6, 2026

@copilot apply changes based on the comments in this thread

Copilot AI and others added 2 commits February 6, 2026 16:51
Replace duplicated width calculation logic with actual View() rendering.
This eliminates test maintenance burden and validates the real implementation
instead of duplicating the math.

Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
- Rename "narrow terminal" to "medium terminal" to match width of 100
- Clarify error message to explicitly state acceptable range [width-1, width]

Co-authored-by: narthur <4655422+narthur@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

Comment thread main_test.go
@narthur narthur merged commit a35fac3 into main Feb 6, 2026
7 checks passed
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.

3 participants