Struct mortal::terminal::PrepareConfig
source · [−]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
sourceimpl Clone for PrepareConfig
impl Clone for PrepareConfig
sourcefn clone(&self) -> PrepareConfig
fn clone(&self) -> PrepareConfig
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PrepareConfig
impl Debug for PrepareConfig
sourceimpl Default for PrepareConfig
impl Default for PrepareConfig
sourcefn default() -> PrepareConfig
fn default() -> PrepareConfig
Returns the “default value” for a type. Read more
impl Copy for PrepareConfig
Auto Trait Implementations
impl RefUnwindSafe for PrepareConfig
impl Send for PrepareConfig
impl Sync for PrepareConfig
impl Unpin for PrepareConfig
impl UnwindSafe for PrepareConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more