mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-10 14:44:18 +00:00
Aaaaand revert again.
This commit is contained in:
parent
bbd475cfdb
commit
2135ebbef1
2 changed files with 41 additions and 8 deletions
36
src/app.rs
36
src/app.rs
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue