Skip to main content

ProgramOptions

Struct ProgramOptions 

Source
pub struct ProgramOptions {
    pub bracketed_paste: bool,
    pub mouse: Option<MouseTracking>,
    pub prefer_grapheme_clusters: bool,
    pub prefer_in_band_resize: bool,
    pub prefer_synchronized_output: bool,
    pub query_backspace_mode: bool,
    pub query_foreground_color: bool,
    pub query_background_color: bool,
    pub query_cursor_color: bool,
    pub query_palette_colors: Vec<u8>,
    pub query_program_status: bool,
    pub legacy_keys: DecoderFlags,
}
Expand description

Options for session setup, capability queries, and mode preferences.

Program::init_with applies bracketed_paste, mouse, and legacy_keys. It stores the other options for later use.

The query_* fields select optional requests for Program::query_capabilities. Call that method to send the queries.

The prefer_* fields control mode adoption when Program::observe_event receives a report that confirms support for the corresponding mode.

Fields§

§bracketed_paste: bool

Enable bracketed paste at init. Defaults to true.

§mouse: Option<MouseTracking>

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

§prefer_grapheme_clusters: bool

Enable grapheme-cluster mode (DEC mode 2027) once the terminal reports it as available, so the terminal and the Screen measure text the same way. Defaults to true.

Nothing is emitted until that report arrives, which requires query_capabilities and a read loop. Set to false to keep per-code-point measurement, or call enable_grapheme_clusters yourself to opt in without waiting for a report.

§prefer_in_band_resize: bool

Enable in-band resize notifications (DEC mode 2048) once the terminal reports them as available, so resizes arrive on the event stream with pixel dimensions instead of through SIGWINCH. Defaults to true.

Nothing is emitted until that report arrives, which requires query_capabilities and a read loop. Set to false to stay on the signal path, or call enable_in_band_resize yourself to opt in without waiting for a report.

§prefer_synchronized_output: bool

Wrap each frame in synchronized-output markers (DEC mode 2026) once the terminal reports them as available, so a frame is presented in one piece instead of tearing. Defaults to true.

Unlike the two above this emits nothing of its own: synchronized output is a render property, so adopting it only tells the Screen to start bracketing frames. Set to false to keep frames unwrapped for the whole session. Screen::set_synchronized_output drives the same property directly, but the program cannot see a choice made there, so a call made before the terminal’s first report is still overridden by adoption; use this field when the decision has to hold from the start.

§query_backspace_mode: bool

Include Backarrow mode (DECBKM) in Program::query_capabilities.

Defaults to false. Initialization sends no queries. Program::observe_event applies recognized replies independently of this option, including replies to Program::request_mode.

§query_foreground_color: bool

Include the default foreground color in Program::query_capabilities.

Defaults to false.

§query_background_color: bool

Include the default background color in Program::query_capabilities.

Defaults to false.

§query_cursor_color: bool

Include the cursor color in Program::query_capabilities.

Defaults to false.

§query_palette_colors: Vec<u8>

Include these palette indices in Program::query_capabilities.

Defaults to an empty list. Queries follow the supplied order.

§query_program_status: bool

Include OSC 7501 support in Program::query_capabilities.

Defaults to false. Initialization sends no queries. Program::observe_event records support replies regardless of this option. Reports and record lifetime are independent of query selection.

§legacy_keys: DecoderFlags

How to read the ambiguous legacy keys.

Defaults to empty. LF reads as Ctrl+J; DecoderFlags::LF_IS_ENTER selects Enter instead. See DecoderFlags for all mappings. Use Program::set_decoder_flags to change the active flags after initialization.

Trait Implementations§

Source§

impl Clone for ProgramOptions

Source§

fn clone(&self) -> ProgramOptions

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 ProgramOptions

Source§

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

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

impl Default for ProgramOptions

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
§

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

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.