From b28dbd7c152a964d611579af406eaa94ea35a73a Mon Sep 17 00:00:00 2001 From: BlackNet Dev Date: Thu, 14 May 2020 22:47:49 +0200 Subject: [PATCH] Fix Exustion Time --- rainbow.zsh-theme | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rainbow.zsh-theme b/rainbow.zsh-theme index de47b9f..a055b62 100644 --- a/rainbow.zsh-theme +++ b/rainbow.zsh-theme @@ -4,6 +4,7 @@ # Fork from shellder # +RAINBOW_KEEP_PATH=0 # # Segment drawing # @@ -458,6 +459,14 @@ preexec() { timer=$SECONDS } +precmd() { + if [ $timer ]; then + local now=$SECONDS + elapsed=$(($now-$timer)) + unset timer + fi +} + prompt_error() { if [ $RETVAL -ne 0 ] && [ "$preexec_called" = 1 ]; then prompt_segment_right $RAINBOW_STATUS_ERROR_BG $RAINBOW_STATUS_ERROR_FG '✘ %? ' @@ -478,11 +487,7 @@ prompt_status() { } prompt_excursion_time() { - if [ $timer ]; then - now=$SECONDS - elapsed=$(($now-$timer)) - unset $timer; - unset $now; + if [ $elapsed ]; then hours=$(($elapsed/3600)) min=$(($elapsed/60))