From 392250a43292391b0dfb3c823eff95b5785455b2 Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Wed, 2 Feb 2022 20:00:10 -0500 Subject: 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. --- stdlib/getopts.tl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'stdlib') 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) -- cgit v1.2.3