From c1bf9fd8975fee8c65ce2333cbd7a8b77f4dbc83 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Mon, 11 Jul 2022 16:01:49 -0500 Subject: [PATCH] fixes ansi escape leakage from ill-behaved externals, again! (#6012) * this fixes ansi escape leakage from ill-behaved externals * cross-platform fix --- crates/nu-cli/src/prompt.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/nu-cli/src/prompt.rs b/crates/nu-cli/src/prompt.rs index fb843dcea8..d2340e0492 100644 --- a/crates/nu-cli/src/prompt.rs +++ b/crates/nu-cli/src/prompt.rs @@ -1,5 +1,6 @@ +#[cfg(windows)] +use nu_utils::enable_vt_processing; use reedline::DefaultPrompt; - use { reedline::{ Prompt, PromptEditMode, PromptHistorySearch, PromptHistorySearchStatus, PromptViMode, @@ -86,6 +87,11 @@ impl NushellPrompt { impl Prompt for NushellPrompt { fn render_prompt_left(&self) -> Cow { + #[cfg(windows)] + { + let _ = enable_vt_processing(); + } + if let Some(prompt_string) = &self.left_prompt_string { prompt_string.replace('\n', "\r\n").into() } else {