From 1a7c98894c985df6aa6a695865b6c0f6b0a11265 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 1 Jul 2014 19:04:46 -0400 Subject: libremessages: the flags() word-wrapping was a single character wide. --- src/lib/libremessages | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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" -- cgit v1.2.2