Struct crossterm::TerminalCursor [−][src]
pub struct TerminalCursor<'stdout> { /* fields omitted */ }Struct that stores an specific platform implementation for cursor related actions.
Check /examples/cursor in the library for more specific examples.
extern crate crossterm; use self::crossterm::cursor; use self::crossterm::Screen; let screen = Screen::default(); let mut cursor = cursor(&screen); // Get cursor and goto pos X: 5, Y: 10 cursor.goto(5,10); cursor.show(); cursor.hide(); cursor.blink(true); cursor.move_left(2);
Methods
impl<'stdout> TerminalCursor<'stdout>[src]
impl<'stdout> TerminalCursor<'stdout>pub fn new(screen: &'stdout Arc<TerminalOutput>) -> TerminalCursor<'stdout>[src]
pub fn new(screen: &'stdout Arc<TerminalOutput>) -> TerminalCursor<'stdout>Create new cursor instance whereon cursor related actions can be performed.
pub fn goto(&self, x: u16, y: u16)[src]
pub fn goto(&self, x: u16, y: u16)Goto some position (x,y) in the terminal.
let screen = Screen::default(); let cursor = cursor(&screen); // change the cursor to position, x: 4 and y: 5 cursor.goto(4,5);
pub fn pos(&self) -> (u16, u16)[src]
pub fn pos(&self) -> (u16, u16)Get current cursor position (x,y) in the terminal.
let screen = Screen::default(); let cursor = cursor(&screen); // get the current cursor pos let (x,y) = cursor.pos();
pub fn move_up(&mut self, count: u16) -> &mut TerminalCursor<'stdout>[src]
pub fn move_up(&mut self, count: u16) -> &mut TerminalCursor<'stdout>Move the current cursor position n times up.
let screen = Screen::default(); let cursor = cursor(&screen); // Move the cursor to position 3 times to the up in the terminal cursor.move_up(3);
pub fn move_right(&mut self, count: u16) -> &mut TerminalCursor<'stdout>[src]
pub fn move_right(&mut self, count: u16) -> &mut TerminalCursor<'stdout>Move the current cursor position n times right.
let screen = Screen::default(); let cursor = cursor(&screen); // Move the cursor to position 3 times to the right in the terminal cursor.move_right(3);
pub fn move_down(&mut self, count: u16) -> &mut TerminalCursor<'stdout>[src]
pub fn move_down(&mut self, count: u16) -> &mut TerminalCursor<'stdout>Move the current cursor position n times down.
let screen = Screen::default(); let cursor = cursor(&screen); // Move the cursor to position 3 times to the down in the terminal cursor.move_down(3);
pub fn move_left(&mut self, count: u16) -> &mut TerminalCursor<'stdout>[src]
pub fn move_left(&mut self, count: u16) -> &mut TerminalCursor<'stdout>Move the current cursor position n times left.
let screen = Screen::default(); let cursor = cursor(&screen); // Move the cursor to position 3 times to the left in the terminal cursor.move_left(3);
pub fn save_position(&self)[src]
pub fn save_position(&self)Save cursor position for recall later.
Note that this position is stored program based not per instance of the Cursor struct.
let screen = Screen::default(); let cursor = cursor(&screen); cursor.safe_position();
pub fn reset_position(&self)[src]
pub fn reset_position(&self)Return to saved cursor position
Note that this method reset to the position set by save_position() and that this position is stored program based not per instance of the Cursor struct.
let screen = Screen::default(); let cursor = cursor(&screen); cursor.reset_position();
pub fn hide(&self)[src]
pub fn hide(&self)Hide de cursor in the console.
let cursor = cursor(&Screen::default()); cursor.hide();
pub fn show(&self)[src]
pub fn show(&self)Show the cursor in the console.
let screen = Screen::default(); let cursor = cursor(&screen); cursor.show();
pub fn blink(&self, blink: bool)[src]
pub fn blink(&self, blink: bool)Enable or disable blinking of the terminal.
Not all terminals are supporting this functionality. Windows versions lower than windows 10 also are not supporting this version.
let screen = Screen::default(); let cursor = cursor(&screen); cursor.blink(true); cursor.blink(false);
Auto Trait Implementations
impl<'stdout> Send for TerminalCursor<'stdout>
impl<'stdout> Send for TerminalCursor<'stdout>impl<'stdout> Sync for TerminalCursor<'stdout>
impl<'stdout> Sync for TerminalCursor<'stdout>