diff --git a/examples/Crossterm 0.3.1/bin.rs b/examples/Crossterm 0.3.1/bin.rs index d72e649..e59d3c7 100644 --- a/examples/Crossterm 0.3.1/bin.rs +++ b/examples/Crossterm 0.3.1/bin.rs @@ -25,6 +25,7 @@ use crossterm::Terminal; use std::{thread, time}; fn main() { +<<<<<<< HEAD let term = Terminal::new(); let mut cursor = term.cursor(); cursor.goto(10,10); @@ -34,3 +35,11 @@ fn main() { let line = stdin.read_line(); println!("{:?}", line) } +======= + { + let mut terminal = Terminal::new(); + terminal.enable_alternate_screen(); + thread::sleep(time::Duration::from_millis(5000)); + } +} +>>>>>>> 403d0668a72e9ca04a05bbe137a30d6a2d9ba90c diff --git a/src/cursor/cursor.rs b/src/cursor/cursor.rs index 755cc50..01da783 100644 --- a/src/cursor/cursor.rs +++ b/src/cursor/cursor.rs @@ -13,13 +13,21 @@ use std::rc::Rc; /// Struct that stores an specific platform implementation for cursor related actions. pub struct TerminalCursor<'cursor> { +<<<<<<< HEAD screen_manager: &'cursor ScreenManager, +======= + context: &'cursor ScreenManager, +>>>>>>> 403d0668a72e9ca04a05bbe137a30d6a2d9ba90c terminal_cursor: Box, } impl<'cursor> TerminalCursor<'cursor> { /// Create new cursor instance whereon cursor related actions can be performed. +<<<<<<< HEAD pub fn new(screen_manager: &'cursor ScreenManager) -> TerminalCursor<'cursor> { +======= + pub fn new(context: &'cursor ScreenManager) -> TerminalCursor<'cursor> { +>>>>>>> 403d0668a72e9ca04a05bbe137a30d6a2d9ba90c #[cfg(target_os = "windows")] let cursor = functions::get_module::>( WinApiCursor::new(), diff --git a/src/cursor/winapi_cursor.rs b/src/cursor/winapi_cursor.rs index ab359ed..c6f99ab 100644 --- a/src/cursor/winapi_cursor.rs +++ b/src/cursor/winapi_cursor.rs @@ -62,6 +62,5 @@ impl ITerminalCursor for WinApiCursor { fn show(&self, screen_manager: &ScreenManager) { cursor::cursor_visibility(true, screen_manager); } - fn blink(&self, blink: bool, screen_manager: &ScreenManager) {} } diff --git a/src/lib.rs b/src/lib.rs index f1c6068..a4167f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,9 @@ pub mod terminal; pub use shared::Terminal::Terminal; //pub use shared::crossterm::Crossterm; + +pub use shared::crossterm::Crossterm; + pub use shared::raw; pub use shared::screen; pub use state::context::Context; diff --git a/src/shared/Terminal.rs b/src/shared/Terminal.rs index 86df135..399890b 100644 --- a/src/shared/Terminal.rs +++ b/src/shared/Terminal.rs @@ -2,12 +2,12 @@ use {StateManager, ScreenManager}; use super::super::state::commands::*; use super::raw::RawTerminal; use super::screen::AlternateScreen; +<<<<<<< HEAD use super::super::cursor; use super::super::input; use super::super::terminal; - use std::collections::HashMap; use std::io::Result; @@ -99,7 +99,6 @@ impl Terminal{ return Ok(()) } - pub fn cursor(&self) -> cursor::TerminalCursor { cursor::TerminalCursor::new(&self.active_screen) } diff --git a/src/state/commands/win_commands.rs b/src/state/commands/win_commands.rs index 4cbf8d0..1d361e7 100644 --- a/src/state/commands/win_commands.rs +++ b/src/state/commands/win_commands.rs @@ -154,6 +154,17 @@ impl IAlternateScreenCommand for ToAlternateScreenBufferCommand { Some(b) => b.set_alternate_handle(new_handle), None => return Err(Error::new(ErrorKind::Other,"Invalid cast exception")), }; + + let b: &mut WinApiScreenManager = match screen_manager + .as_any() + .downcast_mut::() + { + Some(b) => b, + None => return Err(Error::new(ErrorKind::Other,"Invalid cast exception")), + }; + + b.set_alternate_handle(new_handle); + Ok(()) }