From e07f9af433da7b72d74ccfdd29ec7e5f6ec301c5 Mon Sep 17 00:00:00 2001 From: rabite Date: Sat, 9 Feb 2019 19:34:21 +0100 Subject: [PATCH] change opener to rifle --- src/file_browser.rs | 8 ++++---- src/listview.rs | 6 ++++++ src/window.rs | 9 +++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/file_browser.rs b/src/file_browser.rs index f152d25..97bb24f 100644 --- a/src/file_browser.rs +++ b/src/file_browser.rs @@ -72,17 +72,17 @@ impl FileBrowser { Err(ref err) if err.description() == "placeholder".to_string() => self.show_status("No! Can't open this!"), _ => { - let status = std::process::Command::new("xdg-open") - .args(dbg!(file.path.file_name())) + let status = std::process::Command::new("rifle") + .args(file.path.file_name()) .status(); match status { Ok(status) => self.show_status(&format!("\"{}\" exited with {}", - "xdg-open", status)), + "rifle", status)), Err(err) => self.show_status(&format!("Can't run this \"{}\": {}", - "xdg-open", err)) + "rifle", err)) } } diff --git a/src/listview.rs b/src/listview.rs index a466e3a..990e337 100644 --- a/src/listview.rs +++ b/src/listview.rs @@ -3,6 +3,7 @@ use termion::event::{Event, Key}; use unicode_width::UnicodeWidthStr; use std::path::{Path, PathBuf}; +use std::io::Write; use crate::coordinates::{Coordinates, Position, Size}; use crate::files::{File, Files}; @@ -320,6 +321,11 @@ where .arg("-c") .arg(&cmd) .status(); + + write!(std::io::stdout(), "{}{}", + termion::style::Reset, + termion::clear::All).unwrap(); + match status { Ok(status) => self.show_status(&format!("\"{}\" exited with {}", cmd, status)), diff --git a/src/window.rs b/src/window.rs index 49a401f..1642425 100644 --- a/src/window.rs +++ b/src/window.rs @@ -74,6 +74,7 @@ where //Self::clear_status(); let event = event.unwrap(); self.widget.on_event(event); + self.screen.cursor_hide(); self.draw(); } } @@ -136,8 +137,8 @@ pub fn show_status(status: &str) { pub fn minibuffer(query: &str) -> Option { show_status(&(query.to_string() + ": ")); write!(stdout(), "{}{}", - termion::cursor::Show, - termion::cursor::Save).unwrap(); + termion::cursor::Show, + termion::cursor::Save).unwrap(); stdout().flush().unwrap(); let mut buffer = "".to_string(); @@ -150,8 +151,12 @@ pub fn minibuffer(query: &str) -> Option { Key::Esc | Key::Ctrl('c') => break, Key::Char('\n') => { if buffer == "" { + write!(stdout(), "{}", termion::cursor::Hide).unwrap(); + stdout().flush().unwrap(); return None; } else { + write!(stdout(), "{}", termion::cursor::Hide).unwrap(); + stdout().flush().unwrap(); return Some(buffer); } }