mirror of
https://github.com/starship/starship.git
synced 2024-12-24 16:18:53 +01:00
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
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user