diff options
author | Brian Low <github@brianlow.com> | 2019-12-13 12:35:10 -0700 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-12-13 14:35:10 -0500 |
commit | 12e8ae85dd5661c251178947ee5d32a381edb80d (patch) | |
tree | 4321e0f43e4d19f712c7afbe259d390081a458b8 /src | |
parent | 7ab473c88cbbf204af8375bef768f83a2b04089f (diff) |
fix: Wrap prefix and suffix in shell-specific escape codes (#712)
Diffstat (limited to 'src')
-rw-r--r-- | src/module.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/module.rs b/src/module.rs index 873c2e1ad..0643631ce 100644 --- a/src/module.rs +++ b/src/module.rs @@ -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 } |