chore(async): reenable async prompt by default on zsh < 5.0.6 (#12358)

Fixes #12331
This commit is contained in:
Marc Cornellà 2024-04-19 18:47:21 +02:00 committed by Carlo Sala
parent f78c6b90fc
commit 0c80a063c3

View File

@ -39,21 +39,17 @@ function _omz_git_prompt_info() {
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
} }
# Use async version if setting is enabled, or undefined but zsh version is at least 5.0.6 # Use async version if setting is enabled or undefined
# https://github.com/ohmyzsh/ohmyzsh/issues/12331#issuecomment-2059460268 if zstyle -T ':omz:alpha:lib:git' async-prompt; then
if zstyle -t ':omz:alpha:lib:git' async-prompt \
|| { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then
function git_prompt_info() { function git_prompt_info() {
setopt localoptions noksharrays if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]" ]]; then echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]"
fi fi
} }
function git_prompt_status() { function git_prompt_status() {
setopt localoptions noksharrays if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]"
fi fi
} }