Commit Graph

9 Commits

Author SHA1 Message Date
Marc Khouri
fa583cfb87
refactor(pygmalion): simplify theme logic and prompt sequences (#12550)
* 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>
2024-07-12 18:18:20 +02:00
Marc Cornellà
b3ba9978cc
fix(themes): fix potential command injection in pygmalion, pygmalion-virtualenv and refined
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.
2021-11-11 22:45:40 +01:00
Florian Klink
4ed6fd2b8b
pygmalion: use pure zsh instead of perl (#9210)
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>
2020-08-29 00:27:06 +02:00
Marc Cornellà
c52441b624 pygmalion: revert multiline prompt change
Fixes #2317
Closes #2321
2020-05-10 20:06:24 +02:00
Jacob Tomaw
1ba0af650a Use safer append to hook function arrays (#8406)
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>
2019-11-19 18:47:12 +01:00
Letian Zhang
9c1255d358 fix missing add-zsh-hook in pygmalion.zsh-theme
Fix "command not found: add-zsh-hook" since #3053 removes `autoload -U add-zsh-hook`
2014-09-01 09:49:31 +08:00
Philip Hofstetter
3445dada95 correctly handle path names with spaces 2011-12-29 14:35:38 +01:00
Philip Hofstetter
77045230f4 make pygmalion theme use two lines when needed
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
2011-12-28 15:58:24 +01:00
Dominick LoBraico
d25fb095a9 forks miloshadzic theme to add more directory info as well as user and host info 2011-12-09 12:18:54 -06:00