feat: Pagination support for jumping 20 items at a time in all table views [#45]

This commit is contained in:
Dark-Alex-17 committed 2025-08-08 17:04:28 -06:00
1 parent 345bb8ce03
commit e96af7410e
11 files changed
+362 -7

No files matched your search

+12
View File
@@ -13,6 +13,8 @@ pub enum Key {
Down,
Left,
Right,
PgDown,
PgUp,
Enter,
Esc,
Backspace,
@@ -35,6 +37,8 @@ impl Display for Key {
Key::Down => write!(f, "<↓>"),
Key::Left => write!(f, "<←>"),
Key::Right => write!(f, "<→>"),
Key::PgDown => write!(f, "<C-d>"),
Key::PgUp => write!(f, "<C-u>"),
Key::Enter => write!(f, "<enter>"),
Key::Esc => write!(f, "<esc>"),
Key::Backspace => write!(f, "<backspace>"),
@@ -66,6 +70,14 @@ impl From<KeyEvent> for Key {
code: KeyCode::Right,
..
} => Key::Right,
KeyEvent {
code: KeyCode::PageDown,
..
} => Key::PgDown,
KeyEvent {
code: KeyCode::PageUp,
..
} => Key::PgUp,
KeyEvent {
code: KeyCode::Backspace,
..
+12
View File
@@ -11,6 +11,8 @@ mod tests {
#[case(Key::Down, "↓")]
#[case(Key::Left, "←")]
#[case(Key::Right, "→")]
#[case(Key::PgDown, "C-d")]
#[case(Key::PgUp, "C-u")]
#[case(Key::Enter, "enter")]
#[case(Key::Esc, "esc")]
#[case(Key::Backspace, "backspace")]
@@ -45,6 +47,16 @@ mod tests {
assert_eq!(Key::from(KeyEvent::from(KeyCode::Right)), Key::Right);
}
#[test]
fn test_key_from_page_down() {
assert_eq!(Key::from(KeyEvent::from(KeyCode::PageDown)), Key::PgDown);
}
#[test]
fn test_key_from_page_up() {
assert_eq!(Key::from(KeyEvent::from(KeyCode::PageUp)), Key::PgUp);
}
#[test]
fn test_key_from_backspace() {
assert_eq!(