fixes ansi escape leakage from ill-behaved externals, again! (#6012)

* this fixes ansi escape leakage from ill-behaved externals

* cross-platform fix
This commit is contained in:
Darren Schroeder 2022-07-11 16:01:49 -05:00 committed by GitHub
parent f3036b8cfd
commit c1bf9fd897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<str> {
#[cfg(windows)]
{
let _ = enable_vt_processing();
}
if let Some(prompt_string) = &self.left_prompt_string {
prompt_string.replace('\n', "\r\n").into()
} else {