diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/lib/libremessages | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/libremessages b/src/lib/libremessages index f75bd4a..aadd91e 100755 --- a/src/lib/libremessages +++ b/src/lib/libremessages @@ -98,13 +98,23 @@ flag() { local flag=$1 local desc="$(_ "$(_libremessages_html_whitespace_collapse <<<"$2")")" + # Unless the $flag is extra-wide, the $desc should start at + # column 16 (that is two literal-tabs). If $flag is wide, + # this should be increased in increments of 8 (that is, a + # literal-tab). Everything should be wrapped to 75 columns. + + # The printf-format we use has 3 spaces built into it (two at + # the beginning, and a seperator). Therefore, the default + # indent is 16-3=13 columns. And the width left for $desc + # is (75-3)-indent = 72-indent. + declare -i indent=13 while [[ $indent -le ${#flag} ]]; do indent=$((indent+8)) done local lines - IFS=$'\n' lines=($(fmt -u -w $((73-indent)) <<<"$desc")) + IFS=$'\n' lines=($(fmt -u -w $((72-indent)) <<<"$desc")) local line for line in "${lines[@]}"; do printf " %-${indent}s %s\n" "$flag" "$line" |