From 12e8ae85dd5661c251178947ee5d32a381edb80d Mon Sep 17 00:00:00 2001 From: Brian Low Date: Fri, 13 Dec 2019 12:35:10 -0700 Subject: [PATCH] fix: Wrap prefix and suffix in shell-specific escape codes (#712) --- src/module.rs | 10 +++++----- 1 file 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 { 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::>(); - 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 }