hchbaw/auto-fu.zsh

Please reset all text attributes at the end of zle-accept-line

Closed this issue · 1 comments

I combine auto-fu with zsh-syntax-highlighting and have customized my own colors with zsh-syntax-highlighting, some of them "bold". Occasionally, it happens that after pressing "enter" the program is started with bold color-mode not being reset. Surprisingly this is somewhat unreproducible, i.e. exactly the same input can lead to bold or normal colors during the program run; usually the colors are not reset if I type very quickly. Not sure whether this is a bug of zsh, zsh-syntax-highlighting, auto-fu, or if it occurs only in the interplay with some other setting of mine. Nevertheless,

echo -en '\e[0m'

at the end of the end of the function(s) $afufun() defined in afu-register-zle-accept-line fixes the issue reliably.

Thank you very much for reporting!

I haven't noticed this particular problem when pressing "enter".
(As you can see yes, I've been playing with zsh-syntax-highlighting for a while, too.)

I will introduce a workaround for it as you have suggested like this:

afu-reset-all-text-attributes () {
  echo -en '\e[0m'
}
add-zsh-hook preexec afu-reset-all-text-attributes

I sometimes use non-standard functions to accept the command line, so I will hook the 'preexec' to do its job.