Skip to content

bug: fix searching by command being broken #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 2 additions & 8 deletions src/app/layout_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion src/app/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions src/canvas/drawing_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down
15 changes: 8 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down