bug: Fix sizing in search and broken tab logic
This commit is contained in:
parent
b32c984843
commit
7d9ad1ee78
10
src/app.rs
10
src/app.rs
|
@ -720,12 +720,12 @@ impl App {
|
||||||
|
|
||||||
let is_in_search_widget = self.is_in_search_widget();
|
let is_in_search_widget = self.is_in_search_widget();
|
||||||
if !self.is_in_dialog() {
|
if !self.is_in_dialog() {
|
||||||
|
if is_in_search_widget {
|
||||||
if let Some(proc_widget_state) = self
|
if let Some(proc_widget_state) = self
|
||||||
.proc_state
|
.proc_state
|
||||||
.widget_states
|
.widget_states
|
||||||
.get_mut(&(self.current_widget.widget_id - 1))
|
.get_mut(&(self.current_widget.widget_id - 1))
|
||||||
{
|
{
|
||||||
if is_in_search_widget {
|
|
||||||
if !proc_widget_state.is_grouped {
|
if !proc_widget_state.is_grouped {
|
||||||
if proc_widget_state.process_search_state.is_searching_with_pid {
|
if proc_widget_state.process_search_state.is_searching_with_pid {
|
||||||
self.search_with_name();
|
self.search_with_name();
|
||||||
|
@ -733,7 +733,12 @@ impl App {
|
||||||
self.search_with_pid();
|
self.search_with_pid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
} else if let Some(proc_widget_state) = self
|
||||||
|
.proc_state
|
||||||
|
.widget_states
|
||||||
|
.get_mut(&self.current_widget.widget_id)
|
||||||
|
{
|
||||||
// Toggles process widget grouping state
|
// Toggles process widget grouping state
|
||||||
proc_widget_state.is_grouped = !(proc_widget_state.is_grouped);
|
proc_widget_state.is_grouped = !(proc_widget_state.is_grouped);
|
||||||
if proc_widget_state.is_grouped {
|
if proc_widget_state.is_grouped {
|
||||||
|
@ -742,7 +747,6 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// I don't like this, but removing it causes a bunch of breakage.
|
/// I don't like this, but removing it causes a bunch of breakage.
|
||||||
/// Use ``proc_widget_state.is_grouped`` if possible!
|
/// Use ``proc_widget_state.is_grouped`` if possible!
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::cmp::{max, min};
|
use std::cmp::max;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app::{self, App, ProcWidgetState},
|
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 is_on_widget = widget_id == app_state.current_widget.widget_id;
|
||||||
let num_columns = draw_loc.width as usize;
|
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 {
|
let search_title: &str = if !small_mode {
|
||||||
chosen_text
|
chosen_text
|
||||||
} else if chosen_text.is_empty() {
|
} 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> "
|
"p> "
|
||||||
} else {
|
} else {
|
||||||
"n> "
|
"n> "
|
||||||
|
|
Loading…
Reference in New Issue