Improve behaviour on platforms without locale (ie Termux)

This commit is contained in:
Adam Goldsmith 2023-03-04 23:52:29 -05:00
parent f7ebd0e09d
commit e5f226f93a

View File

@ -4,17 +4,21 @@
setopt nopromptbang promptcr promptpercent promptsp promptsubst
if [[ $(locale charmap) != UTF-8 || "$TERM" == linux ]]
if [[ "$TERM" != linux && \
("$LANG" =~ UTF-?8$ || \
"$(! (which locale > /dev/null) || locale charmap)" == UTF-8) ]]
then
ERROR_CHAR='<'
DIRTY_CHAR='^'
STASH_CHAR='≡' # ASCII 240
PREFIX='$'
else
# assume we have UTF8 support
ERROR_CHAR='⏎'
DIRTY_CHAR="∆" # U+2206
STASH_CHAR='📚' # U+1F4DA
PREFIX='❱' # U+2771
else
# fallback to ASCII
ERROR_CHAR='<'
DIRTY_CHAR='^'
STASH_CHAR='≡' # ASCII 240
PREFIX='$'
fi
typeset -gA git_info