summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-04-07 22:38:22 -0400
committerGitHub <noreply@github.com>2020-04-07 22:38:22 -0400
commit7d9ad1ee78f464df48235898a91af4a588165f05 (patch)
tree7d5c981484645e198e0fe912f92bd0d4370328bc
parentb32c9848433ce068776ed4bc3d86f9634457db8c (diff)
bug: Fix sizing in search and broken tab logic
-rw-r--r--src/app.rs28
-rw-r--r--src/canvas/widgets/process_table.rs8
2 files changed, 21 insertions, 15 deletions
diff --git a/src/app.rs b/src/app.rs
index fb5c5b8f..986f8178 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -720,12 +720,12 @@ impl App {
let is_in_search_widget = self.is_in_search_widget();
if !self.is_in_dialog() {
- if let Some(proc_widget_state) = self
- .proc_state
- .widget_states
- .get_mut(&(self.current_widget.widget_id - 1))
- {
- if is_in_search_widget {
+ if is_in_search_widget {
+ if let Some(proc_widget_state) = self
+ .proc_state
+ .widget_states
+ .get_mut(&(self.current_widget.widget_id - 1))
+ {
if !proc_widget_state.is_grouped {
if proc_widget_state.process_search_state.is_searching_with_pid {
self.search_with_name();
@@ -733,12 +733,16 @@ impl App {
self.search_with_pid();
}
}
- } else {
- // Toggles process widget grouping state
- proc_widget_state.is_grouped = !(proc_widget_state.is_grouped);
- if proc_widget_state.is_grouped {
- self.search_with_name();
- }
+ }
+ } else if let Some(proc_widget_state) = self
+ .proc_state
+ .widget_states
+ .get_mut(&self.current_widget.widget_id)
+ {
+ // Toggles process widget grouping state
+ proc_widget_state.is_grouped = !(proc_widget_state.is_grouped);
+ if proc_widget_state.is_grouped {
+ self.search_with_name();
}
}
}
diff --git a/src/canvas/widgets/process_table.rs b/src/canvas/widgets/process_table.rs
index d7961f5f..e164a413 100644
--- a/src/canvas/widgets/process_table.rs
+++ b/src/canvas/widgets/process_table.rs
@@ -1,4 +1,4 @@
-use std::cmp::{max, min};
+use std::cmp::max;
use crate::{
app::{self, App, ProcWidgetState},
@@ -319,12 +319,14 @@ impl ProcessTableWidget for Painter {
let is_on_widget = widget_id == app_state.current_widget.widget_id;
let num_columns = draw_loc.width as usize;
- let small_mode = chosen_text.len() != min(num_columns / 2, chosen_text.len());
+ let small_mode = num_columns < 70;
let search_title: &str = if !small_mode {
chosen_text
} else if chosen_text.is_empty() {
""
- } else if proc_widget_state.process_search_state.is_searching_with_pid {
+ } else if proc_widget_state.process_search_state.is_searching_with_pid
+ && !proc_widget_state.is_grouped
+ {
"p> "
} else {
"n> "