Skip to content

Commit 9ab6435

Browse files
committed
🐛 Fix prompt color leak
1 parent 3f7675a commit 9ab6435

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

themes/default.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ fancygit_theme_builder() {
4747
local branch_color_bg_tag="\\[\\e[48;5;${FANCYGIT_COLOR_SCHEME_BRANCH_BACKGROUND}m\\]"
4848
local branch_color_font_tag="\\[\\e[38;5;${FANCYGIT_COLOR_SCHEME_BRANCH_FOREROUND}m\\]"
4949
local none="\\[\\e[39m\\]"
50-
local bold_none="\\[\\e[0m\\]"
50+
local clear="\\[\\e[0m\\]"
5151
local bg_none="\\[\\e[49m\\]"
5252
local bold_prompt=""
5353
local normal_prompt=""
5454

5555
if fancygit_config_is "bold_prompt" "true"
5656
then
57-
bold_none=""
57+
clear=""
5858
bold_prompt="\\[\\e[1m\\]"
5959
normal_prompt="\\[\\e[0m\\]"
6060
fi
@@ -68,16 +68,16 @@ fancygit_theme_builder() {
6868
local at="${at_color_font_tag}"
6969
local host="${host_color_font_tag}"
7070
local user_at_host="${user_at_host_color_bg_tag}"
71-
local user_at_host_end="${bold_none}${bg_none}${user_at_host_color_tag}${user_symbol_color_bg_tag}${separator}"
71+
local user_at_host_end="${user_at_host_color_tag}${user_symbol_color_bg_tag}${separator}"
7272
local user_symbol="${user_symbol_color_bg_tag}${user_symbol_color_font_tag}"
73-
local user_symbol_end="${none}${bold_none}${bg_none}${user_symbol_color_tag}${workdir_color_bg_tag}${separator}"
73+
local user_symbol_end="${none}${user_symbol_color_tag}${workdir_color_bg_tag}${separator}"
7474
local path="${workdir_color_bg_tag}${workdir_color_font_tag}"
7575
local path_git="${workdir_color_bg_tag}${workdir_color_font_tag} ${icon_git_repo} "
76-
local path_end="${none}${bold_none}"
76+
local path_end="${none}"
7777
local branch="${workdir_color_tag}${branch_color_bg_tag}${separator}${branch_color_font_tag}"
78-
local branch_end="${branch_color_tag}${bg_none}${separator}${bold_none}${none}"
78+
local branch_end="${branch_color_tag}${bg_none}${separator}${none}"
7979
local time="${time_color_bg_tag}${time_color_tag}"
80-
local time_end="${bold_none}${bg_none}"
80+
local time_end=""
8181
local prompt_time
8282
local prompt_user
8383
local prompt_env
@@ -93,7 +93,7 @@ fancygit_theme_builder() {
9393
# This prevents a weird presentation. Life is not easy :/
9494
if [[ "$FANCYGIT_COLOR_SCHEME_TIME_BACKGROUND" != "$FANCYGIT_COLOR_SCHEME_USER_AT_HOST_BACKGROUND" && "" != "$time_raw" ]]
9595
then
96-
time_end="${bold_none}${bg_none}${time_symbol_color_tag}${user_at_host_color_bg_tag}${separator} "
96+
time_end="${time_symbol_color_tag}${user_at_host_color_bg_tag}${separator} "
9797
fi
9898

9999
local user_name
@@ -123,8 +123,8 @@ fancygit_theme_builder() {
123123
then
124124
# No branch found, so we're not in a git repo.
125125
prompt_env=$(__fancygit_get_venv_icon)
126-
prompt_path="${path}${prompt_env} ${prompt_path} ${path_end}${workdir_color_tag}${separator}${none}"
127-
PS1="${bold_prompt}${prompt_time}${prompt_user}${prompt_symbol}${prompt_path}${prompt_double_line}${normal_prompt} "
126+
prompt_path="${path}${prompt_env} ${prompt_path} ${path_end}${workdir_color_tag}${bg_none}${separator}${none}"
127+
PS1="${clear}${bold_prompt}${prompt_time}${prompt_user}${prompt_symbol}${prompt_path}${clear}${normal_prompt}${prompt_double_line} "
128128
return
129129
fi
130130

@@ -143,20 +143,20 @@ fancygit_theme_builder() {
143143
if [ "" != "$(fancygit_git_get_status)" ]
144144
then
145145
branch="${workdir_color_tag}${branch_color_changed_files_bg_tag}${separator}${branch_color_changed_files_font_tag}"
146-
branch_end="${bg_none}${bold_none}${branch_color_changed_files_tag}${separator}${none}"
146+
branch_end="${branch_color_changed_files_tag}${bg_none}${separator}${none}"
147147
fi
148148

149149
# Configure a specific background color to branch name, if it has staged files.
150150
if [ "" != "$(fancygit_git_get_staged_files)" ]
151151
then
152152
branch="${workdir_color_tag}${branch_color_staged_files_bg_tag}${separator}${branch_color_staged_files_font_tag}"
153-
branch_end="${bg_none}${bold_none}${branch_color_staged_files_tag}${separator}${none}"
153+
branch_end="${branch_color_staged_files_tag}${bg_none}${separator}${none}"
154154
fi
155155

156156
notification_area=$(fancygit_get_notification_area "$is_rich_notification")
157157
prompt_path="${path_git}${notification_area} ${prompt_path} ${path_end}"
158158
prompt_branch="${branch} $(fancygit_git_get_branch_icon "${branch_name}") ${branch_name} ${branch_end}"
159-
PS1="${bold_prompt}${prompt_time}${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch}${prompt_double_line}${normal_prompt} "
159+
PS1="${clear}${bold_prompt}${prompt_time}${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch}${clear}${normal_prompt}${prompt_double_line} "
160160
}
161161

162162
# Here's where the magic happens!

0 commit comments

Comments
 (0)