Skip to main content

ScreenOptions

Struct ScreenOptions 

Source
pub struct ScreenOptions {
    pub bracketed_paste: bool,
    pub keyboard_enhancements: KittyKeyboardFlags,
    pub prefer_in_band_resize: bool,
    pub request_pixel_size_on_resize: bool,
    pub mouse: Option<MouseTracking>,
    pub query_capabilities: bool,
    pub query_drain_timeout: Duration,
}
Expand description

Desired default behaviors applied by Screen::init_with.

Always-on defaults (e.g. bracketed_paste) take effect at init regardless of capability detection. Discovery-driven defaults are applied once the terminating Primary DA reply confirms the detected Capabilities; if the terminal never answers, only the always-on defaults are in effect.

Most fields are app-level toggles you set to taste. Two are low-level transport knobs that most applications should leave at their defaults: request_pixel_size_on_resize (when to re-query the window pixel size) and query_drain_timeout (how long teardown waits for capability replies). They exist for unusual terminals and latency-sensitive teardown, not everyday configuration.

Fields§

§bracketed_paste: bool

Enable bracketed paste at init. Defaults to true.

§keyboard_enhancements: KittyKeyboardFlags

Desired Kitty keyboard enhancements. When non-empty, the screen enables as many as the terminal supports, preferring the Kitty protocol and falling back to xterm modifyOtherKeys when Kitty is unavailable. Defaults to KittyKeyboardFlags::DISAMBIGUATE_ESCAPE_CODES.

§prefer_in_band_resize: bool

Prefer in-band resize reports over the SIGWINCH path when the terminal supports them. Defaults to true.

§request_pixel_size_on_resize: bool

Request the window pixel size (XTWINOPS CSI 14 t) whenever a resize is observed that does not itself carry pixel dimensions, keeping window_pixels current on platforms that report cell sizes only. Skipped while in-band resize is active, since those reports already carry pixel dimensions. Defaults to true on Windows (whose console resize events carry no pixel size) and false elsewhere, where resize reports already include pixel dimensions.

§mouse: Option<MouseTracking>

Enable mouse tracking at init with the given MouseTracking extras (see Screen::enable_mouse). The request is emitted unconditionally; terminals ignore modes they do not support and degrade gracefully. Defaults to None (mouse tracking off).

§query_capabilities: bool

Send terminal capability queries during init.

When true (the default), init_with probes the terminal for its keyboard, color, and feature support and waits for the replies, populating capabilities. Set it to false for output-only programs that draw frames and never read input: init_with still enters raw mode, sizes the managed area, and applies the environment-detected color profile, but emits no query escapes and waits for no replies, so the terminal is never probed and capabilities stays at its env-derived defaults.

§query_drain_timeout: Duration

How long teardown (finish / pause) will wait for the capability-query replies to arrive before restoring the terminal, so they cannot leak to the shell (or a child after pause) as stray input.

The wait is measured from when init sent the queries and ends early as soon as the terminating Primary DA reply lands, so a responsive terminal costs only its round-trip and a long-running app pays nothing (the replies are consumed by the event loop, and the budget has long since elapsed). Only the rare path that tears down before the replies were consumed waits here. Defaults to 300ms.

Trait Implementations§

Source§

impl Clone for ScreenOptions

Source§

fn clone(&self) -> ScreenOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScreenOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScreenOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,