[−][src]Crate anes
ANSI Escape Sequence
Every sequence implements the standard library Display
trait. It means that you can use macros like format!
, write!
to work with them.
Examples
Retrieve the sequence as a String
:
use anes::SaveCursorPosition; let string = format!("{}", SaveCursorPosition); assert_eq!(&string, "\x1B7");
Use the sequence on the standard output:
use std::io::{Result, Write}; fn main() -> Result<()> { let mut stdout = std::io::stdout(); write!(stdout, "{}", anes::SaveCursorPosition)?; write!(stdout, "{}", anes::RestoreCursorPosition)?; stdout.flush()?; Ok(()) }
Macros
csi | Creates a control sequence. |
esc | Creates an escape sequence. |
Structs
DisableCursorBlinking | Disable the cursor blinking. |
EnableCursorBlinking | Enable the cursor blinking. |
HideCursor | Hide the cursor. |
MoveCursorDown | Move down the cursor by the given number of rows. |
MoveCursorLeft | Move left the cursor by the given number of columns. |
MoveCursorRight | Move right the cursor by the given number of columns. |
MoveCursorTo | Move the cursor to the given location (column, row). |
MoveCursorToColumn | Move the cursor to the given column. |
MoveCursorToNextLine | Move the cursor to beginning of line the given number of lines down. |
MoveCursorToPreviousLine | Move the cursor to beginning of line the given number of lines up. |
MoveCursorUp | Move up the cursor by the given number of rows. |
ResizeTextArea | Resize the text area to the given width and height in characters. |
RestoreCursorPosition | Restore the cursor position. |
SaveCursorPosition | Save the cursor position. |
ScrollBufferDown | Scroll down by the given number of rows. |
ScrollBufferUp | Scroll up by the given number of rows. |
ShowCursor | Show the cursor. |
SwitchBufferToAlternate | Switch to the alternate buffer. |
SwitchBufferToNormal | Switch to the normal buffer. |
Enums
ClearBuffer | Erase part of the screen. |
ClearLine | Erase part of the line. |