Skip to main content

LOAD_SCREEN

Constant LOAD_SCREEN 

Source
pub const LOAD_SCREEN: &str = "\u{1b}[?47h";
Expand description

Loads the last saved screen and the cursor position.

Equivalent to CSI ? 4 7 h.

The screen and cursor position are saved with SAVE_SCREEN.

The lines are not preserved; loaded text will not unwrap after resize.

If you have tui app and you want to preserve the terminal state, rather use ENABLE_ALTERNATIVE_BUFFER and DISABLE_ALTERNATIVE_BUFFER.

§Example

use termal_core::codes;

let mut buf = codes::CLEAR.to_string();

buf += "This text will be saved and restored";
buf += codes::SAVE_SCREEN;

buf += codes::CLEAR;
buf += "You will not see this text because it will be overwritten with \
    the saved screen";

buf += codes::LOAD_SCREEN;

println!("{buf}");

§Result in terminal