[−][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. |
sequence | Creates an ANSI sequence. |
Structs
DisableCursorBlinking | Disables the cursor blinking. |
EnableCursorBlinking | Enables the cursor blinking. |
HideCursor | Hides the cursor. |
MoveCursorDown | Moves the cursor down by the given number of rows. |
MoveCursorLeft | Moves the cursor left by the given number of columns. |
MoveCursorRight | Moves the cursor right by the given number of columns. |
MoveCursorTo | Moves the cursor to the given location (column, row). |
MoveCursorToColumn | Moves the cursor to the given column. |
MoveCursorToNextLine | Moves the cursor to beginning of line the given number of lines down. |
MoveCursorToPreviousLine | Moves the cursor to beginning of line the given number of lines up. |
MoveCursorUp | Moves the cursor up by the given number of rows. |
ResizeTextArea | Resizes the text area to the given width and height in characters. |
RestoreCursorPosition | Restores the cursor position. |
SaveCursorPosition | Saves the cursor position. |
ScrollBufferDown | Scrolls down by the given number of rows. |
ScrollBufferUp | Scrolls up by the given number of rows. |
SetBackgroundColor | Sets the background color. |
SetForegroundColor | Sets the foreground color. |
ShowCursor | Shows the cursor. |
SwitchBufferToAlternate | Switches to the alternate buffer. |
SwitchBufferToNormal | Switches to the normal buffer. |
Enums
ClearBuffer | Clears part of the buffer. |
ClearLine | Clears part of the line. |
Color | A color. |