Skip to content

Commit

Permalink
disallow jump to bottom index
Browse files Browse the repository at this point in the history
  • Loading branch information
m12t committed Feb 13, 2025
1 parent 6616ef8 commit c4c22e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use crate::{bpf_program::{BpfProgram, Process}, helpers::program_type_to_string};
use circular_buffer::CircularBuffer;
use libbpf_rs::{query::ProgInfoIter, Iter, Link};
use ratatui::widgets::TableState;
use ratatui::widgets::ScrollbarState;
use ratatui::widgets::TableState;
use std::{
collections::HashMap,
io::Read,
Expand Down Expand Up @@ -324,14 +324,14 @@ impl App {
if items.len() > 0 {
let i = match self.table_state.selected() {
Some(i) => {
if i <= 0 {
if i == 0 {
0
} else {
self.vertical_scroll = self.vertical_scroll.saturating_sub(1);
i - 1
}
}
None => items.len() - 1,
None => 0,
};
self.table_state.select(Some(i));
}
Expand Down

0 comments on commit c4c22e4

Please sign in to comment.