fix merge confilict

This commit is contained in:
TimonPost 2018-07-28 10:09:09 +02:00
commit 86a82a33cd
6 changed files with 32 additions and 3 deletions

View File

@ -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

View File

@ -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<ITerminalCursor>,
}
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::<Box<ITerminalCursor>>(
WinApiCursor::new(),

View File

@ -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) {}
}

View File

@ -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;

View File

@ -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)
}

View File

@ -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::<WinApiScreenManager>()
{
Some(b) => b,
None => return Err(Error::new(ErrorKind::Other,"Invalid cast exception")),
};
b.set_alternate_handle(new_handle);
Ok(())
}