diff --git a/themes/barbuk/barbuk.theme.bash b/themes/barbuk/barbuk.theme.bash index cedb56902d..b3f2827c00 100644 --- a/themes/barbuk/barbuk.theme.bash +++ b/themes/barbuk/barbuk.theme.bash @@ -106,7 +106,7 @@ function __git-upstream-remote-logo_prompt() { function git_prompt_info() { git_prompt_vars - echo -e "on $SCM_GIT_CHAR_ICON_BRANCH $SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX " + echo "on $SCM_GIT_CHAR_ICON_BRANCH $SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX " } function __exit_prompt() { @@ -194,7 +194,12 @@ function __python_venv_prompt() { elif [[ -n "${VIRTUAL_ENV_PROMPT:-}" ]]; then python_info="${VIRTUAL_ENV_PROMPT}" elif [[ -f pyproject.toml ]]; then - python_info=$(awk -F'"' '/^requires-python/ {print $2}' pyproject.toml) + # pyproject.toml has no character restrictions on this field, unlike a + # git ref name. Strip anything outside printable ASCII (raw control + # characters, e.g. terminal escape sequences) as well as literal + # backslash-letter escape sequences written as text (e.g. "\e]...\a"), + # which some shells/echo modes can still expand. + python_info=$(awk -F'"' '/^requires-python/ {gsub(/[^\40-\176]|\\[a-zA-Z]/, "", $2); print $2}' pyproject.toml) [[ -z "${python_info}" ]] && python_info="py" fi @@ -312,6 +317,7 @@ function __prompt-command() { for segment in $BARBUK_PROMPT; do local info info="$(__"${segment}"_prompt)" + info="${info//[[:cntrl:]]/}" [[ -n "${info}" ]] && PS1+="${info}" done