diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2020-01-19 12:38:16 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2020-01-19 12:38:16 +0300 |
commit | 0ae338dde1d9e0b52ee724351cda2773a2846f33 (patch) | |
tree | a17d7f616fa3e6df3fc8c6211fa9213d97af4864 /internal/p10k.zsh | |
parent | e65f05d7be7f6effaabfd6064c73b04b257b0237 (diff) |
make sure pwd and IFS are initialized when running *_compute
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r-- | internal/p10k.zsh | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index a810af8b..e3548fee 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1049,7 +1049,7 @@ _p9k_prompt_disk_usage_compute() { } _p9k_prompt_disk_usage_async() { - (( $+commands[df] )) && REPLY=${${=${(f)"$(df -P . 2>/dev/null)"}[2]}[5]%%%} + (( $+commands[df] )) && REPLY=${${=${(f)"$(df -P $1 2>/dev/null)"}[2]}[5]%%%} } _p9k_prompt_disk_usage_sync() { @@ -4035,8 +4035,14 @@ function _p9k_build_instant_segment() { function _p9k_set_prompt() { local ifs=$IFS IFS=$' \t\n\0' - _p9k__pwd=${(%):-%/} - _p9k__pwd_a=${_p9k__pwd:A} + + if [[ $_p9k_refresh_reason == precmd ]]; then + local f_init f_compute + for f_init f_compute in "${_p9k_async_segments[@]}"; do + $f_compute + done + fi + PROMPT= RPROMPT= [[ $1 == instant_ ]] || PROMPT+='${$((_p9k_on_expand()))+}' @@ -4846,10 +4852,8 @@ _p9k_precmd_impl() { (( ++_p9k__prompt_idx )) fi - local f_init f_compute - for f_init f_compute in "${_p9k_async_segments[@]}"; do - $f_compute - done + _p9k__pwd=${(%):-%/} + _p9k__pwd_a=${_p9k__pwd:A} _p9k_refresh_reason=precmd _p9k_set_prompt |