From eec52f6845e2ca32435d72cd69dd21048c37c70b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 11 Jan 2022 19:41:57 -0500 Subject: add git info to the prompt --- src/shell/event.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/shell/event.rs') diff --git a/src/shell/event.rs b/src/shell/event.rs index 9885821..9157c5e 100644 --- a/src/shell/event.rs +++ b/src/shell/event.rs @@ -6,6 +6,7 @@ pub enum Event { PtyClose, ChildRunPipeline(usize, (usize, usize)), ChildSuspend(usize), + GitInfo(Option), ClockTimer, } @@ -59,6 +60,7 @@ struct Pending { pty_close: bool, child_run_pipeline: std::collections::VecDeque<(usize, (usize, usize))>, child_suspend: std::collections::VecDeque, + git_info: Option>, clock_timer: bool, done: bool, } @@ -76,6 +78,7 @@ impl Pending { || self.pty_close || !self.child_run_pipeline.is_empty() || !self.child_suspend.is_empty() + || self.git_info.is_some() || self.clock_timer } @@ -99,6 +102,9 @@ impl Pending { if let Some(idx) = self.child_suspend.pop_front() { return Some(Event::ChildSuspend(idx)); } + if let Some(info) = self.git_info.take() { + return Some(Event::GitInfo(info)); + } if self.clock_timer { self.clock_timer = false; return Some(Event::ClockTimer); @@ -125,6 +131,7 @@ impl Pending { Some(Event::ChildSuspend(idx)) => { self.child_suspend.push_back(idx); } + Some(Event::GitInfo(info)) => self.git_info = Some(info), Some(Event::ClockTimer) => self.clock_timer = true, None => self.done = true, } -- cgit v1.2.3-54-g00ecf