enable env setting for prompt animation (#376)

* enable env setting for prompt animation

* default to on

* updated comment
This commit is contained in:
Darren Schroeder 2021-11-28 15:09:52 -06:00 committed by GitHub
parent c8b16c14d5
commit 6d58e2b51e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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::<u64>() {
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)),
// ))