From ba1732833b81c69df5135825d38ea9d889d1aa47 Mon Sep 17 00:00:00 2001 From: Paul <41666738+kutukvpavel@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:45:12 +0300 Subject: [PATCH] feat(jonathan): add virtualenv support (#12705) Co-authored-by: paul --- themes/jonathan.zsh-theme | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index e8c490884..da6ed2281 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -7,14 +7,15 @@ function theme_precmd { local promptsize=${#${(%):---(%n@%m:%l)---()--}} local rubypromptsize=${#${(%)$(ruby_prompt_info)}} local pwdsize=${#${(%):-%~}} + local venvpromptsize=$((${#$(virtualenv_prompt_info)})) # Truncate the path if it's too long. - if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then + if (( promptsize + rubypromptsize + pwdsize + venvpromptsize > TERMWIDTH )); then (( PR_PWDLEN = TERMWIDTH - promptsize )) elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then - PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}" + PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize + venvpromptsize ) ))::${PR_HBAR}:)}" else - PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}" + PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize + venvpromptsize ) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}" fi } @@ -103,7 +104,7 @@ fi PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}\ ${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(\ ${PR_GREEN}%${PR_PWDLEN}<...<%~%<<\ -${PR_GREY})$(ruby_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\ +${PR_GREY})$(virtualenv_prompt_info)$(ruby_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\ ${PR_CYAN}%(!.%SROOT%s.%n)${PR_GREY}@${PR_GREEN}%m:%l\ ${PR_GREY})${PR_CYAN}${PR_HBAR}${PR_URCORNER}\