chore(#621): Exit atuin when pressing down arrow on most recent entry (#659)

Signed-off-by: Baptiste Roux <arte.but.posix@gmail.com>

Signed-off-by: Baptiste Roux <arte.but.posix@gmail.com>
This commit is contained in:
Baptiste 2023-01-10 23:46:33 +01:00 committed by GitHub
parent b01d9f81b0
commit 582189336d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,6 +122,9 @@ impl State {
}
TermEvent::Key(Key::Down | Key::Ctrl('n' | 'j'))
| TermEvent::Mouse(MouseEvent::Press(MouseButton::WheelDown, _, _)) => {
if self.results_state.selected() == 0 && input.eq(&TermEvent::Key(Key::Down)) {
return Some(RETURN_ORIGINAL);
}
let i = self.results_state.selected().saturating_sub(1);
self.results_state.select(i);
}