Skip to main content

ERASE_LINE

Constant ERASE_LINE 

Source
pub const ERASE_LINE: &str = "\u{1b}[2K";
Expand description

Erases the entire line.

Equivalent to CSI 2 K

§Example

use termal_core::{codes, Error, raw::{
    TermSize, Terminal, term_size
}};

// Fill the terminal with `#` and move to the center.
let TermSize { char_width: w, char_height: h, .. } = term_size()?;
let mut buf = "#".to_string() + &codes::repeat_char!(w * h - 1);
buf += &codes::move_to!(w / 2, h / 2);

// Erase the entire line.
buf += codes::ERASE_LINE;

// Print to the output and wait for enter. Screenshot is taken before enter
// is pressed.
Terminal::stdio().flushed(buf)?;
Terminal::stdio().read()?;

Ok::<_, Error>(())

§Result in terminal