Oh My Zsh Custom Theme: Long Tips Fade / Break

I had a desire to make my own Oh My Zsh theme earlier. Everything is fine, except when I type long lines in a line (longer than the line shown below), the line disappears. The line appears again if I resize the window.

Is there something in my topic that causes this?

If I type an extra character and then delete it, the cursor appears at the edge of the window.

You can view the code for the topic here . I think we are concerned that:

# Build the prompt PROMPT=' ' # Newline PROMPT+='${style_user}%n' # Username PROMPT+='${style_chars}@' # @ PROMPT+='${style_host}%m' # Host PROMPT+='${style_chars}: ' # : PROMPT+='${style_path}%c ' # Working directory PROMPT+='$(git_custom_status)' # Git details PROMPT+=' ' # Newline PROMPT+='${style_chars}\$${RESET} ' 
+7
source share
1 answer

By the way, your link is broken, highlighting one of the problems with sending a link to the code instead of the code itself - any future viewers of your question will not be able to get the full picture.

I think your problem is that the color characters you use should be escaped in a pair of %{...%} :

 %{...%} Include a string as a literal escape sequence. The string within the braces should not change the cursor position. Brace pairs can nest. 

Using your last commit on github , I don't see this problem - can you fix it? However, I see some problems with cursor placement and line drawing, especially with TAB . When you press TAB cursor moves one line:

enter image description here Click here TAB here. enter image description here Click here TAB here. enter image description here

PROMPT redraws "up" one line each time. This is fixed by encapsulating the color codes in %{...%} :

 # Solarized Dark colour scheme BOLD="%{$(tput bold)%}" RESET="%{$(tput sgr0)%}" SOLAR_YELLOW="%{$(tput setaf 136)%}" SOLAR_ORANGE="%{$(tput setaf 166)%}" SOLAR_RED="%{$(tput setaf 124)%}" SOLAR_MAGENTA="%{$(tput setaf 125)%}" SOLAR_VIOLET="%{$(tput setaf 61)%}" SOLAR_BLUE="%{$(tput setaf 33)%}" SOLAR_CYAN="%{$(tput setaf 37)%}" SOLAR_GREEN="%{$(tput setaf 64)%}" SOLAR_WHITE="%{$(tput setaf 254)%}" 

I'm not 100% sure without the original ~/.zshrc , but that will slightly improve your invitation. :)

Besides orange, you can also use the Solarized profile on the terminal and zsh colors , which can be more portable. I could not get the orange right, but not tput .

 #autoload colors && colors #SOLAR_YELLOW="%{$fg[yellow]%}" #SOLAR_ORANGE="%{$(tput setaf 166)%}" #SOLAR_RED="%{$fg[red]%}" #SOLAR_MAGENTA="%{$fg[magenta]%}" #SOLAR_VIOLET="%{$fg_bold[magenta]%}" #SOLAR_BLUE="%{$fg[blue]%}" #SOLAR_CYAN="%{$fg[cyan]%}" #SOLAR_GREEN="%{$fg[green]%}" #SOLAR_WHITE="%{$fg[white]%}" 
+11
source

All Articles