bugfix
This commit is contained in:
@@ -285,28 +285,30 @@ set_prompt()
|
|||||||
local _dir_fg="${PROMPT_COLOR_DIR_FG:-$ICyan}"
|
local _dir_fg="${PROMPT_COLOR_DIR_FG:-$ICyan}"
|
||||||
|
|
||||||
# Begin with time (cursor-save is non-printing; all ANSI sequences wrapped
|
# Begin with time (cursor-save is non-printing; all ANSI sequences wrapped
|
||||||
# in \[...\] so bash does not count them toward the visible line width)
|
# in \[...\] so bash does not count them toward the visible line width).
|
||||||
PS1="\[\e[s\]\[${_time_fg}\]\[${_time_bg}\] [ \t ] \[${_bar_bg}\]"
|
# Every fg colour is combined with its section bg in the same \[...\] block
|
||||||
|
# so that even "reset" colours (0;Xm) cannot strip the background.
|
||||||
|
PS1="\[\e[s\]\[${_time_fg}${_time_bg}\] [ \t ] \[${_bar_bg}\]"
|
||||||
|
|
||||||
# Add exit status of the last command.
|
# Add exit status of the last command.
|
||||||
# If it was successful, print a green check mark. Otherwise, print a red X.
|
# If it was successful, print a green check mark. Otherwise, print a red X.
|
||||||
if [[ $Last_Command == 0 ]]; then
|
if [[ $Last_Command == 0 ]]; then
|
||||||
PS1+="\[${_ok_fg}\]\[${_bar_bg}\] [ \$Last_Command "
|
PS1+="\[${_ok_fg}${_bar_bg}\] [ \$Last_Command "
|
||||||
PS1+="\[${_ok_mark}\]${Checkmark} "
|
PS1+="\[${_ok_mark}${_bar_bg}\]${Checkmark} "
|
||||||
else
|
else
|
||||||
PS1+="\[${_err_fg}\]\[${_err_bg}\] [ \$Last_Command "
|
PS1+="\[${_err_fg}${_err_bg}\] [ \$Last_Command "
|
||||||
PS1+="\[${_err_mark}\]${FancyX} "
|
PS1+="\[${_err_mark}${_err_bg}\]${FancyX} "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add the elapsed time
|
# Add the elapsed time, then close the status section and return to bar bg.
|
||||||
timer_stop
|
timer_stop
|
||||||
PS1+="($timer_show)\[${_ok_fg}\] ] \[${_bar_bg}\] "
|
PS1+="($timer_show)\[${_ok_fg}${_bar_bg}\] ] "
|
||||||
|
|
||||||
# If root, print the host in root colour. Otherwise use user colour.
|
# If root, print the host in root colour. Otherwise use user colour.
|
||||||
if [[ $EUID -eq 0 ]]; then
|
if [[ $EUID -eq 0 ]]; then
|
||||||
PS1+="\[${_root_fg}\]\\u\[${_user_fg}\]@\\h"
|
PS1+="\[${_root_fg}${_bar_bg}\]\\u\[${_user_fg}${_bar_bg}\]@\\h"
|
||||||
else
|
else
|
||||||
PS1+="\[${_user_fg}\]\\u@\\h"
|
PS1+="\[${_user_fg}${_bar_bg}\]\\u@\\h"
|
||||||
fi
|
fi
|
||||||
PS1+="\[\e[K\e[u\]\[$RESETCOL\]\n"
|
PS1+="\[\e[K\e[u\]\[$RESETCOL\]\n"
|
||||||
# Print the working directory and prompt marker, then reset colour.
|
# Print the working directory and prompt marker, then reset colour.
|
||||||
|
|||||||
Reference in New Issue
Block a user