async_tty/commands/erase.rs
1use std::fmt;
2
3use crate::write_csi;
4
5pub enum EraseInDisplay {
6 FromCursorToEnd,
7 FromCursorToBeginning,
8 EntireScreen,
9}
10
11impl fmt::Display for EraseInDisplay {
12 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13 match self {
14 EraseInDisplay::FromCursorToEnd => write_csi!(f, "J"),
15 EraseInDisplay::FromCursorToBeginning => write_csi!(f, "1J"),
16 EraseInDisplay::EntireScreen => write_csi!(f, "2J"),
17 }
18 }
19}