diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e3fc0c6..94fc546 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,37 +5,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -50,65 +25,56 @@
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
@@ -116,35 +82,41 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
@@ -160,7 +132,6 @@
- srct_read_rect
get_output_handle();
color
super::
@@ -190,6 +161,7 @@
env
crossterm
chi_buffer
+ Write
crossterm_cursor
@@ -228,7 +200,6 @@
-
@@ -236,37 +207,38 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -306,7 +278,6 @@
-
@@ -327,13 +298,6 @@
-
-
-
-
-
-
-
@@ -380,6 +344,13 @@
+
+
+
+
+
+
+
@@ -399,19 +370,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -425,6 +383,13 @@
+
+
+
+
+
+
+
@@ -435,6 +400,7 @@
+
@@ -643,10 +609,10 @@
-
+
-
+
@@ -656,46 +622,67 @@
-
-
+
-
+
-
-
+
-
-
-
-
-
-
-
-
+
-
+
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -704,9 +691,10 @@
-
+
-
+
+
@@ -722,65 +710,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -788,13 +717,7 @@
-
-
-
-
-
-
-
+
@@ -802,17 +725,10 @@
-
-
-
-
-
-
-
-
-
+
+
@@ -830,20 +746,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -865,17 +767,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -894,10 +785,6 @@
-
-
-
-
@@ -915,38 +802,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -994,33 +849,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1040,21 +870,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1065,13 +882,6 @@
-
-
-
-
-
-
-
@@ -1082,20 +892,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1110,6 +906,166 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/mod.rs b/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/mod.rs
index 427c108..a25d8fe 100644
--- a/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/mod.rs
+++ b/examples/Crossterm 0.2.2 - New Version (Not finished)/program_examples/first_depth_search/mod.rs
@@ -60,6 +60,7 @@ fn print_welcome_screen(crossterm: &Crossterm)
// clear the screen and print the welcome message.
terminal.clear(ClearType::All);
+ cursor.goto(0,0);
terminal.write(WELCOME_MESSAGE.join("\n"));
cursor.hide();
diff --git a/src/cursor/cursor.rs b/src/cursor/cursor.rs
index 014179c..60ff353 100644
--- a/src/cursor/cursor.rs
+++ b/src/cursor/cursor.rs
@@ -232,12 +232,9 @@ impl TerminalCursor {
let mut mutex = &self.context.screen_manager;
{
-// let mut screen_manager = mutex.lock().unwrap();
-// screen_manager.write_string(string);
-
- println!("{}",string);
-
-// screen_manager.flush();
+ let mut screen_manager = mutex.lock().unwrap();
+ screen_manager.write_string(string);
+ screen_manager.flush();
}
}
self
diff --git a/src/manager/ansi_manager.rs b/src/manager/ansi_manager.rs
index 05952f7..d156bfb 100644
--- a/src/manager/ansi_manager.rs
+++ b/src/manager/ansi_manager.rs
@@ -14,7 +14,6 @@ pub struct AnsiScreenManager {
impl IScreenManager for AnsiScreenManager {
fn toggle_is_alternate_screen(&mut self, is_alternate_screen: bool) {
- panic!();
self.is_alternate_screen = is_alternate_screen;
}
diff --git a/src/shared/functions.rs b/src/shared/functions.rs
index 113d70f..d66acda 100644
--- a/src/shared/functions.rs
+++ b/src/shared/functions.rs
@@ -17,7 +17,7 @@ use kernel::unix_kernel::terminal::{exit, pos, terminal_size};
/// Get the terminal size based on the current platform.
pub fn get_terminal_size(screen_manager: &Rc>) -> (u16, u16) {
#[cfg(unix)]
- return terminal_size(screen_manager);
+ return terminal_size();
#[cfg(windows)]
return terminal_size(screen_manager);
@@ -48,11 +48,11 @@ pub fn get_module(winapi_impl: T, unix_impl: T) -> Option {
let mut does_support = false;
if cfg!(target_os = "windows") {
-// #[cfg(windows)]
-// use kernel::windows_kernel::ansi_support::try_enable_ansi_support;
-//
-// // Try to enable ansi on windows if not than use WINAPI.
-// does_support = try_enable_ansi_support();
+ #[cfg(windows)]
+ use kernel::windows_kernel::ansi_support::try_enable_ansi_support;
+
+ // Try to enable ansi on windows if not than use WINAPI.
+ does_support = try_enable_ansi_support();
if !does_support {
term = Some(winapi_impl);
diff --git a/src/style/color/color.rs b/src/style/color/color.rs
index 078d899..abe90e8 100644
--- a/src/style/color/color.rs
+++ b/src/style/color/color.rs
@@ -25,7 +25,7 @@ impl TerminalColor {
).unwrap();
#[cfg(not(target_os = "windows"))]
- let color = Some(AnsiColor::new(context.screen_manager.clone()) as Box);
+ let color = AnsiColor::new(context.screen_manager.clone()) as Box;
TerminalColor {
color: color,
diff --git a/src/style/styles/objectstyle.rs b/src/style/styles/objectstyle.rs
index a08c0ba..21f6470 100644
--- a/src/style/styles/objectstyle.rs
+++ b/src/style/styles/objectstyle.rs
@@ -10,7 +10,7 @@ use std::rc::Rc;
use super::super::Attribute;
/// Struct that contains the style properties that can be applied to an displayable object.
-#[derive(Copy, Clone)]
+#[derive(Clone)]
pub struct ObjectStyle {
pub fg_color: Option,
pub bg_color: Option,
diff --git a/src/style/styles/styledobject.rs b/src/style/styles/styledobject.rs
index 6a5134c..eae2cb5 100644
--- a/src/style/styles/styledobject.rs
+++ b/src/style/styles/styledobject.rs
@@ -173,20 +173,18 @@ impl Display for StyledObject
reset = true;
}
- if cfg!(target_os = "linux") {
- fmt::Display::fmt(&self.content, f)?;
- } else {
- let mutex = &self.context.screen_manager;
- {
- let mut screen_manager = mutex.lock().unwrap();
- use std::fmt::Write;
- let mut string = String::new();
- write!(string, "{}", self.content).unwrap();
- screen_manager.write_string(string)
- }
+ let mutex = &self.context.screen_manager;
+ {
+ let mut screen_manager = mutex.lock().unwrap();
+
+ use std::fmt::Write;
+ let mut string = String::new();
+ write!(string, "{}", self.content).unwrap();
+ screen_manager.write_string(string)
}
+
let mutex = &self.context.screen_manager;
{
let mut screen = mutex.lock().unwrap();
diff --git a/src/terminal/ansi_terminal.rs b/src/terminal/ansi_terminal.rs
index 8c0bc1e..98774d0 100644
--- a/src/terminal/ansi_terminal.rs
+++ b/src/terminal/ansi_terminal.rs
@@ -2,6 +2,7 @@
//! This module is used for windows 10 terminals and unix terminals by default.
use super::{ClearType, ITerminal, Rc};
+use super::super::cursor::cursor;
use shared::functions;
use Context;
diff --git a/src/terminal/terminal.rs b/src/terminal/terminal.rs
index 443f6dd..ac56b7d 100644
--- a/src/terminal/terminal.rs
+++ b/src/terminal/terminal.rs
@@ -7,7 +7,8 @@ use super::*;
use Context;
use std::fmt;
-use std::fmt::Write;
+use std::io::Write;
+
use std::rc::Rc;
/// Struct that stores an specific platform implementation for terminal related actions.
@@ -196,6 +197,7 @@ impl Terminal {
write!(string, "{}", value).unwrap();
screen_manager.write_string(string);
+ screen_manager.flush();
}
}
}