#!/hint/zshtypeset -ga _ftb_headers=()local i tmp group_colors
local -i mlen=0len=0# Keep ${group} value for preview, binds, etc without displaying group headersif{ -ftb-zstyle -m show-group "quiet"}; thenreturnfiif(($#_ftb_groups==1))&&{ ! -ftb-zstyle -m single-group "header"}; thenreturnfi# calculate the max column widthfor i in$_ftb_groups; do(($#i > mlen ))&&mlen=$#i
donemlen+=1-ftb-zstyle -a group-colors group_colors ||group_colors=($_ftb_group_colors)for((i=1; i<=$#_ftb_groups; i++ )); do[[$_ftb_groups[i]=="__hide__"* ]]&&continueif(( len + $#_ftb_groups[i] > COLUMNS - 5)); then_ftb_headers+=$tmptmp=''&&len=0fiif(( len + mlen > COLUMNS - 5)); then# the last column doesn't need padding_ftb_headers+=$tmp$group_colors[i]$_ftb_groups[i]$'\033[00m'tmp=''&&len=0elsetmp+=$group_colors[i]${(r:$mlen:)_ftb_groups[i]}$'\033[00m'len+=$mlenfidone(($#tmp ))&&_ftb_headers+=$tmp