summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-07-01 19:04:46 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-07-01 19:04:46 -0400
commit1a7c98894c985df6aa6a695865b6c0f6b0a11265 (patch)
tree59078dccde066d4edd8166c8392fd9ead2e2a937 /src
parentcd817482092bf63ee13f912d76023073ef48731c (diff)
libremessages: the flags() word-wrapping was a single character wide.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/lib/libremessages12
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"