removed '-' sign in file
This commit is contained in:
parent
f354e6356d
commit
66f2d04d5c
@ -1,67 +1,67 @@
|
|||||||
-extern crate crossterm;
|
extern crate crossterm;
|
||||||
-
|
|
||||||
-use crossterm::Crossterm;
|
use crossterm::Crossterm;
|
||||||
-
|
|
||||||
-/// use the `Crossterm` to get an instance to the cursor module | demonstration.
|
/// use the `Crossterm` to get an instance to the cursor module | demonstration.
|
||||||
-pub fn use_crossterm_cursor()
|
pub fn use_crossterm_cursor()
|
||||||
-{
|
{
|
||||||
- let crossterm = Crossterm::new();
|
let crossterm = Crossterm::new();
|
||||||
- let mut cursor = crossterm.cursor();
|
let mut cursor = crossterm.cursor();
|
||||||
- cursor.goto(5,5).print("test");
|
cursor.goto(5,5).print("test");
|
||||||
-}
|
}
|
||||||
-
|
|
||||||
-use crossterm::style::Color;
|
use crossterm::style::Color;
|
||||||
-
|
|
||||||
-/// use the `Crossterm` to get an instance to the color module | demonstration.
|
/// use the `Crossterm` to get an instance to the color module | demonstration.
|
||||||
-pub fn use_crossterm_color()
|
pub fn use_crossterm_color()
|
||||||
-{
|
{
|
||||||
- let crossterm = Crossterm::new();
|
let crossterm = Crossterm::new();
|
||||||
- let mut color = crossterm.color();
|
let mut color = crossterm.color();
|
||||||
- color.set_bg(Color::Red);
|
color.set_bg(Color::Red);
|
||||||
- color.set_fg(Color::Green);
|
color.set_fg(Color::Green);
|
||||||
-}
|
}
|
||||||
-
|
|
||||||
-use crossterm::terminal::ClearType;
|
use crossterm::terminal::ClearType;
|
||||||
-
|
|
||||||
-/// use the `Crossterm` to get an instance to the terminal module | demonstration.
|
/// use the `Crossterm` to get an instance to the terminal module | demonstration.
|
||||||
-pub fn use_crossterm_terminal()
|
pub fn use_crossterm_terminal()
|
||||||
-{
|
{
|
||||||
- let crossterm = Crossterm::new();
|
let crossterm = Crossterm::new();
|
||||||
- let mut terminal = crossterm.terminal();
|
let mut terminal = crossterm.terminal();
|
||||||
- terminal.clear(ClearType::All);
|
terminal.clear(ClearType::All);
|
||||||
- terminal.set_size(40,40);
|
terminal.set_size(40,40);
|
||||||
-}
|
}
|
||||||
-
|
|
||||||
-/// paint text with colors using `Crossterm` | demonstration.
|
/// paint text with colors using `Crossterm` | demonstration.
|
||||||
-pub fn use_crossterm_paint()
|
pub fn use_crossterm_paint()
|
||||||
-{
|
{
|
||||||
- let crossterm = Crossterm::new();
|
let crossterm = Crossterm::new();
|
||||||
- crossterm.paint("Black on BLUE").with(Color::Black).on(Color::Blue);
|
crossterm.paint("Black on BLUE").with(Color::Black).on(Color::Blue);
|
||||||
-}
|
}
|
||||||
-
|
|
||||||
-/// write text to terminal using `Crossterm` | demonstration.
|
/// write text to terminal using `Crossterm` | demonstration.
|
||||||
-pub fn use_crossterm_write()
|
pub fn use_crossterm_write()
|
||||||
-{
|
{
|
||||||
- let crossterm = Crossterm::new();
|
let crossterm = Crossterm::new();
|
||||||
- crossterm.write("some text \nsome text on new line");
|
crossterm.write("some text \nsome text on new line");
|
||||||
-}
|
}
|
||||||
-
|
|
||||||
-/// Switch to alternate screen using the `Context` of `Crossterm` | demonstration.
|
/// Switch to alternate screen using the `Context` of `Crossterm` | demonstration.
|
||||||
-pub fn create_alternate_screen_from_crossterm()
|
pub fn create_alternate_screen_from_crossterm()
|
||||||
-{
|
{
|
||||||
- use crossterm::screen::*;
|
use crossterm::screen::*;
|
||||||
- use std::convert::From;
|
use std::convert::From;
|
||||||
-
|
|
||||||
- let crossterm = Crossterm::new();
|
let crossterm = Crossterm::new();
|
||||||
-
|
|
||||||
- {
|
{
|
||||||
- // move into alternate screen
|
// move into alternate screen
|
||||||
- let alternate_screen = AlternateScreen::from(crossterm.context());
|
let alternate_screen = AlternateScreen::from(crossterm.context());
|
||||||
-
|
|
||||||
- // this will move the cursor and print `some text` on the alternate screen.
|
// this will move the cursor and print `some text` on the alternate screen.
|
||||||
- crossterm.cursor().goto(10, 10).print("Some text");
|
crossterm.cursor().goto(10, 10).print("Some text");
|
||||||
- } // <- alternate screen ends here an will be switched back to main screen.
|
} // <- alternate screen ends here an will be switched back to main screen.
|
||||||
-
|
|
||||||
- // print "Some other text" on the mainscreen at x: 0, y: 10
|
// print "Some other text" on the mainscreen at x: 0, y: 10
|
||||||
- crossterm.cursor().goto(0,10).print("Some other text");
|
crossterm.cursor().goto(0,10).print("Some other text");
|
||||||
-}
|
}
|
Loading…
Reference in New Issue
Block a user