fix(jonathan): make compatible with Ghostty shell-integration (#13917)
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled

The issue is that Ghostty shell-integration tries to parse PS1. How we're
defining it now, the precmd function from Ghostty does not properly read
the newlines, resulting in broken prompts. This doesn't happen if:

- Zsh is reloaded (`omz reload` or `exec zsh`)
- Ghostty shell integration is disabled (`shell-integration = none` in config)

This fix just removes the newlines, and it's enough to fix the integration.
This commit is contained in:
Marc Cornellà 2026-08-06 09:20:53 +02:00 committed by GitHub
commit 0912e05c05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -102,25 +102,11 @@ else
fi
# Finally, the prompt.
PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}\
${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(\
${PR_GREEN}%${PR_PWDLEN}<...<%~%<<\
${PR_GREY})$(virtualenv_prompt_info)$(ruby_prompt_info)$(conda_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}\
${PR_CYAN}${PR_LLCORNER}${PR_BLUE}${PR_HBAR}(\
${PR_YELLOW}%D{%H:%M:%S}\
${PR_LIGHT_BLUE}%{$reset_color%}$(git_prompt_info)$(git_prompt_status)${PR_BLUE})${PR_CYAN}${PR_HBAR}\
${PR_HBAR}\
>${PR_NO_COLOUR} '
PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(${PR_GREEN}%${PR_PWDLEN}<...<%~%<<${PR_GREY})$(virtualenv_prompt_info)$(ruby_prompt_info)$(conda_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}
${PR_CYAN}${PR_LLCORNER}${PR_BLUE}${PR_HBAR}(${PR_YELLOW}%D{%H:%M:%S}${PR_LIGHT_BLUE}%{$reset_color%}$(git_prompt_info)$(git_prompt_status)${PR_BLUE})${PR_CYAN}${PR_HBAR}${PR_HBAR}>${PR_NO_COLOUR} '
# display exitcode on the right when > 0
return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})"
RPROMPT=' $return_code${PR_CYAN}${PR_HBAR}${PR_BLUE}${PR_HBAR}\
(${PR_YELLOW}%D{%a,%b%d}${PR_BLUE})${PR_HBAR}${PR_CYAN}${PR_LRCORNER}${PR_NO_COLOUR}'
RPROMPT=' $return_code${PR_CYAN}${PR_HBAR}${PR_BLUE}${PR_HBAR}(${PR_YELLOW}%D{%a,%b%d}${PR_BLUE})${PR_HBAR}${PR_CYAN}${PR_LRCORNER}${PR_NO_COLOUR}'
PS2='${PR_CYAN}${PR_HBAR}\
${PR_BLUE}${PR_HBAR}(\
${PR_LIGHT_GREEN}%_${PR_BLUE})${PR_HBAR}\
${PR_CYAN}${PR_HBAR}${PR_NO_COLOUR} '
PS2='${PR_CYAN}${PR_HBAR}${PR_BLUE}${PR_HBAR}(${PR_LIGHT_GREEN}%_${PR_BLUE})${PR_HBAR}${PR_CYAN}${PR_HBAR}${PR_NO_COLOUR} '