fix: escape text segments in meta variables (#3563)

This commit is contained in:
David Knaack 2022-05-27 19:36:37 +02:00 committed by GitHub
parent 7c06520f8f
commit 7d31bac1cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,