Expand description
A module to work with the terminal cursor
§Cursor
The cursor
module provides functionality to work with the terminal cursor.
This documentation does not contain a lot of examples. The reason is that it’s fairly obvious how to use this crate. Although, we do provide examples repository to demonstrate the capabilities.
§Examples
Cursor actions can be performed with commands. Please have a look at command documentation for a more detailed documentation.
use std::io::{self, Write};
use crossterm::{
ExecutableCommand, execute,
cursor::{DisableBlinking, EnableBlinking, MoveTo, RestorePosition, SavePosition}
};
fn main() -> io::Result<()> {
// with macro
execute!(
io::stdout(),
SavePosition,
MoveTo(10, 10),
EnableBlinking,
DisableBlinking,
RestorePosition
);
// with function
io::stdout()
.execute(MoveTo(11,11))?
.execute(RestorePosition);
Ok(())
}
For manual execution control check out crossterm::queue.
Structs§
- A command that disables blinking of the terminal cursor.
- A command that enables blinking of the terminal cursor.
- A command that hides the terminal cursor.
- A command that moves the terminal cursor a given number of rows down.
- A command that moves the terminal cursor a given number of columns to the left.
- A command that moves the terminal cursor a given number of columns to the right.
- A command that moves the terminal cursor to the given position (column, row).
- A command that moves the terminal cursor to the given column on the current row.
- A command that moves the terminal cursor down the given number of lines, and moves it to the first column.
- A command that moves the terminal cursor up the given number of lines, and moves it to the first column.
- A command that moves the terminal cursor to the given row on the current column.
- A command that moves the terminal cursor a given number of rows up.
- A command that restores the saved terminal cursor position.
- A command that saves the current terminal cursor position.
- A command that shows the terminal cursor.
Enums§
- A command that sets the style of the cursor. It uses two types of escape codes, one to control blinking, and the other the shape.