New Progress Bars
This implements a new progress bar, drawing on our work in #196 and your other more recent version (ecb590e). It uses the draw algorithm from the former, and the updated styling, matcher regexp, faces, etc. from the latter. It is a simple, fast, pixel-perfect progress bar, with a fixed overall bar width. It uses specified space (on the `[` and `]` chars) and the bare minimum of allocations from replacing string displays:
- zero, if the completion bar is empty, full, or falls adjacent to or inside the stats text, as occurs in more than 50% of the cases;
- one, otherwise
The stats text can be edited, visited with point, copied, etc.
I also added a parent face `org-modern-progress`. This is needed because it is important for all face settings that alter font (`:height`, `:weight`, etc.) to be set _consistently_ across both `complete` and `incomplete`. I made that parent face inherit from `fixed-pitch` (also important for consistent bar width). I also made it bold and reduced the height, and slightly lightened the incomplete face to avoid conflicts with somewhat less dark theme backgrounds. Here's how it looks:
<img width="233" alt="image" src="https://github.com/minad/org-modern/assets/93749/79a403f9-e911-42bb-84f3-226831e36f6f">
The one price for a pixel-perfect completion bar is that the start of the stats text moves slowly by <1 char width, but i) the numbers themselves will move too as they change size (`9` -> `10`), and ii) bars are usually not lined up on top of each other so alignment isn't a top concern.
Another PR can consider overall alignment of progress bars and tags within the window. Let me know if you are still encountering any bar movement on item checkoff.
合并状态:未合并 关闭于 2024-05-15 13 条评论