diff .shell.d/99.prompt.zsh @ 518:62e62b885540

merge
author Augie Fackler <raf@durin42.com>
date Wed, 08 Dec 2021 12:06:45 -0500
parents 7e8603e0a822
children
line wrap: on
line diff
--- a/.shell.d/99.prompt.zsh
+++ b/.shell.d/99.prompt.zsh
@@ -28,10 +28,19 @@ function right_side_prompt() {
     fi
 }
 
+function _init_async() {
+    async
+    async_stop_worker 'durin42_prompt' || true
+    async_start_worker durin42_prompt -u -n
+    async_register_callback durin42_prompt right_prompt_results
+}
+
 function right_prompt_results() {
     if [ $2 = 0 ] ; then
         rps_branch=$3
         zle && zle reset-prompt
+     else
+         _init_async
      fi
 }
 
@@ -73,10 +82,8 @@ if [[ $TERM == "dumb" ]]; then  # in ema
     PS1='$ '
     RPS1=''
 else
-    autoload -Uz async && async
-    async_start_worker durin42_prompt -u -n
-    async_register_callback durin42_prompt right_prompt_results
-
+    autoload -Uz async
+    _init_async
     function precmd () {
         rps_branch="$(date '+%D %H:%M')"
         async_job durin42_prompt right_side_prompt $PWD