fix: Wrap prefix and suffix in shell-specific escape codes (#712)
This commit is contained in:
parent
7ab473c88c
commit
12e8ae85dd
|
@ -121,21 +121,21 @@ impl<'a> Module<'a> {
|
||||||
/// `ANSIStrings()` to optimize ANSI codes
|
/// `ANSIStrings()` to optimize ANSI codes
|
||||||
pub fn ansi_strings(&self) -> Vec<ANSIString> {
|
pub fn ansi_strings(&self) -> Vec<ANSIString> {
|
||||||
let shell = std::env::var("STARSHIP_SHELL").unwrap_or_default();
|
let shell = std::env::var("STARSHIP_SHELL").unwrap_or_default();
|
||||||
let ansi_strings = self
|
let mut ansi_strings = self
|
||||||
.segments
|
.segments
|
||||||
.iter()
|
.iter()
|
||||||
.map(Segment::ansi_string)
|
.map(Segment::ansi_string)
|
||||||
.collect::<Vec<ANSIString>>();
|
.collect::<Vec<ANSIString>>();
|
||||||
|
|
||||||
let mut ansi_strings = match shell.as_str() {
|
ansi_strings.insert(0, self.prefix.ansi_string());
|
||||||
|
ansi_strings.push(self.suffix.ansi_string());
|
||||||
|
|
||||||
|
ansi_strings = match shell.as_str() {
|
||||||
"bash" => ansi_strings_modified(ansi_strings, shell),
|
"bash" => ansi_strings_modified(ansi_strings, shell),
|
||||||
"zsh" => ansi_strings_modified(ansi_strings, shell),
|
"zsh" => ansi_strings_modified(ansi_strings, shell),
|
||||||
_ => ansi_strings,
|
_ => ansi_strings,
|
||||||
};
|
};
|
||||||
|
|
||||||
ansi_strings.insert(0, self.prefix.ansi_string());
|
|
||||||
ansi_strings.push(self.suffix.ansi_string());
|
|
||||||
|
|
||||||
ansi_strings
|
ansi_strings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue