From a63d404c2661988e3c254cb023f5612fa9f47ff2 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Mon, 19 Aug 2024 23:12:22 +0200 Subject: [PATCH] added reset at the end of the prompt --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/colors.rs | 2 ++ src/main.rs | 5 +++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de685cc..408a25d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,7 +35,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "fast-git-prompt" -version = "0.2.1" +version = "0.2.2" dependencies = [ "git2", "regex", diff --git a/Cargo.toml b/Cargo.toml index 85ff288..1a2373c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fast-git-prompt" -version = "0.2.1" +version = "0.2.2" description = "A fast git prompt for zsh and bash." license = "MIT" repository = "https://github.com/MasterGordon/fast-git-prompt" diff --git a/src/colors.rs b/src/colors.rs index f2b3db7..2767aa9 100644 --- a/src/colors.rs +++ b/src/colors.rs @@ -20,6 +20,7 @@ pub enum Color { BrightMagenta, BrightCyan, BrightWhite, + Reset, } const ESC: &str = "\x1b"; @@ -54,6 +55,7 @@ impl Ansi for Color { Color::BrightMagenta => format!("{}[95m", ESC), Color::BrightCyan => format!("{}[96m", ESC), Color::BrightWhite => format!("{}[97m", ESC), + Color::Reset => format!("{}[0m", ESC), } } } diff --git a/src/main.rs b/src/main.rs index d7efa54..6a2a622 100644 --- a/src/main.rs +++ b/src/main.rs @@ -136,8 +136,9 @@ fn main() { prompt = prompt.drain(..).filter(|s| !s.is_empty()).collect(); print!( - "{}{}", + "{}{}{}", color(config.base_color), - prompt.join(format!("{} ", color(config.base_color)).as_str()) + prompt.join(format!("{} ", color(config.base_color)).as_str()), + color(Some(Color::Reset)) ); }