summaryrefslogtreecommitdiffstats
path: root/src/history.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/history.rs')
-rw-r--r--src/history.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/history.rs b/src/history.rs
index e5ad161..348224b 100644
--- a/src/history.rs
+++ b/src/history.rs
@@ -127,10 +127,11 @@ impl History {
&self,
out: &mut textmode::Output,
repl_lines: usize,
+ focus: Option<usize>,
) -> anyhow::Result<()> {
let mut used_lines = repl_lines;
let mut pos = None;
- for entry in self.entries.iter().rev() {
+ for (idx, entry) in self.entries.iter().enumerate().rev() {
let entry = entry.lock_arc().await;
let screen = entry.vt.screen();
let mut last_row = 0;
@@ -139,6 +140,12 @@ impl History {
last_row = idx + 1;
}
}
+ if focus == Some(idx) {
+ last_row = std::cmp::max(
+ last_row,
+ screen.cursor_position().0 as usize + 1,
+ );
+ }
used_lines += 1 + std::cmp::min(6, last_row);
if used_lines > 24 {
break;