Aaaaand revert again.

This commit is contained in:
ClementTsang 2020-02-19 00:06:36 -05:00
parent bbd475cfdb
commit 2135ebbef1
2 changed files with 41 additions and 8 deletions

View file

@ -540,9 +540,41 @@ impl App {
} else if !self.is_in_dialog() {
// Pop-out mode. We ignore if in process search.
match self.current_widget_selected {
WidgetPosition::ProcessSearch => {}
_ => self.is_expanded = true,
WidgetPosition::Process => {
self.app_scroll_positions
.process_scroll_state
.current_scroll_position = 0;
self.app_scroll_positions
.process_scroll_state
.previous_scroll_position = 0;
}
WidgetPosition::Cpu => {
self.app_scroll_positions
.cpu_scroll_state
.current_scroll_position = 0;
self.app_scroll_positions
.cpu_scroll_state
.previous_scroll_position = 0;
}
WidgetPosition::Temp => {
self.app_scroll_positions
.temp_scroll_state
.current_scroll_position = 0;
self.app_scroll_positions
.temp_scroll_state
.previous_scroll_position = 0;
}
WidgetPosition::Disk => {
self.app_scroll_positions
.disk_scroll_state
.current_scroll_position = 0;
self.app_scroll_positions
.disk_scroll_state
.previous_scroll_position = 0;
}
_ => {}
}
self.is_expanded = true;
}
}

View file

@ -74,12 +74,13 @@ pub fn get_start_position(
num_rows: u64, scroll_direction: &app::ScrollDirection, scroll_position_bar: &mut u64,
currently_selected_position: u64,
) -> u64 {
if currently_selected_position >= *scroll_position_bar
&& num_rows > (currently_selected_position - *scroll_position_bar + 1)
{
*scroll_position_bar =
std::cmp::max(0, currently_selected_position as i64 - num_rows as i64 + 1) as u64;
}
// if currently_selected_position >= *scroll_position_bar
// && num_rows > (currently_selected_position - *scroll_position_bar + num_rows)
// {
// *scroll_position_bar =
// std::cmp::max(0, currently_selected_position as i64 - num_rows as i64) as u64;
// debug!("Scroll bar: {}", *scroll_position_bar);
// }
match scroll_direction {
app::ScrollDirection::DOWN => {
if currently_selected_position < *scroll_position_bar + num_rows {