Add shortcuts J/K to scroll to beginning/end of table, respectively.

This commit is contained in:
Christoph Heiss 2019-12-26 18:17:10 +01:00
parent 78e1c43d68
commit bffa1b29b6
Signed by: c8h4
GPG key ID: 73D5E7FDEE3DE49A

View file

@ -111,6 +111,18 @@ pub fn show(siv: &mut Cursive, auth_data: AuthData, vault_data: VaultData) {
})
.unwrap();
})
.on_event('J', |siv| {
siv.call_on_id("password_table", |view: &mut VaultTableView| {
view.set_selected_row(view.len() - 1);
})
.unwrap();
})
.on_event('K', |siv| {
siv.call_on_id("password_table", |view: &mut VaultTableView| {
view.set_selected_row(0);
})
.unwrap();
})
.on_event(Event::CtrlChar('u'), |siv| {
siv.call_on_id("password_table", |view: &mut VaultTableView| {
if let Some(row) = view.item() {