pub struct ActionConfig {
pub sequence_config: SequenceConfig,
pub ctrl_c_idle_action: CtrlCIdleAction,
}Expand description
Configuration for action mapping behavior.
This struct combines sequence detection settings with keybinding behavior configuration. It controls how keys like Ctrl+C, Ctrl+D, Esc, and Esc Esc are interpreted based on application state.
§Environment Variables
| Variable | Type | Default | Description |
|---|---|---|---|
FTUI_CTRL_C_IDLE_ACTION | string | “quit” | Action when Ctrl+C in idle state |
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 Esc Esc sequences |
§Example: Configure via environment
# Make Ctrl+C do nothing when idle (instead of quit)
export FTUI_CTRL_C_IDLE_ACTION=noop
# Or make it beep
export FTUI_CTRL_C_IDLE_ACTION=bell
# Faster double-Esc detection
export FTUI_ESC_SEQ_TIMEOUT_MS=200§Example: Configure in code
use ftui_core::keybinding::{ActionConfig, CtrlCIdleAction, SequenceConfig};
use std::time::Duration;
let config = ActionConfig::default()
.with_ctrl_c_idle(CtrlCIdleAction::Bell)
.with_sequence_config(
SequenceConfig::default()
.with_timeout(Duration::from_millis(200))
);Fields§
§sequence_config: SequenceConfigSequence detection configuration (timeouts, debounce, disable flag).
ctrl_c_idle_action: CtrlCIdleActionAction when Ctrl+C pressed with empty input and no task.
Quit(default): Exit the applicationNoop: Do nothingBell: Emit terminal bell
Implementations§
Source§impl ActionConfig
impl ActionConfig
Sourcepub fn with_sequence_config(self, config: SequenceConfig) -> Self
pub fn with_sequence_config(self, config: SequenceConfig) -> Self
Create config with custom sequence settings.
Sourcepub fn with_ctrl_c_idle(self, action: CtrlCIdleAction) -> Self
pub fn with_ctrl_c_idle(self, action: CtrlCIdleAction) -> Self
Set Ctrl+C idle action.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Load config from environment variables.
Reads:
FTUI_CTRL_C_IDLE_ACTION: “quit”, “noop”, or “bell”- Plus all environment variables from
SequenceConfig::from_env
Sourcepub fn validated(self) -> Self
pub fn validated(self) -> Self
Validate and return a config with clamped sequence values.
Delegates to SequenceConfig::validated for timing bounds.
Trait Implementations§
Source§impl Clone for ActionConfig
impl Clone for ActionConfig
Source§fn clone(&self) -> ActionConfig
fn clone(&self) -> ActionConfig
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 ActionConfig
impl Debug for ActionConfig
Auto Trait Implementations§
impl Freeze for ActionConfig
impl RefUnwindSafe for ActionConfig
impl Send for ActionConfig
impl Sync for ActionConfig
impl Unpin for ActionConfig
impl UnwindSafe for ActionConfig
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