From 6d58e2b51eb130761d39a20cec1e9143e7381ea4 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sun, 28 Nov 2021 15:09:52 -0600 Subject: [PATCH] enable env setting for prompt animation (#376) * enable env setting for prompt animation * default to on * updated comment --- src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.rs b/src/main.rs index 0cfe93c6b7..9bda4f8b75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -230,6 +230,18 @@ fn main() -> Result<()> { //Reset the ctrl-c handler ctrlc.store(false, Ordering::SeqCst); + // Get animation milliseconds every loop, if not set, the animation + // is defaulted to 1 second. If set to some non-number value, + // like "OFF", then the animation is disabled. If set to some number + // like "5000" then the animation will run at 5 seconds. + let animate_ms = match std::env::var("EQ_PROMPT_ANIMATE_MS") { + Ok(ms_str) => match ms_str.parse::() { + Ok(ms_int) => Some(ms_int), + _ => None, + }, + _ => Some(1000), + }; + let line_editor = Reedline::create() .into_diagnostic()? .with_completion_action_handler(Box::new(FuzzyCompletion { @@ -238,6 +250,7 @@ fn main() -> Result<()> { .with_highlighter(Box::new(NuHighlighter { engine_state: engine_state.clone(), })) + .with_repaint(animate_ms) // .with_completion_action_handler(Box::new( // ListCompletionHandler::default().with_completer(Box::new(completer)), // ))