change: remove gap between CPU and columns in basic (#460)
Removes the gap between the CPU section and other columns in basic mode.
This commit is contained in:
parent
d4a18aea75
commit
f98fa4a5f4
|
@ -189,6 +189,7 @@ pub async fn get_cpu_data_list(
|
|||
})
|
||||
}
|
||||
|
||||
// Ok(Vec::from(cpu_deque.drain(0..5).collect::<Vec<_>>()))
|
||||
// Ok(Vec::from(cpu_deque.drain(0..3).collect::<Vec<_>>())) // For artificially limiting the CPU results
|
||||
|
||||
Ok(Vec::from(cpu_deque))
|
||||
}
|
||||
|
|
|
@ -536,15 +536,24 @@ impl Painter {
|
|||
}
|
||||
|
||||
let actual_cpu_data_len = app_state.canvas_data.cpu_data.len().saturating_sub(1);
|
||||
let cpu_height = (actual_cpu_data_len / 4) as u16
|
||||
+ (if actual_cpu_data_len % 4 == 0 { 0 } else { 1 });
|
||||
|
||||
// This fixes #397, apparently if the height is 1, it can't render the CPU bars...
|
||||
let cpu_height = {
|
||||
let c = (actual_cpu_data_len / 4) as u16
|
||||
+ (if actual_cpu_data_len % 4 == 0 { 0 } else { 1 });
|
||||
|
||||
if c <= 1 {
|
||||
1
|
||||
} else {
|
||||
c
|
||||
}
|
||||
};
|
||||
|
||||
let vertical_chunks = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.margin(0)
|
||||
.constraints([
|
||||
Constraint::Length(cpu_height + if cpu_height <= 1 { 1 } else { 0 }), // This fixes #397, apparently if the height is 1, it can't render the CPU bars...
|
||||
Constraint::Length(if cpu_height <= 1 { 0 } else { 1 }),
|
||||
Constraint::Length(cpu_height),
|
||||
Constraint::Length(2),
|
||||
Constraint::Length(2),
|
||||
Constraint::Min(5),
|
||||
|
@ -554,7 +563,7 @@ impl Painter {
|
|||
let middle_chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
|
||||
.split(vertical_chunks[2]);
|
||||
.split(vertical_chunks[1]);
|
||||
self.draw_basic_cpu(&mut f, app_state, vertical_chunks[0], 1);
|
||||
self.draw_basic_memory(&mut f, app_state, middle_chunks[0], 2);
|
||||
self.draw_basic_network(&mut f, app_state, middle_chunks[1], 3);
|
||||
|
@ -567,7 +576,7 @@ impl Painter {
|
|||
Disk => self.draw_disk_table(
|
||||
&mut f,
|
||||
app_state,
|
||||
vertical_chunks[4],
|
||||
vertical_chunks[3],
|
||||
false,
|
||||
widget_id,
|
||||
),
|
||||
|
@ -581,7 +590,7 @@ impl Painter {
|
|||
self.draw_process_features(
|
||||
&mut f,
|
||||
app_state,
|
||||
vertical_chunks[4],
|
||||
vertical_chunks[3],
|
||||
false,
|
||||
wid,
|
||||
);
|
||||
|
@ -589,14 +598,14 @@ impl Painter {
|
|||
Temp => self.draw_temp_table(
|
||||
&mut f,
|
||||
app_state,
|
||||
vertical_chunks[4],
|
||||
vertical_chunks[3],
|
||||
false,
|
||||
widget_id,
|
||||
),
|
||||
Battery => self.draw_battery_display(
|
||||
&mut f,
|
||||
app_state,
|
||||
vertical_chunks[4],
|
||||
vertical_chunks[3],
|
||||
false,
|
||||
widget_id,
|
||||
),
|
||||
|
@ -605,7 +614,7 @@ impl Painter {
|
|||
}
|
||||
|
||||
if let Some(widget_id) = later_widget_id {
|
||||
self.draw_basic_table_arrows(&mut f, app_state, vertical_chunks[3], widget_id);
|
||||
self.draw_basic_table_arrows(&mut f, app_state, vertical_chunks[2], widget_id);
|
||||
}
|
||||
} else {
|
||||
// Draws using the passed in (or default) layout.
|
||||
|
|
Loading…
Reference in New Issue