mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-25 06:35:07 +02:00
bug: fix incorrect offset for cpu list in cpu basic widget (#289)
Fixes the CPU basic widget showing incorrect data due to an incorrect offset when displaying the data.
This commit is contained in:
parent
5df1764e90
commit
3d9c6b757f
@ -46,6 +46,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- [#262](https://github.com/ClementTsang/bottom/pull/262): Fixed missing thread termination steps as well as improper polling causing blocking in input thread.
|
||||
|
||||
- [#289](https://github.com/ClementTsang/bottom/pull/289): Fixed the CPU basic widget showing incorrect data due to an incorrect offset when displaying the data.
|
||||
|
||||
- [#290](https://github.com/ClementTsang/bottom/pull/290): Fixed an incorrect offset affecting the CPU colour when scrolling.
|
||||
|
||||
## [0.4.7] - 2020-08-26
|
||||
|
||||
### Bug Fixes
|
||||
|
@ -25,7 +25,9 @@ impl CpuBasicWidget for Painter {
|
||||
fn draw_basic_cpu<B: Backend>(
|
||||
&self, f: &mut Frame<'_, B>, app_state: &mut App, draw_loc: Rect, widget_id: u64,
|
||||
) {
|
||||
let cpu_data: &[ConvertedCpuData] = &app_state.canvas_data.cpu_data;
|
||||
// Skip the first element, it's the "all" element
|
||||
if !app_state.canvas_data.cpu_data.is_empty() {
|
||||
let cpu_data: &[ConvertedCpuData] = &app_state.canvas_data.cpu_data[1..];
|
||||
|
||||
// This is a bit complicated, but basically, we want to draw SOME number
|
||||
// of columns to draw all CPUs. Ideally, as well, we want to not have
|
||||
@ -47,6 +49,7 @@ impl CpuBasicWidget for Painter {
|
||||
}
|
||||
|
||||
let num_cpus = cpu_data.len();
|
||||
|
||||
if draw_loc.height > 0 {
|
||||
let remaining_height = usize::from(draw_loc.height);
|
||||
const REQUIRED_COLUMNS: usize = 4;
|
||||
@ -132,6 +135,7 @@ impl CpuBasicWidget for Painter {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if app_state.should_get_widget_bounds() {
|
||||
// Update draw loc in widget map
|
||||
|
Loading…
x
Reference in New Issue
Block a user