clear screen before launching media player

pull/22/head
chris west 4 years ago
parent 7157faf16d
commit d814268d7e

@ -99,7 +99,7 @@ pub fn open_external(url: &str) -> Result<()> {
#[cfg(feature = "media")]
/// Opens a media file with `mpv`.
pub fn open_media(url: &str) -> Result<()> {
use crate::terminal;
use {crate::terminal, std::io};
// mpv only supports /9/
let url = url.replace("/;/", "/9/").replace("/s/", "/9/");
@ -119,6 +119,11 @@ pub fn open_media(url: &str) -> Result<()> {
}
};
// clear screen first
let mut stdout = io::stdout();
write!(stdout, "{}{}", terminal::ClearAll, terminal::Goto(1, 1))?;
stdout.flush()?;
terminal::disable_raw_mode()?;
let mut cmd = process::Command::new("mpv")
.arg(url)

Loading…
Cancel
Save