* Simplify Pygmalion Theme
The Pygmalion theme previously had some logic for counting line length and taking action based on line length. The action was removed in c52441b624, but the counting still needlessly happens.
This commit removes the code to count line length, and simplifies the Pygmalion theme by moving the "precmd" into the setup.
As a bonus unintended side effect, this makes the Pygmalion theme compatible with the current async prompting logic (i.e. after this change, Pygmalion is no longer affected by https://github.com/ohmyzsh/ohmyzsh/issues/12328)
* refactor(pygmalion): redo and simplify prompt sequences
With this commit we put the minimal needed color resets, i.e. only
when we don't control the previous text we need to do a full reset.
Otherwise we can just use %F{} to change only the foreground color.
Co-authored-by: Marc Cornellà <marc@mcornella.com>
The pygmalion and pygmalion-virtualenv themes unsafely handle git prompt information
which results in a double evaluation of this information, so a malicious git repository
could trigger a command injection if the user cloned and entered the repository.
A similar method could be used in the refined theme. All themes have been patched against this
vulnerability.
My system doesn't have `perl` in $PATH, so using this theme clutters the
shell output quite a bit.
Turns out, the same thing can be accomplished in pure zsh (with
extendedglob).
Co-Authored-By: Marc Cornellà <marc.cornella@live.com>
Use add-zsh-hook to add functions to hooks. That way they won't be added again
when doing `source ~/.zshrc` multiple times.
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
if the length of the prompt (excluding color escapes) exceeds 40
characters, emit the arrow prompt on its own line
This helps a lot on smaller terminals