Skip to main content

SequenceConfig

Struct SequenceConfig 

Source
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

SettingDefaultRangeDescription
esc_seq_timeout250ms150-400msWindow for detecting Esc Esc
esc_debounce50ms0-100msMinimum wait before single Esc

§Environment Variables

VariableTypeDefaultDescription
FTUI_ESC_SEQ_TIMEOUT_MSu64250Esc Esc detection window
FTUI_ESC_DEBOUNCE_MSu6450Minimum Esc wait
FTUI_DISABLE_ESC_SEQboolfalseDisable 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=1

Fields§

§esc_seq_timeout: Duration

Maximum gap between Esc presses to detect Esc Esc sequence. Default: 250ms.

§esc_debounce: Duration

Minimum debounce before emitting single Esc. Default: 50ms.

§disable_sequences: bool

Whether to disable multi-key sequences entirely. When true, all Esc keys are immediately emitted as single Esc. Default: false.

Implementations§

Source§

impl SequenceConfig

Source

pub fn with_timeout(self, timeout: Duration) -> Self

Create a new config with custom timeout.

Source

pub fn with_debounce(self, debounce: Duration) -> Self

Create a new config with custom debounce.

Source

pub fn disable_sequences(self) -> Self

Disable sequence detection (treat all Esc as single).

Source

pub fn from_env() -> Self

Load config from environment variables.

Reads:

  • FTUI_ESC_SEQ_TIMEOUT_MS: Esc Esc detection window in milliseconds
  • FTUI_ESC_DEBOUNCE_MS: Minimum Esc wait in milliseconds
  • FTUI_DISABLE_ESC_SEQ: Set to “1” or “true” to disable sequences

Values are automatically clamped to valid ranges.

Source

pub fn validated(self) -> Self

Validate and clamp values to safe ranges.

Returns a new config with:

  • esc_seq_timeout clamped to 150-400ms
  • esc_debounce clamped to 0-100ms
  • esc_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);
Source

pub fn is_valid(&self) -> bool

Check if values are within valid ranges.

Trait Implementations§

Source§

impl Clone for SequenceConfig

Source§

fn clone(&self) -> SequenceConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SequenceConfig

Source§

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

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

impl Default for SequenceConfig

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
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.