mirror of
https://github.com/atuinsh/atuin.git
synced 2025-08-19 11:20:13 +02:00
fix: panic when invoking delete on empty tui (#2584)
If the result set is empty and thus the TUI does not show any entries, a panic occurs when a user invokes 'delete' via Prefix Ctrl-D or Ctrl-D in the inspector..
This commit is contained in:
committed by
GitHub
parent
e2f10db3f0
commit
c55ea10a4b
@@ -1116,6 +1116,9 @@ pub async fn history(
|
||||
match app.handle_input(settings, &event::read()?, &mut std::io::stdout())? {
|
||||
InputAction::Continue => {},
|
||||
InputAction::Delete(index) => {
|
||||
if results.is_empty() {
|
||||
break;
|
||||
}
|
||||
app.results_len -= 1;
|
||||
let selected = app.results_state.selected();
|
||||
if selected == app.results_len {
|
||||
|
Reference in New Issue
Block a user