mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
enable env setting for prompt animation (#376)
* enable env setting for prompt animation * default to on * updated comment
This commit is contained in:
parent
c8b16c14d5
commit
6d58e2b51e
1 changed files with 13 additions and 0 deletions
13
src/main.rs
13
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::<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)),
|
||||
// ))
|
||||
|
|
Loading…
Reference in a new issue