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 {
|
||||
match self.current_widget.widget_type {
|
||||
BottomWidgetType::ProcSearch => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(
|
||||
self.current_widget.widget_type,
|
||||
BottomWidgetType::ProcSearch
|
||||
)
|
||||
}
|
||||
|
||||
fn reset_multi_tap_keys(&mut self) {
|
||||
|
|
|
@ -887,18 +887,12 @@ pub enum BottomWidgetType {
|
|||
impl BottomWidgetType {
|
||||
pub fn is_widget_table(&self) -> bool {
|
||||
use BottomWidgetType::*;
|
||||
match self {
|
||||
Disk | Proc | ProcSort | Temp | CpuLegend => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, Disk | Proc | ProcSort | Temp | CpuLegend)
|
||||
}
|
||||
|
||||
pub fn is_widget_graph(&self) -> bool {
|
||||
use BottomWidgetType::*;
|
||||
match self {
|
||||
Cpu | Net | Mem => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, Cpu | Net | Mem)
|
||||
}
|
||||
|
||||
pub fn get_pretty_name(&self) -> &str {
|
||||
|
|
|
@ -669,7 +669,11 @@ impl Prefix {
|
|||
} else if let Some((prefix_type, query_content)) = &self.regex_prefix {
|
||||
if let StringQuery::Regex(r) = query_content {
|
||||
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::State => r.is_match(process.process_state.as_str()),
|
||||
_ => 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 desired_widths = desired_widths_ratio
|
||||
.iter()
|
||||
.map(|&desired_width_ratio| (desired_width_ratio * total_width as f64) as i32)
|
||||
.collect::<Vec<_>>();
|
||||
.map(|&desired_width_ratio| (desired_width_ratio * total_width as f64) as i32);
|
||||
|
||||
for (desired_width, resulting_width, width_threshold) in izip!(
|
||||
desired_widths.into_iter(),
|
||||
desired_widths,
|
||||
resulting_widths.iter_mut(),
|
||||
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) {
|
||||
let widget_ids = app
|
||||
.proc_state
|
||||
.widget_states
|
||||
.keys()
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if !app.is_frozen {
|
||||
let widget_ids = app
|
||||
.proc_state
|
||||
.widget_states
|
||||
.keys()
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
widget_ids.into_iter().for_each(|widget_id| {
|
||||
update_final_process_list(app, widget_id);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue