From 75dbba73824af996a97885b0d6f1515a4689fad4 Mon Sep 17 00:00:00 2001 From: PaddiM8 Date: Thu, 10 Dec 2020 21:13:04 +0100 Subject: [PATCH] removed colors in some places for windows, since it didn't work properly there --- kalk_cli/src/output.rs | 7 ++++++- kalk_cli/src/repl.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/kalk_cli/src/output.rs b/kalk_cli/src/output.rs index de44d2b..e9d91da 100644 --- a/kalk_cli/src/output.rs +++ b/kalk_cli/src/output.rs @@ -45,7 +45,12 @@ pub fn eval(parser: &mut parser::Context, input: &str) { } pub fn print_err(msg: &str) { - println!("{}", Red.paint(msg)); + let msg = if cfg!(windows) { + msg.to_string() + } else { + Red.paint(msg).to_string() + }; + println!("{}", msg); } fn print_calc_err(err: CalcError) { diff --git a/kalk_cli/src/repl.rs b/kalk_cli/src/repl.rs index b170779..3656e02 100644 --- a/kalk_cli/src/repl.rs +++ b/kalk_cli/src/repl.rs @@ -24,7 +24,12 @@ pub fn start(mut parser: &mut parser::Context) { })); loop { - let readline = editor.readline(&Cyan.paint(">> ").to_string()); + let prompt = if cfg!(windows) { + String::from(">> ") + } else { + Cyan.paint(">> ").to_string() + }; + let readline = editor.readline(&prompt); match readline { Ok(input) => {