[−][src]Module crossterm::terminal
A module to work with the terminal.
Terminal
The terminal
module provides functionality to work with the terminal.
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.
Terminal actions can be performed with commands. Please have a look at command documention for a more detailed documentation.
Examples
use std::io::{stdout, Write}; use crossterm::{execute, Result, terminal::{ScrollUp, SetSize, size}}; fn main() -> Result<()> { let (cols, rows) = size()?; // Do something with the terminal execute!( stdout(), SetSize(10, 10), ScrollUp(5) )?; // Be a good citizen, cleanup execute!(stdout(), SetSize(cols, rows))?; Ok(()) }
For manual execution control check out crossterm::queue.
Structs
Clear | A command that clears the terminal screen buffer. |
ScrollDown | A command that scrolls the terminal screen a given number of rows down. |
ScrollUp | A command that scrolls the terminal screen a given number of rows up. |
SetSize | A command that sets the terminal size |
Enums
ClearType | Represents different options how to clear the terminal. |
Functions
exit | Exits the current application. |
size | Returns the terminal size |