#[non_exhaustive]pub enum TerminalMode {
}Expand description
A terminal mode a program can turn on and off. Bubble Tea turns them
on and off from each View’s fields; a
Backend writes them.
use petitcarnets as tea;
use tea::TerminalMode;
assert_eq!(TerminalMode::AltScreen.sequence(true), b"\x1b[?1049h");
assert_eq!(TerminalMode::AltScreen.sequence(false), b"\x1b[?1049l");
assert_eq!(TerminalMode::CursorStyle(5).sequence(true), b"\x1b[5 q");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BracketedPaste
Bracketed paste (mode 2004): pasted text arrives as one paste.
ReportFocus
Focus reports (mode 1004).
MouseCellMotion
Mouse clicks, wheel and drags (modes 1002 and 1006).
MouseAllMotion
Every mouse event, plain motion included (modes 1003 and 1006).
KeyboardEnhancements(u8)
xterm’s modifyOtherKeys level 2 and a kitty keyboard entry with these flags pushed on the terminal’s stack.
KeyboardFlags(u8)
New flags for the kitty keyboard entry already pushed by
TerminalMode::KeyboardEnhancements, set in place. Turning it
off does nothing: turn off KeyboardEnhancements instead.
AltScreen
The alternate screen (mode 1049), saving the main screen’s cursor.
NoAutowrap
Autowrap turned off (DECAWM, mode 7): on writes CSI ?7l, off
CSI ?7h. On while a program draws, so writing the last column
never wraps or scrolls.
UnicodeCore
Grapheme cluster widths (mode 2027), where the terminal has them.
SavedTitle
The window title saved on the terminal’s title stack (XTWINOPS 22 and 23): off clears the title, then pops the saved one back.
CursorStyle(u8)
A cursor shape (DECSCUSR 1 to 6); off is the terminal’s default.
ForegroundColor(Rgb)
The terminal’s default text colour (OSC 10); off resets it.
BackgroundColor(Rgb)
The terminal’s default background colour (OSC 11); off resets it.
CursorColor(Rgb)
The cursor’s colour (OSC 12); off resets it.
ProgressBar(ProgressBar)
A progress bar (OSC 9;4); off removes it.