bug: ensure avg cpu is drawn on top in "All" mode (#1859)

* bug: ensure avg cpu is drawn on top

* changelog
This commit is contained in:
Clement Tsang 2025-11-11 05:47:09 -05:00 committed by GitHub
parent f5f157707c
commit 0735276122
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -24,6 +24,16 @@ That said, these are more guidelines rather than hardset rules, though the proje
### Features
### Bug Fixes
- [#1859](https://github.com/ClementTsang/bottom/pull/1859): Ensure average CPU is drawn on top in "All" mode.
### Other
## [0.11.3] - 2025-11-06
### Features
- [#1812](https://github.com/ClementTsang/bottom/pull/1812): Add `free_arc` option to subtract ARC from total memory usage.
### Bug Fixes

View File

@ -132,10 +132,8 @@ impl Painter {
.iter()
.enumerate()
.map(|(itx, values)| {
let style = if show_avg_cpu && itx == AVG_POSITION {
let style = if show_avg_cpu && itx == 0 {
self.styles.avg_cpu_colour
} else if itx == ALL_POSITION {
self.styles.all_cpu_colour
} else {
self.styles.cpu_colour_styles
[(itx - show_avg_offset) % self.styles.cpu_colour_styles.len()]
@ -147,6 +145,7 @@ impl Painter {
.collect()
} else if let Some(CpuData { .. }) = cpu_entries.get(current_scroll_position - 1) {
// We generally subtract one from current scroll position because of the all entry.
// TODO: Do this a bit better (e.g. we can just do if let Some(_) = cpu_points.get())
let style = if show_avg_cpu && current_scroll_position == AVG_POSITION {
self.styles.avg_cpu_colour