fix(dotmatrix): correct sudo handling

This commit is contained in:
Johann Dreo 2022-10-03 09:30:52 +02:00
commit 37bd32cf10

View file

@ -485,12 +485,13 @@ _lp_dotmatrix_theme_prompt() {
__dotmatrix_make_sep_plug ${DOTMATRIX_COLOR_MARK[@]+"${DOTMATRIX_COLOR_MARK[@]}"} __dotmatrix_make_sep_plug ${DOTMATRIX_COLOR_MARK[@]+"${DOTMATRIX_COLOR_MARK[@]}"}
prompt+="${dotmatrix_sep}" prompt+="${dotmatrix_sep}"
lp_terminal_format ${DOTMATRIX_COLOR_MARK[@]+"${DOTMATRIX_COLOR_MARK[@]}"} lp_terminal_format ${DOTMATRIX_COLOR_MARK[@]+"${DOTMATRIX_COLOR_MARK[@]}"}
local mark_color="$lp_terminal_format"
# No need to check LP_ENABLE_SHLVL, _lp_shell_level does it. # No need to check LP_ENABLE_SHLVL, _lp_shell_level does it.
if _lp_shell_level ; then if _lp_shell_level ; then
local i local i
for ((i=0; i < lp_shell_level-1; i++)); do for ((i=0; i < lp_shell_level-1; i++)); do
prompt+="${lp_terminal_format}${DOTMATRIX_MARK}" prompt+="${mark_color}${DOTMATRIX_MARK}"
done done
fi fi
@ -500,13 +501,13 @@ _lp_dotmatrix_theme_prompt() {
# No need to check LP_ENABLE_SUDO, _lp_sudo_active does it. # No need to check LP_ENABLE_SUDO, _lp_sudo_active does it.
_lp_sudo_active _lp_sudo_active
sudo="$?" sudo="$?"
if [[ "$sudo" != 0 || "$user" == 2 ]] ; then if [[ "$sudo" == 0 || "$user" == 2 ]] ; then
local dcwfg="${DOTMATRIX_COLOR_WARN[_LP_FIRST_INDEX+1]}" local dcwfg="${DOTMATRIX_COLOR_WARN[_LP_FIRST_INDEX+1]}"
[[ -z $dcwfg ]] && dcwfg=-1 [[ -z $dcwfg ]] && dcwfg=-1
lp_terminal_format $dcwfg lp_terminal_format $dcwfg
prompt+="${lp_terminal_format}${DOTMATRIX_MARK}" prompt+="${lp_terminal_format}${DOTMATRIX_MARK}"
else else
prompt+="${lp_terminal_format}${DOTMATRIX_MARK}" prompt+="${mark_color}${DOTMATRIX_MARK}"
fi fi
prompt+="${NO_COL}" prompt+="${NO_COL}"