///|
/// Enter raw mode: no echo, no line buffering, no signal keys, VT input.
///
/// Idempotent: repeated calls apply the same raw mode without overwriting the
/// saved initial terminal state.
pub async fn Tty::enter_raw_mode(self : Self) -> Unit {
backend_enter_raw_mode(self.backend)
}
///|
/// Leave raw mode and restore the terminal state saved when `Tty::open()` ran.
///
/// Idempotent and non-cancellable, so callers can restore raw mode directly in
/// `defer tty.leave_raw_mode()`.
pub async fn Tty::leave_raw_mode(self : Self) -> Unit nocancel {
backend_leave_raw_mode(self.backend)
}
///|
/// Run an async callback with raw mode enabled.
///
/// Raw mode is left on success, error, or cancellation.
pub async fn[T] Tty::with_raw_mode(self : Self, f : async () -> T) -> T {
self.enter_raw_mode()
defer self.leave_raw_mode()
f()
}