Struct crossterm::AlternateScreen
source · pub struct AlternateScreen {
pub screen: Screen,
/* private fields */
}
Expand description
With this type you will be able to switch to alternate screen and back to main screen. Check also the Screen type for swishing to alternate mode.
Although this type is available for you to use I would recommend using Screen
instead.
Fields§
§screen: Screen
Implementations§
source§impl AlternateScreen
impl AlternateScreen
sourcepub fn new(
command: Box<dyn IAlternateScreenCommand + Sync + Send>,
screen: Screen
) -> Self
pub fn new(
command: Box<dyn IAlternateScreenCommand + Sync + Send>,
screen: Screen
) -> Self
Create new instance of alternate screen.
sourcepub fn to_alternate_screen(
stdout: TerminalOutput,
raw_mode: bool
) -> Result<AlternateScreen>
pub fn to_alternate_screen(
stdout: TerminalOutput,
raw_mode: bool
) -> Result<AlternateScreen>
Switch to alternate screen. This function will return an AlternateScreen
instance if everything went well this type will give you control over the AlternateScreen
.
The bool specifies whether the screen should be in raw mode or not.
What is Alternate screen?
*Nix style applications often utilize an alternate screen buffer, so that they can modify the entire contents of the buffer, without affecting the application that started them. The alternate buffer is exactly the dimensions of the window, without any scrollback region. For an example of this behavior, consider when vim is launched from bash. Vim uses the entirety of the screen to edit the file, then returning to bash leaves the original buffer unchanged.
sourcepub fn to_main_screen(&self) -> Result<()>
pub fn to_main_screen(&self) -> Result<()>
Switch the alternate screen back to main screen.