From 7d31bac1cc3f39bd02f2e188e69283c566b816ed Mon Sep 17 00:00:00 2001 From: David Knaack Date: Fri, 27 May 2022 19:36:37 +0200 Subject: [PATCH] fix: escape text segments in meta variables (#3563) --- src/formatter/string_formatter.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/formatter/string_formatter.rs b/src/formatter/string_formatter.rs index ab895b59..c680f59f 100644 --- a/src/formatter/string_formatter.rs +++ b/src/formatter/string_formatter.rs @@ -292,7 +292,16 @@ impl<'a> StringFormatter<'a> { .into_iter() .map(|el| { match el { - FormatElement::Text(text) => Ok(Segment::from_text(style, text)), + FormatElement::Text(text) => Ok(Segment::from_text( + style, + shell_prompt_escape( + text, + match context { + None => Shell::Unknown, + Some(c) => c.shell, + }, + ), + )), FormatElement::TextGroup(textgroup) => { let textgroup = TextGroup { format: textgroup.format,