Skip to content

Commit

Permalink
fix: on fast cwd change startup, don't render if the pwd is wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
forivall committed May 31, 2017
1 parent db64a78 commit 2848afb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pure.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ prompt_pure_async_vcs_info() {
vcs_info

local -A info
info[dir]=$PWD
info[top]=$vcs_info_msg_1_
info[branch]=$vcs_info_msg_0_
info[relative_path]=$vcs_info_msg_2_
Expand Down Expand Up @@ -396,10 +397,17 @@ prompt_pure_async_callback() {
# git directory, run the async refresh tasks
[[ -n $info[top] ]] && [[ -z $prompt_pure_vcs_info[top] ]] && prompt_pure_async_refresh

# always update branch and toplevel
prompt_pure_vcs_info[branch]=$info[branch]
prompt_pure_vcs_info[top]=$info[top]
prompt_pure_vcs_info[relative_path]=$info[relative_path]
# on some shell startups, this path can change between starting the job
# and finishing, before the prompt has been rendered once
if [[ $info[dir] = $PWD ]] ; then
# always update branch and toplevel
prompt_pure_vcs_info[branch]=$info[branch]
prompt_pure_vcs_info[top]=$info[top]
prompt_pure_vcs_info[relative_path]=$info[relative_path]
else
prompt_pure_vcs_info[pwd]=
prompt_pure_async_tasks
fi

prompt_pure_preprompt_render
;;
Expand Down

0 comments on commit 2848afb

Please sign in to comment.