From 062434852b4740e851d79724b6c866b16a0b095b Mon Sep 17 00:00:00 2001 From: Vraj Shah Date: Sun, 30 Jul 2023 09:23:30 -0400 Subject: [PATCH] Fixed rightward drift --- src/state.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/state.rs b/src/state.rs index 9684a195..f0e34682 100644 --- a/src/state.rs +++ b/src/state.rs @@ -162,16 +162,16 @@ impl BarState { pub(crate) fn suspend R, R>(&mut self, now: Instant, f: F) -> R { if let Some((state, _)) = self.draw_target.remote() { - state.write().unwrap().suspend(f, now) - } else { - if let Some(drawable) = self.draw_target.drawable(true, now) { - let _ = drawable.clear(); - } + return state.write().unwrap().suspend(f, now); + } - let ret = f(); - let _ = self.draw(true, Instant::now()); - ret + if let Some(drawable) = self.draw_target.drawable(true, now) { + let _ = drawable.clear(); } + + let ret = f(); + let _ = self.draw(true, Instant::now()); + ret } pub(crate) fn draw(&mut self, mut force_draw: bool, now: Instant) -> io::Result<()> {