aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--atuin/src/command/client/search/history_list.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/atuin/src/command/client/search/history_list.rs b/atuin/src/command/client/search/history_list.rs
index 488ed89f..e27d0ce2 100644
--- a/atuin/src/command/client/search/history_list.rs
+++ b/atuin/src/command/client/search/history_list.rs
@@ -109,7 +109,7 @@ impl<'a> HistoryList<'a> {
fn get_items_bounds(&self, selected: usize, offset: usize, height: usize) -> (usize, usize) {
let offset = offset.min(self.history.len().saturating_sub(1));
- let max_scroll_space = height.min(10);
+ let max_scroll_space = height.min(10).min(self.history.len() - selected);
if offset + height < selected + max_scroll_space {
let end = selected + max_scroll_space;
(end - height, end)