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

fix: Wrap prefix and suffix in shell-specific escape codes (#712)

This commit is contained in:
Brian Low 2019-12-13 12:35:10 -07:00 committed by Matan Kushner
parent 7ab473c88c
commit 12e8ae85dd

View File

@ -121,21 +121,21 @@ impl<'a> Module<'a> {
/// `ANSIStrings()` to optimize ANSI codes
pub fn ansi_strings(&self) -> Vec<ANSIString> {
let shell = std::env::var("STARSHIP_SHELL").unwrap_or_default();
let ansi_strings = self
let mut ansi_strings = self
.segments
.iter()
.map(Segment::ansi_string)
.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),
"zsh" => ansi_strings_modified(ansi_strings, shell),
_ => ansi_strings,
};
ansi_strings.insert(0, self.prefix.ansi_string());
ansi_strings.push(self.suffix.ansi_string());
ansi_strings
}