pub enum CursorSaveStrategy {
Dec,
Ansi,
Emulated,
}Expand description
Strategy for cursor save/restore operations.
Different terminals support different cursor save/restore mechanisms. This enum allows selecting the appropriate strategy based on terminal capabilities.
Variants§
Dec
DEC save/restore (ESC 7 / ESC 8).
The preferred strategy for most terminals. Saves cursor position, attributes, and character set.
Ansi
ANSI save/restore (CSI s / CSI u).
Fallback for terminals where DEC sequences have issues. Only saves cursor position, not attributes.
Emulated
Emulated save/restore using position tracking and CUP.
Last resort that works on any terminal supporting cursor positioning. Requires the caller to provide current position when saving.
Implementations§
Source§impl CursorSaveStrategy
impl CursorSaveStrategy
Sourcepub fn detect(caps: &TerminalCapabilities) -> Self
pub fn detect(caps: &TerminalCapabilities) -> Self
Detect the best strategy for the current environment.
Uses terminal capabilities to choose the most reliable strategy.
Sourcepub const fn save_sequence(&self) -> Option<&'static [u8]>
pub const fn save_sequence(&self) -> Option<&'static [u8]>
Get the save escape sequence for this strategy.
Returns None for Emulated strategy (no escape sequence needed).
Sourcepub const fn restore_sequence(&self) -> Option<&'static [u8]>
pub const fn restore_sequence(&self) -> Option<&'static [u8]>
Get the restore escape sequence for this strategy.
Returns None for Emulated strategy (uses CUP instead).
Trait Implementations§
Source§impl Clone for CursorSaveStrategy
impl Clone for CursorSaveStrategy
Source§fn clone(&self) -> CursorSaveStrategy
fn clone(&self) -> CursorSaveStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more