Skip to main content

should_defer_for_typing

Function should_defer_for_typing 

Source
pub fn should_defer_for_typing(
    enabled: bool,
    idle_secs: u64,
    grace_secs: u64,
    deferred_since: Option<Instant>,
    max_deferral_secs: u64,
    now: Instant,
) -> bool
Expand description

Decide whether a due break should be delayed because the user is mid-keystroke. Returns true while we should keep waiting and false once either the user has paused typing OR the deferral cap has been reached (so we don’t postpone indefinitely).

deferred_since is the instant the current defer-streak started, or None if this is the first tick of the streak.