mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-25 14:44:39 +02:00
bug: fix dot marker setting not being considered (#934)
* bug: fixes marker settings being ignored while rendering time charts * appease clippy
This commit is contained in:
parent
0a9a6cfa60
commit
32da5f39bb
@ -64,7 +64,7 @@ fn get_from_hwmon(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let hwmon_name = file_path.join("name");
|
let hwmon_name = file_path.join("name");
|
||||||
let hwmon_name = Some(fs::read_to_string(&hwmon_name)?);
|
let hwmon_name = Some(fs::read_to_string(hwmon_name)?);
|
||||||
|
|
||||||
// Whether the temperature should *actually* be read during enumeration
|
// Whether the temperature should *actually* be read during enumeration
|
||||||
// Set to false if the device is in ACPI D3cold.
|
// Set to false if the device is in ACPI D3cold.
|
||||||
|
@ -39,7 +39,7 @@ impl Process {
|
|||||||
/// Kills a process, given a PID, for unix.
|
/// Kills a process, given a PID, for unix.
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
pub fn kill_process_given_pid(pid: Pid, signal: usize) -> crate::utils::error::Result<()> {
|
pub fn kill_process_given_pid(pid: Pid, signal: usize) -> crate::utils::error::Result<()> {
|
||||||
let output = unsafe { libc::kill(pid as i32, signal as i32) };
|
let output = unsafe { libc::kill(pid, signal as i32) };
|
||||||
if output != 0 {
|
if output != 0 {
|
||||||
// We had an error...
|
// We had an error...
|
||||||
let err_code = std::io::Error::last_os_error().raw_os_error();
|
let err_code = std::io::Error::last_os_error().raw_os_error();
|
||||||
|
@ -412,8 +412,8 @@ impl Painter {
|
|||||||
|
|
||||||
// This fixes #397, apparently if the height is 1, it can't render the CPU bars...
|
// This fixes #397, apparently if the height is 1, it can't render the CPU bars...
|
||||||
let cpu_height = {
|
let cpu_height = {
|
||||||
let c = (actual_cpu_data_len / 4) as u16
|
let c =
|
||||||
+ (if actual_cpu_data_len % 4 == 0 { 0 } else { 1 });
|
(actual_cpu_data_len / 4) as u16 + u16::from(actual_cpu_data_len % 4 != 0);
|
||||||
|
|
||||||
if c <= 1 {
|
if c <= 1 {
|
||||||
1
|
1
|
||||||
|
@ -98,7 +98,7 @@ impl Painter {
|
|||||||
|
|
||||||
let margined_draw_loc = Layout::default()
|
let margined_draw_loc = Layout::default()
|
||||||
.constraints([Constraint::Percentage(100)])
|
.constraints([Constraint::Percentage(100)])
|
||||||
.horizontal_margin(if is_on_widget || draw_border { 0 } else { 1 })
|
.horizontal_margin(u16::from(!(is_on_widget || draw_border)))
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.split(draw_loc)[0];
|
.split(draw_loc)[0];
|
||||||
|
|
||||||
|
@ -97,8 +97,7 @@ impl Painter {
|
|||||||
let to_divide = REQUIRED_COLUMNS - itx;
|
let to_divide = REQUIRED_COLUMNS - itx;
|
||||||
let num_taken = min(
|
let num_taken = min(
|
||||||
remaining_height,
|
remaining_height,
|
||||||
(row_counter / to_divide)
|
(row_counter / to_divide) + usize::from(row_counter % to_divide != 0),
|
||||||
+ (if row_counter % to_divide == 0 { 0 } else { 1 }),
|
|
||||||
);
|
);
|
||||||
row_counter -= num_taken;
|
row_counter -= num_taken;
|
||||||
let chunk = (&mut gauge_info).take(num_taken);
|
let chunk = (&mut gauge_info).take(num_taken);
|
||||||
|
@ -272,7 +272,7 @@ impl Painter {
|
|||||||
|
|
||||||
let margined_draw_loc = Layout::default()
|
let margined_draw_loc = Layout::default()
|
||||||
.constraints([Constraint::Percentage(100)])
|
.constraints([Constraint::Percentage(100)])
|
||||||
.horizontal_margin(if is_on_widget || draw_border { 0 } else { 1 })
|
.horizontal_margin(u16::from(!(is_on_widget || draw_border)))
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.split(draw_loc)[0];
|
.split(draw_loc)[0];
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ where
|
|||||||
let draw_loc = draw_info.loc;
|
let draw_loc = draw_info.loc;
|
||||||
let margined_draw_loc = Layout::default()
|
let margined_draw_loc = Layout::default()
|
||||||
.constraints([Constraint::Percentage(100)])
|
.constraints([Constraint::Percentage(100)])
|
||||||
.horizontal_margin(if draw_horizontal { 0 } else { 1 })
|
.horizontal_margin(u16::from(!draw_horizontal))
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.split(draw_loc)[0];
|
.split(draw_loc)[0];
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ impl<'a> TimeGraph<'a> {
|
|||||||
.block(block)
|
.block(block)
|
||||||
.x_axis(x_axis)
|
.x_axis(x_axis)
|
||||||
.y_axis(y_axis)
|
.y_axis(y_axis)
|
||||||
|
.marker(self.marker)
|
||||||
.legend_style(self.graph_style)
|
.legend_style(self.graph_style)
|
||||||
.hidden_legend_constraints(
|
.hidden_legend_constraints(
|
||||||
self.legend_constraints
|
self.legend_constraints
|
||||||
|
@ -363,7 +363,7 @@ impl<'a> TimeChart<'a> {
|
|||||||
for (i, label) in labels.iter().enumerate() {
|
for (i, label) in labels.iter().enumerate() {
|
||||||
let dy = i as u16 * (graph_area.height - 1) / (labels_len - 1);
|
let dy = i as u16 * (graph_area.height - 1) / (labels_len - 1);
|
||||||
if dy < graph_area.bottom() {
|
if dy < graph_area.bottom() {
|
||||||
buf.set_span(x, graph_area.bottom() - 1 - dy, label, label_width as u16);
|
buf.set_span(x, graph_area.bottom() - 1 - dy, label, label_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -426,6 +426,7 @@ impl<'a> Widget for TimeChart<'a> {
|
|||||||
.background_color(self.style.bg.unwrap_or(Color::Reset))
|
.background_color(self.style.bg.unwrap_or(Color::Reset))
|
||||||
.x_bounds(self.x_axis.bounds)
|
.x_bounds(self.x_axis.bounds)
|
||||||
.y_bounds(self.y_axis.bounds)
|
.y_bounds(self.y_axis.bounds)
|
||||||
|
.marker(self.marker)
|
||||||
.paint(|ctx| {
|
.paint(|ctx| {
|
||||||
for dataset in &self.datasets {
|
for dataset in &self.datasets {
|
||||||
let color = dataset.style.fg.unwrap_or(Color::Reset);
|
let color = dataset.style.fg.unwrap_or(Color::Reset);
|
||||||
|
@ -236,11 +236,7 @@ pub fn build_app(
|
|||||||
hide_time: get_hide_time(matches, config),
|
hide_time: get_hide_time(matches, config),
|
||||||
autohide_time,
|
autohide_time,
|
||||||
use_old_network_legend: get_use_old_network_legend(matches, config),
|
use_old_network_legend: get_use_old_network_legend(matches, config),
|
||||||
table_gap: if get_hide_table_gap(matches, config) {
|
table_gap: u16::from(!get_hide_table_gap(matches, config)),
|
||||||
0
|
|
||||||
} else {
|
|
||||||
1
|
|
||||||
},
|
|
||||||
disable_click: get_disable_click(matches, config),
|
disable_click: get_disable_click(matches, config),
|
||||||
enable_gpu_memory: get_enable_gpu_memory(matches, config),
|
enable_gpu_memory: get_enable_gpu_memory(matches, config),
|
||||||
show_table_scroll_position: get_show_table_scroll_position(matches, config),
|
show_table_scroll_position: get_show_table_scroll_position(matches, config),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user