kimtore / pms

Practical Music Search is an interactive Vim-like console client for the Music Player Daemon.
https://ambientsound.github.io/pms/
MIT License
249 stars 23 forks source link

Avoid trailing spaces in Topbar #124

Closed codesoap closed 4 years ago

codesoap commented 4 years ago

There were trailing spaces in the topbar, when the width of the terminal was not evenly dividable by the amount of pieces in a line of the topbar.

Example (one can see trailing whitespaces at the end of the first line): trailing_spaces

This fix was inspired by stackoverflow.com/questions/55465884. It works by giving the first pieces of the line one extra character of width, until the remainder xmax % pieces is "used up".

This is the result: fixed_topbar

Something like this may also be useful for the songlist, but it didn't seem like I the exact same solution would work there, at first glance. Thus I'll leave this task open for now.

codecov-io commented 4 years ago

Codecov Report

Merging #124 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #124   +/-   ##
=======================================
  Coverage   51.73%   51.73%           
=======================================
  Files          53       53           
  Lines        1900     1900           
=======================================
  Hits          983      983           
  Misses        891      891           
  Partials       26       26

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1ef37a8...d256d7f. Read the comment docs.

kimtore commented 4 years ago

Thanks for addressing this issue. I'm going to merge this, however it would be nice if the start positions were pre-calculated on window resize or topbar reconfiguration, so that it doesn't have to be done in the inner loop.