[][src]Struct mortal::terminal::PrepareConfig

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,
}

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

impl Clone for PrepareConfig[src]

impl Copy for PrepareConfig[src]

impl Debug for PrepareConfig[src]

impl Default for PrepareConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.