From 9a8209cc2da7c98966cba4d3e4ebc6223308214e Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 11 Dec 2021 04:26:18 -0500 Subject: make scrolling offscreen work --- src/state.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index eee39ae..888a3ef 100644 --- a/src/state.rs +++ b/src/state.rs @@ -234,7 +234,8 @@ impl State { crate::action::Action::Run(ref cmd) => { let idx = self.history.run(cmd, action_w.clone()).await.unwrap(); - self.focus = crate::action::Focus::History(idx); + self.set_focus(crate::action::Focus::History(idx), None) + .await; self.hide_readline = true; } crate::action::Action::UpdateFocus(new_focus) => { @@ -297,6 +298,13 @@ impl State { self.focus = new_focus; self.hide_readline = false; self.scene = self.default_scene(new_focus, entry).await; + self.history + .make_focus_visible( + self.readline.lines(), + self.focus_idx(), + matches!(self.focus, crate::action::Focus::Scrolling(_)), + ) + .await; } fn focus_idx(&self) -> Option { -- cgit v1.2.3-54-g00ecf