pub struct PrepareConfig {
    pub block_signals: bool,
    pub enable_control_flow: bool,
    pub enable_keypad: bool,
    pub enable_mouse: bool,
    pub always_track_motion: bool,
    pub report_signals: SignalSet,
}
Expand description

Configures a Terminal or Screen instance to read special input.

This struct implements the Default trait, providing default values for all options.

To override only some options while using the remaining default values, one may use the following construct:

use mortal::{Terminal, PrepareConfig};

let term = Terminal::new()?;

let state = term.prepare(PrepareConfig{
    enable_keypad: false,
    enable_mouse: true,
    .. PrepareConfig::default()
})?;

// ...

term.restore(state)?;

Fields

block_signals: bool

Whether to block signals that result from user input.

If true, e.g. when the user presses Ctrl-C, Key(Ctrl('c')) will be read instead of Signal(Interrupt).

The default is true.

enable_control_flow: bool

Whether to enable control flow characters.

The default is false.

Notes

On Unix, when this setting is enabled, Ctrl-S and Ctrl-Q will stop and start, respectively, terminal input from being processed.

On Windows, this setting has no effect.

enable_keypad: bool

If true, the terminal will be configured to generate events from function keys.

The default is true.

Notes

On Unix, this may be required to receive events for arrow keys.

On Windows, this setting has no effect.

enable_mouse: bool

If true, the terminal will be configured to generate events for mouse input, if supported, and read_event may return Event::Mouse(_).

The default is false.

Notes

This setting may not be supported on all systems.

always_track_motion: bool

If true, mouse motion events will always be reported. If false, such events will only be reported while at least one mouse button is pressed.

Mouse events are only reported if enable_mouse is true.

The default is false.

report_signals: SignalSet

For each signal in the set, a signal handler will intercept the signal and report it by returning an Event::Signal(_) value.

block_signals must be false for any of these signals to be received.

By default, no signals are reported.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.