I do have some code to highlight stderr in red, in Zsh; I've copied it from https://github.com/fniessen/shell-leuven#stderr-in-red
However, there are strange things happening: the red is sometimes "broken" by stdout, and then continues up to the end of the screen (see last line, where "Already up to date" is squashed between regions highlighted in red):
(Same strange thing in the first block, where there is a spurious red line at the end of the block.)
How to solve this? Is there something wrong in the code?
PS - Example code for the above output:
BLU=$(tput bold)$(tput setaf 4)
reset=$(tput sgr0)
find . -maxdepth 5 -name ".git" -type d | rev | cut -c 6- | rev | sed "s#^\./##" |
while IFS=$'\n' read -r repo; do
printf '%s\n' "Current repository: ${BLU}$repo${reset}"
git -C "$repo" remote update --prune
git -C "$repo" merge --ff-only "@{u}"
echo
done