mirror of https://github.com/aristocratos/bashtop
Changes to UTF-8 detection function
parent
37c709c49d
commit
ae9a066dc1
20
bashtop
20
bashtop
|
@ -59,17 +59,27 @@ shopt -qs extglob globasciiranges globstar
|
|||
|
||||
#* Check for UTF-8 locale and set LANG variable if not set
|
||||
if [[ ! $LANG =~ UTF-8 ]]; then
|
||||
if [[ -n $LANG && ${LANG::1} != "C" ]]; then old_lang="${LANG%.*}"; fi
|
||||
for set_lang in $(locale -a); do
|
||||
if [[ $set_lang =~ utf8|UTF-8 ]]; then
|
||||
declare -x LANG="${set_lang/utf8/UTF-8}"
|
||||
set_lang="found"
|
||||
break
|
||||
if [[ -n $old_lang && $set_lang =~ ${old_lang} ]]; then
|
||||
declare -x LANG="${set_lang/utf8/UTF-8}"
|
||||
set_lang_search="found"
|
||||
break
|
||||
elif [[ -z $first_lang ]]; then
|
||||
first_lang="${set_lang/utf8/UTF-8}"
|
||||
set_lang_first="found"
|
||||
fi
|
||||
if [[ -z $old_lang ]]; then break; fi
|
||||
fi
|
||||
done
|
||||
if [[ $set_lang != "found" ]]; then
|
||||
if [[ $set_lang_search != "found" && $set_lang_first != "found" ]]; then
|
||||
echo "ERROR: No UTF-8 locale found!"
|
||||
exit 1
|
||||
elif [[ $set_lang_search != "found" ]]; then
|
||||
declare -x LANG="${first_lang/utf8/UTF-8}"
|
||||
fi
|
||||
unset old_lang set_lang first_lang set_lang_search set_lang_first
|
||||
fi
|
||||
|
||||
declare -a banner banner_colors
|
||||
|
@ -2701,7 +2711,7 @@ for p in sorted(psutil.process_iter(['pid', 'name', 'cmdline', 'num_threads', 'u
|
|||
EOF
|
||||
)
|
||||
|
||||
if [[ -z ${proc_array[0]} ]]; then return; fi
|
||||
if [[ -z ${proc_array[0]} ]]; then unset 'old_procs[@]'; return; fi
|
||||
proc_array[0]="${proc_array[0]/ ${selected}/${symbol}${selected}}"
|
||||
proc[pages]=$(( (${#proc_array[@]}-1)/(height-3)+1 ))
|
||||
if ((proc[page]>proc[pages])); then proc[page]=${proc[pages]}; fi
|
||||
|
|
Loading…
Reference in New Issue