1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-18 02:20:09 +00:00

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}"
}
# Use async version if setting is enabled, or undefined but zsh version is at least 5.0.6
# https://github.com/ohmyzsh/ohmyzsh/issues/12331#issuecomment-2059460268
if zstyle -t ':omz:alpha:lib:git' async-prompt \
|| { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then
# Use async version if setting is enabled or undefined
if zstyle -T ':omz:alpha:lib:git' async-prompt; then
function git_prompt_info() {
setopt localoptions noksharrays
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]" ]]; then
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]"
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
fi
}
function git_prompt_status() {
setopt localoptions noksharrays
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]"
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
fi
}