summaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
authorPaul A. Patience <paul@apatience.com>2022-02-02 20:00:10 -0500
committerKaz Kylheku <kaz@kylheku.com>2022-02-02 17:29:37 -0800
commit392250a43292391b0dfb3c823eff95b5785455b2 (patch)
tree3577a8c98c053e58accdfe4a275a7d70c7ffd103 /stdlib
parentae57a36b49557f8f5b55df22b308ed1ce4de2385 (diff)
downloadtxr-392250a43292391b0dfb3c823eff95b5785455b2.tar.gz
txr-392250a43292391b0dfb3c823eff95b5785455b2.tar.bz2
txr-392250a43292391b0dfb3c823eff95b5785455b2.zip
getopts: fix display of overlong-option help text.
* stdlib/getopts.tl (opthelp): If the long/short part of an option description is 34 characters long or more, print the help text starting on the next line, lest it be glued to the long/short part (i.e., without an intervening space) and extend too far to the right.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/getopts.tl4
1 files changed, 3 insertions, 1 deletions
diff --git a/stdlib/getopts.tl b/stdlib/getopts.tl
index 1d714126..e448c130 100644
--- a/stdlib/getopts.tl
+++ b/stdlib/getopts.tl
@@ -294,7 +294,9 @@
(long long)
(short `@{"" 21} @short`)))
(lines (if od.helptext (sys:wdwrap od.helptext 43))))
- (put-line ` @{ls 34}@(pop lines)` stream)
+ (if (>= (len ls) 34)
+ (put-line ` @ls` stream)
+ (put-line ` @{ls 34}@(pop lines)` stream))
(while lines
(put-line ` @{"" 34}@(pop lines)` stream))))
(put-line : stream)