From 7fdbec0826efc577dc743d0240f6665669a1ed5f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 11 Dec 2021 04:52:40 -0500 Subject: try harder to keep the focused line visible --- src/state.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index 9d10b74..0b54815 100644 --- a/src/state.rs +++ b/src/state.rs @@ -227,7 +227,22 @@ impl State { ) { let mut hard_refresh = false; match action { - crate::action::Action::Render => {} + crate::action::Action::Render => { + // for instance, if we are rerendering because of command + // output, that output could increase the number of lines of + // output of a command, pushing the currently focused entry + // off the top of the screen + self.history + .make_focus_visible( + self.readline.lines(), + self.focus_idx(), + matches!( + self.focus, + crate::action::Focus::Scrolling(_) + ), + ) + .await; + } crate::action::Action::ForceRedraw => { hard_refresh = true; } -- cgit v1.2.3-54-g00ecf