fix selecting last match if there are no unmatched lines
Some checks failed
CI / check (push) Failing after 7s
CI / check-extractor (push) Failing after 2s
CI / clippy (push) Has been skipped
CI / build (x86_64-pc-windows-gnu) (push) Has been skipped
CI / build (x86_64-unknown-linux-gnu) (push) Has been skipped
CI / build (x86_64-unknown-linux-musl) (push) Has been skipped
CI / build-nixpkgs (push) Has been skipped

This commit is contained in:
Robin Appelman 2024-09-25 16:49:02 +02:00
commit cea03a8f4f

View file

@ -31,10 +31,10 @@ impl<'a> MatchListState<'a> {
fn enter(self, selected: usize, app: &'a App) -> UiState<'a> { fn enter(self, selected: usize, app: &'a App) -> UiState<'a> {
let result = if selected == 0 { let result = if selected == 0 {
&app.all &app.all
} else if selected == app.match_lines() - 1 { } else if selected <= app.matches.len() {
&app.unmatched
} else {
&app.matches[selected - 1] &app.matches[selected - 1]
} else {
&app.unmatched
}; };
let table_state = ScrollbarTableState::new(result.grouped.len()); let table_state = ScrollbarTableState::new(result.grouped.len());
UiState::Match(MatchState { UiState::Match(MatchState {