From 46e7ad720f5682e31e02d8dd02dd720bae5c8eb1 Mon Sep 17 00:00:00 2001 From: Timon Date: Tue, 26 Jun 2018 16:48:50 +0000 Subject: [PATCH] fixed unix compile error --- .idea/workspace.xml | 342 ++++++++---------- .../bin.rs | 11 +- .../color/mod.rs | 2 +- src/cursor/ansi_cursor.rs | 2 +- src/style/styles/styledobject.rs | 7 +- 5 files changed, 169 insertions(+), 195 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 325ca54..6e5268e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,14 +3,9 @@ - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -79,20 +35,69 @@ - + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -100,30 +105,12 @@ - + - - - - - - - - - - - - - - - - - - @@ -135,7 +122,6 @@ - terminal_cursor term ScreenManager color @@ -165,6 +151,7 @@ data context WinApiScreenManager + color( crossterm_cursor @@ -205,7 +192,6 @@ @@ -291,6 +278,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -557,11 +564,12 @@ + - @@ -573,50 +581,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -624,12 +610,12 @@ - + @@ -640,7 +626,7 @@ - + @@ -666,13 +652,6 @@ - - - - - - - @@ -774,13 +753,6 @@ - - - - - - - @@ -795,13 +767,6 @@ - - - - - - - @@ -823,13 +788,6 @@ - - - - - - - @@ -886,20 +844,6 @@ - - - - - - - - - - - - - - @@ -918,31 +862,19 @@ - - - - - - - - - - - - - + - + @@ -956,14 +888,14 @@ - + - + @@ -975,10 +907,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs b/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs index cf3732b..4f4f8d8 100644 --- a/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs +++ b/examples/Crossterm 0.2.2 - New Version (Not finished)/bin.rs @@ -30,15 +30,10 @@ use std::io::Write; use std::{time, thread}; fn main() { -//// alternate_screen::switch_between_main_and_alternate_screen(); let context = Context::new(); -// let mut scre = screen::AlternateScreen::from(context.clone()); -// write!(scre, "asdf"); -// scre.flush(); -// thread::sleep(time::Duration::from_secs(3)); - use crossterm::terminal::terminal; + use crossterm::cursor::cursor; - let curs = terminal(context.clone()); - curs.set_title(String::from("Test")); + let curs = cursor(context.clone()); + curs.blink(false); } \ No newline at end of file diff --git a/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs b/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs index 81b65af..603c70f 100644 --- a/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs +++ b/examples/Crossterm 0.2.2 - New Version (Not finished)/color/mod.rs @@ -146,7 +146,7 @@ pub fn print_supported_colors() let context = Context::new(); let terminal = terminal::terminal(context.clone()); - let count = crossterm::style::color(context.screen_manager.clone()).get_available_color_count().unwrap(); + let count = crossterm::style::color(context.clone()).get_available_color_count().unwrap(); for i in 0..count { diff --git a/src/cursor/ansi_cursor.rs b/src/cursor/ansi_cursor.rs index d880abe..83fe35b 100644 --- a/src/cursor/ansi_cursor.rs +++ b/src/cursor/ansi_cursor.rs @@ -100,7 +100,7 @@ impl ITerminalCursor for AnsiCursor { screen.write_ansi_str(csi!("?12h")); } else { - screen.write_ansi_str(csi!("?12l")); + screen.write_ansi_str(csi!("?12")); } } } diff --git a/src/style/styles/styledobject.rs b/src/style/styles/styledobject.rs index 8d3cd9a..8fcaa3f 100644 --- a/src/style/styles/styledobject.rs +++ b/src/style/styles/styledobject.rs @@ -124,18 +124,19 @@ macro_rules! impl_fmt colored_terminal.set_bg(bg); reset = true; } + if let Some(fg) = self.object_style.fg_color { colored_terminal.set_fg(fg); reset = true; } - #[cfg(unix)] +// #[cfg(unix)] for attr in self.object_style.attrs.iter() { - let mutex = self.context.screen_manager; + let mutex = &self.context.screen_manager; { let mut screen = mutex.lock().unwrap(); - screen.write_ansi_str(format!(csi!("{}m"), *attr as i16)); + screen.write_ansi(format!(csi!("{}m"), *attr as i16)); } reset = true; }