mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-26 07:04:51 +02:00
bug: fix searching by command being broken (#204)
Fixes searching by command name being broken.
This commit is contained in:
parent
83e3437b36
commit
2425779e7f
@ -210,10 +210,10 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_in_search_widget(&self) -> bool {
|
pub fn is_in_search_widget(&self) -> bool {
|
||||||
match self.current_widget.widget_type {
|
matches!(
|
||||||
BottomWidgetType::ProcSearch => true,
|
self.current_widget.widget_type,
|
||||||
_ => false,
|
BottomWidgetType::ProcSearch
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset_multi_tap_keys(&mut self) {
|
fn reset_multi_tap_keys(&mut self) {
|
||||||
|
@ -887,18 +887,12 @@ pub enum BottomWidgetType {
|
|||||||
impl BottomWidgetType {
|
impl BottomWidgetType {
|
||||||
pub fn is_widget_table(&self) -> bool {
|
pub fn is_widget_table(&self) -> bool {
|
||||||
use BottomWidgetType::*;
|
use BottomWidgetType::*;
|
||||||
match self {
|
matches!(self, Disk | Proc | ProcSort | Temp | CpuLegend)
|
||||||
Disk | Proc | ProcSort | Temp | CpuLegend => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_widget_graph(&self) -> bool {
|
pub fn is_widget_graph(&self) -> bool {
|
||||||
use BottomWidgetType::*;
|
use BottomWidgetType::*;
|
||||||
match self {
|
matches!(self, Cpu | Net | Mem)
|
||||||
Cpu | Net | Mem => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_pretty_name(&self) -> &str {
|
pub fn get_pretty_name(&self) -> &str {
|
||||||
|
@ -669,7 +669,11 @@ impl Prefix {
|
|||||||
} else if let Some((prefix_type, query_content)) = &self.regex_prefix {
|
} else if let Some((prefix_type, query_content)) = &self.regex_prefix {
|
||||||
if let StringQuery::Regex(r) = query_content {
|
if let StringQuery::Regex(r) = query_content {
|
||||||
match prefix_type {
|
match prefix_type {
|
||||||
PrefixType::Name => r.is_match(process.name.as_str()),
|
PrefixType::Name => r.is_match(if is_using_command {
|
||||||
|
process.command.as_str()
|
||||||
|
} else {
|
||||||
|
process.name.as_str()
|
||||||
|
}),
|
||||||
PrefixType::Pid => r.is_match(process.pid.to_string().as_str()),
|
PrefixType::Pid => r.is_match(process.pid.to_string().as_str()),
|
||||||
PrefixType::State => r.is_match(process.process_state.as_str()),
|
PrefixType::State => r.is_match(process.process_state.as_str()),
|
||||||
_ => true,
|
_ => true,
|
||||||
|
@ -19,11 +19,10 @@ pub fn get_variable_intrinsic_widths(
|
|||||||
let mut remaining_width = (total_width - (num_widths as u16 - 1)) as i32; // Required for spaces...
|
let mut remaining_width = (total_width - (num_widths as u16 - 1)) as i32; // Required for spaces...
|
||||||
let desired_widths = desired_widths_ratio
|
let desired_widths = desired_widths_ratio
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&desired_width_ratio| (desired_width_ratio * total_width as f64) as i32)
|
.map(|&desired_width_ratio| (desired_width_ratio * total_width as f64) as i32);
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
for (desired_width, resulting_width, width_threshold) in izip!(
|
for (desired_width, resulting_width, width_threshold) in izip!(
|
||||||
desired_widths.into_iter(),
|
desired_widths,
|
||||||
resulting_widths.iter_mut(),
|
resulting_widths.iter_mut(),
|
||||||
width_thresholds
|
width_thresholds
|
||||||
) {
|
) {
|
||||||
|
15
src/lib.rs
15
src/lib.rs
@ -418,15 +418,16 @@ pub fn handle_force_redraws(app: &mut App) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::needless_collect)]
|
||||||
pub fn update_all_process_lists(app: &mut App) {
|
pub fn update_all_process_lists(app: &mut App) {
|
||||||
let widget_ids = app
|
|
||||||
.proc_state
|
|
||||||
.widget_states
|
|
||||||
.keys()
|
|
||||||
.cloned()
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
if !app.is_frozen {
|
if !app.is_frozen {
|
||||||
|
let widget_ids = app
|
||||||
|
.proc_state
|
||||||
|
.widget_states
|
||||||
|
.keys()
|
||||||
|
.cloned()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
widget_ids.into_iter().for_each(|widget_id| {
|
widget_ids.into_iter().for_each(|widget_id| {
|
||||||
update_final_process_list(app, widget_id);
|
update_final_process_list(app, widget_id);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user