Module crossterm::cursor[][src]

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::{stdout, Write};

use crossterm::{
    ExecutableCommand, execute, Result,
    cursor::{DisableBlinking, EnableBlinking, MoveTo, RestorePosition, SavePosition}
};

fn main() -> Result<()> {
    // with macro
    execute!(
        stdout(),
        SavePosition,
        MoveTo(10, 10),
        EnableBlinking,
        DisableBlinking,
        RestorePosition
    );

  // with function
  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 sets the shape of the cursor

A command that shows the terminal cursor.

Enums

All supported cursor shapes

Functions

Returns the cursor position (column, row).