From 3c2ac7df54b5864eea678340fde5942e08ffad89 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 16 May 2019 18:07:11 -0700 Subject: [PATCH 1/2] Make sure to enable ANSI for Win10 --- src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.rs b/src/main.rs index 733851ebd..7d937ac28 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,6 +48,7 @@ fn main() -> Result<(), Box> { let config = Config::builder().color_mode(ColorMode::Forced).build(); let h = crate::shell::Helper::new(); let mut rl: Editor = Editor::with_config(config); + let _ = ansi_term::enable_ansi_support(); rl.set_helper(Some(h)); if rl.load_history("history.txt").is_err() { println!("No previous history."); From c1398145f31a68dfd301d74c6b1342258fb3f45a Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 16 May 2019 21:37:18 -0700 Subject: [PATCH 2/2] Add windows cfg check --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 7d937ac28..57036b283 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,7 +48,11 @@ fn main() -> Result<(), Box> { let config = Config::builder().color_mode(ColorMode::Forced).build(); let h = crate::shell::Helper::new(); let mut rl: Editor = Editor::with_config(config); - let _ = ansi_term::enable_ansi_support(); + + if cfg!(windows) { + let _ = ansi_term::enable_ansi_support(); + } + rl.set_helper(Some(h)); if rl.load_history("history.txt").is_err() { println!("No previous history.");