fix: resolve multiple bugs across git prompt, colorize, and globalias plugins

This commit is contained in:
Codebuff Contributor 2026-05-16 06:16:40 +06:00
commit c5fb48da9d
3 changed files with 14 additions and 5 deletions

View file

@ -42,6 +42,10 @@ function _omz_git_prompt_info() {
function _omz_git_prompt_status() {
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
# Use C locale for regex operations to avoid "illegal byte sequence" errors
# when branch names contain non-ASCII characters (e.g. Chinese, Japanese)
local LC_ALL=C
# Maps a git status prefix to an internal constant
# This cannot use the prompt constants, as they may be empty
local -A prefix_constant_map
@ -162,13 +166,13 @@ if zstyle -t ':omz:alpha:lib:git' async-prompt \
# or any of the other prompt variables
function _defer_async_git_register() {
# Check if git_prompt_info is used in a prompt variable
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
case "${PS1:-}:${PS2:-}:${PS3:-}:${PS4:-}:${RPROMPT:-}:${RPS1:-}:${RPS2:-}:${RPS3:-}:${RPS4:-}" in
*(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
_omz_register_handler _omz_git_prompt_info
;;
esac
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
case "${PS1:-}:${PS2:-}:${PS3:-}:${PS4:-}:${RPROMPT:-}:${RPS1:-}:${RPS2:-}:${RPS3:-}:${RPS4:-}" in
*(\$\(git_prompt_status\)|\`git_prompt_status\`)*)
_omz_register_handler _omz_git_prompt_status
;;