Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 260464
Collapse All | Expand All

(-)libs/output.bash.in (-14 / +5 lines)
Lines 119-149 Link Here
119
    text=${val//\%%%??%%%/}
119
    text=${val//\%%%??%%%/}
120
    # only loop if it doesn't fit on the same line
120
    # only loop if it doesn't fit on the same line
121
    if [[ $(( ${n} + ${#text} )) -ge ${cols} ]] ; then
121
    if [[ $(( ${n} + ${#text} )) -ge ${cols} ]] ; then
122
        local i=0
122
        local i=0 spc=""
123
        rindent="${rindent}$(space 28)"
123
        rindent="${rindent}$(space 28)"
124
        cwords=( ${cwords} )
124
        cwords=( ${cwords} )
125
        for text in ${val} ; do
125
        for text in ${val} ; do
126
            text=${text//\%%%??%%%/}
126
            text=${text//\%%%??%%%/}
127
            # put the word on the same line if it fits
127
            # put the word on the same line if it fits
128
            if [[ $(( ${n} + ${#text} + 1 )) -lt ${cols} ]] ; then
128
            if [[ $(( ${n} + ${#spc} + ${#text} )) -lt ${cols} ]] ; then
129
                echo -n -e "${cwords[i]}"
129
                echo -n -e "${spc}${cwords[i]}"
130
                n=$(( ${n} + ${#text} ))
130
                n=$(( ${n} + ${#spc} + ${#text} ))
131
                # only append a space if we're not on the last word
132
                if [[ ${i} -ne ${#cwords} ]] ; then
133
                    echo -n ' '
134
                    n=$(( ${n} + 1 ))
135
                fi
136
            # otherwise, start a new line and indent
131
            # otherwise, start a new line and indent
137
            else
132
            else
138
                echo -n -e "\n${rindent}${cwords[i]}"
133
                echo -n -e "\n${rindent}${cwords[i]}"
139
                n=$(( ${#rindent} + ${#text} ))
134
                n=$(( ${#rindent} + ${#text} ))
140
                # only append a space if we're not on the last word
141
                if [[ ${i} -ne ${#cwords} ]] ; then
142
                    echo -n ' '
143
                    n=$(( ${n} + 1 ))
144
                fi
145
            fi
135
            fi
146
            i=$(( ${i} + 1 ))
136
            i=$(( ${i} + 1 ))
137
            spc=" "
147
        done
138
        done
148
    else
139
    else
149
        echo -n -e "${cwords}"
140
        echo -n -e "${cwords}"

Return to bug 260464