1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-24 21:57:41 +00:00

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() .into_iter()
.map(|el| { .map(|el| {
match 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) => { FormatElement::TextGroup(textgroup) => {
let textgroup = TextGroup { let textgroup = TextGroup {
format: textgroup.format, format: textgroup.format,