From 2aca3bd8d5210445ccc92d1e07e31a387166a78a Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Fri, 11 Jun 2021 16:15:35 +0200 Subject: [PATCH] browse: use Alacritty locking escape sequences TODO: extract this into a backend crate --- src/bin/browse.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bin/browse.rs b/src/bin/browse.rs index 1c71398..92f12a8 100644 --- a/src/bin/browse.rs +++ b/src/bin/browse.rs @@ -427,10 +427,15 @@ fn show_listing(mailbox: &str) -> Result<()> { tree.on_event(Event::Key(Key::End)) }).unwrap().process(&mut siv); siv.refresh(); + siv.backend.as_any_mut().downcast_mut::().unwrap().terminal.get_mut().write_all(&[b'\x1b', b'\x50', b't', b'm', b'u', b'x', b';', b'\x1b', b'\x1b', b'\x50', b'=', b'2', b's', b'\x1b', b'\x1b', b'\x5c', b'\x1b', b'\\']).unwrap(); + siv.backend.as_any_mut().downcast_mut::().unwrap().terminal.get_mut().flush().unwrap(); + *siv.backend.as_any_mut().downcast_mut::().unwrap().locked.get_mut() = false; while siv.is_running() { - siv.step(); + while !siv.step() {} + siv.backend.as_any_mut().downcast_mut::().unwrap().terminal.get_mut().write_all(&[b'\x1b', b'\x50', b't', b'm', b'u', b'x', b';', b'\x1b', b'\x1b', b'\x50', b'=', b'2', b's', b'\x1b', b'\x1b', b'\x5c', b'\x1b', b'\\']).unwrap(); + siv.backend.as_any_mut().downcast_mut::().unwrap().terminal.get_mut().flush().unwrap(); + *siv.backend.as_any_mut().downcast_mut::().unwrap().locked.get_mut() = false; } - Ok(()) }