This commit is contained in:
Timon_Post 2019-05-04 12:40:59 +02:00
parent 51c0ab6012
commit e1a46d5fb5
4 changed files with 29 additions and 29 deletions

View File

@ -44,7 +44,8 @@ pub fn pos_raw() -> io::Result<(u16, u16)> {
} }
// Read rows and cols through a ad-hoc integer parsing function // Read rows and cols through a ad-hoc integer parsing function
let read_num: fn() -> Result<(i32, char), Error> = || -> Result<(i32, char), Error> { let read_num: fn() -> Result<(i32, char) -> Result<(i32, char), Error> =
|| -> Result<(i32, char), Error> {
let mut num = 0; let mut num = 0;
let mut c: char; let mut c: char;

View File

@ -91,7 +91,7 @@ impl ITerminalColor for AnsiColor {
rgb_val = format!("5;{}", val); rgb_val = format!("5;{}", val);
rgb_val.as_str() rgb_val.as_str()
} }
_ => "" _ => "",
}; };
ansi_value.push_str(color_val); ansi_value.push_str(color_val);

View File

@ -31,17 +31,16 @@ pub struct TerminalColor {
impl TerminalColor { impl TerminalColor {
/// Create new instance whereon color related actions can be performed. /// Create new instance whereon color related actions can be performed.
pub fn new() -> TerminalColor { pub fn new() -> TerminalColor {
// #[cfg(windows)] #[cfg(windows)]
// let color = if supports_ansi() { let color = if supports_ansi() {
// Box::from(AnsiColor::new()) as Box<(dyn ITerminalColor + Sync + Send)> Box::from(AnsiColor::new()) as Box<(dyn ITerminalColor + Sync + Send)>
// } else { } else {
// WinApiColor::new() as Box<(dyn ITerminalColor + Sync + Send)> WinApiColor::new() as Box<(dyn ITerminalColor + Sync + Send)>
// }; };
//
// #[cfg(unix)] #[cfg(unix)]
// let color = AnsiColor::new(); let color = AnsiColor::new();
let color = WinApiColor::new() as Box<(dyn ITerminalColor + Sync + Send)>;
TerminalColor { color } TerminalColor { color }
} }

View File

@ -156,7 +156,7 @@ impl ITerminalColor for WinApiColor {
const mask: u16 = FG_INTENSITY | FG_RED | FG_GREEN | FG_BLUE; const mask: u16 = FG_INTENSITY | FG_RED | FG_GREEN | FG_BLUE;
original_color &= !(mask); original_color &= !(mask);
original_color original_color
}, }
/* WinApi will be used for systems that do not support ANSI, those are windows version less then 10. RGB and 255 (AnsiBValue) colors are not supported in that case.*/ /* WinApi will be used for systems that do not support ANSI, those are windows version less then 10. RGB and 255 (AnsiBValue) colors are not supported in that case.*/
Color::Rgb { r: _, g: _, b: _ } => 0, Color::Rgb { r: _, g: _, b: _ } => 0,
Color::AnsiValue(_val) => 0, Color::AnsiValue(_val) => 0,