pub struct SequenceConfig {
pub esc_seq_timeout: Duration,
pub esc_debounce: Duration,
pub disable_sequences: bool,
}Expand description
Configuration for the sequence detector.
§Timing Defaults
| Setting | Default | Range | Description |
|---|---|---|---|
esc_seq_timeout | 250ms | 150-400ms | Window for detecting Esc Esc |
esc_debounce | 50ms | 0-100ms | Minimum wait before single Esc |
§Environment Variables
| Variable | Type | Default | Description |
|---|---|---|---|
FTUI_ESC_SEQ_TIMEOUT_MS | u64 | 250 | Esc Esc detection window |
FTUI_ESC_DEBOUNCE_MS | u64 | 50 | Minimum Esc wait |
FTUI_DISABLE_ESC_SEQ | bool | false | Disable multi-key sequences |
§Example
# Faster double-tap detection (200ms window)
export FTUI_ESC_SEQ_TIMEOUT_MS=200
# Disable Esc Esc entirely (for strict terminals)
export FTUI_DISABLE_ESC_SEQ=1Fields§
§esc_seq_timeout: DurationMaximum gap between Esc presses to detect Esc Esc sequence. Default: 250ms.
esc_debounce: DurationMinimum debounce before emitting single Esc. Default: 50ms.
disable_sequences: boolWhether to disable multi-key sequences entirely. When true, all Esc keys are immediately emitted as single Esc. Default: false.
Implementations§
Source§impl SequenceConfig
impl SequenceConfig
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Create a new config with custom timeout.
Sourcepub fn with_debounce(self, debounce: Duration) -> Self
pub fn with_debounce(self, debounce: Duration) -> Self
Create a new config with custom debounce.
Sourcepub fn disable_sequences(self) -> Self
pub fn disable_sequences(self) -> Self
Disable sequence detection (treat all Esc as single).
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Load config from environment variables.
Reads:
FTUI_ESC_SEQ_TIMEOUT_MS: Esc Esc detection window in millisecondsFTUI_ESC_DEBOUNCE_MS: Minimum Esc wait in millisecondsFTUI_DISABLE_ESC_SEQ: Set to “1” or “true” to disable sequences
Values are automatically clamped to valid ranges.
Sourcepub fn validated(self) -> Self
pub fn validated(self) -> Self
Validate and clamp values to safe ranges.
Returns a new config with:
esc_seq_timeoutclamped to 150-400msesc_debounceclamped to 0-100msesc_debounce<=esc_seq_timeout(debounce is capped at timeout)
§Example
use ftui_core::keybinding::SequenceConfig;
use std::time::Duration;
let config = SequenceConfig::default()
.with_timeout(Duration::from_millis(1000)) // Too high
.validated();
// Clamped to max 400ms
assert_eq!(config.esc_seq_timeout.as_millis(), 400);Trait Implementations§
Source§impl Clone for SequenceConfig
impl Clone for SequenceConfig
Source§fn clone(&self) -> SequenceConfig
fn clone(&self) -> SequenceConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SequenceConfig
impl Debug for SequenceConfig
Auto Trait Implementations§
impl Freeze for SequenceConfig
impl RefUnwindSafe for SequenceConfig
impl Send for SequenceConfig
impl Sync for SequenceConfig
impl Unpin for SequenceConfig
impl UnwindSafe for SequenceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more