Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to 'block' characters for bar graph display #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lelandbatey
Copy link

This change modifies the characters used to display the "progressbars"
of the graph. Instead of being purely ascii characters such as #, |,
and ., it uses longer 'block elements' characters , , and ,
respectively. On terminals which support it, this makes for a much
improved visual display.

Here's an example of the bar-graph output with this change:

Device xxxxxxxx [192.168.100.212] (3/3):     
=========================================================     
Incoming (100% @ 256 MBit/s):     
     
                                   Cur: 594.95 kBit/s     
   ▗   ▗▗                          Avg: 7.75 MBit/s     
  ████████▟▟▟                      Min: 0.00 Bit/s     
 ▗████████████▟██                  Max: 147.28 MBit/s     
 █████████████████                 Ttl: 42.43 GByte     
Outgoing (100% @ 32 MBit/s):     
                                   Cur: 23.57 MBit/s     
                            ▗█▟▟▗▗ Avg: 748.59 kBit/s     
                            ██████ Min: 0.00 Bit/s     
                           ▗██████ Max: 25.71 MBit/s     
                 ▗▗        ███████ Ttl: 5.03 GByte     

This is accomplished by swapping the characters being printed, then by
changing the program/build system slightly so that it will link against
ncursesw (the version of ncurses which supports full-width characters
instead of only purely ascii).

Since this change would permanently shift this entire codebase so that
it uses ncursesw instead of "classic ncurses", and since it would
force the use of multiwidth 'block' characters which may not be
compatible with many of the original terminals where nload is used, I
don't recommend upstreaming this change to nload, at least not until
someone makes further changes which make this a toggle-able setting and
which maintains total backwards compatibility with systems where
ncursesw isn't available.

Until then, this change will exist as an option for those who want it
(like me), and as an example for the interested.

This change modifies the characters used to display the "progressbars"
of the graph. Instead of being purely ascii characters such as `#`, `|`,
and `.`, it uses longer 'block elements' characters `█`, `▟`, and `▗`,
respectively. On terminals which support it, this makes for a much
improved visual display.

This is accomplished by swapping the characters being printed, then by
changing the program/build system slightly so that it will link against
`ncursesw` (the version of ncurses which supports full-width characters
instead of only purely ascii).

Since this change would permanently shift this entire codebase so that
it uses ncursesw instead of "classic ncurses", and since it would
_force_ the use of multiwidth 'block' characters which may not be
compatible with many of the original terminals where nload is used, I
don't recommend upstreaming this change to nload, at least not until
someone makes further changes which make this a toggle-able setting and
which maintains total backwards compatibility with systems where
ncursesw isn't available.

Until then, this change will exist as an option for those who want it
(like me), and as an example for the interested.
@perguth
Copy link

perguth commented Apr 16, 2024

I would prefer the ASCII version.

Is the rendering shown correctly?
image

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.

None yet

2 participants