summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-11 07:33:39 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-11 07:33:39 -0700
commit1a583e55bddab7b2146a7a3bfb51e7fcda87608b (patch)
tree82874f023e2a02f4209b2525ea3f3e360b6192a8
parentf6e56f2b6475a44dca8233e821dd802cde7bb8c7 (diff)
downloadtxr-1a583e55bddab7b2146a7a3bfb51e7fcda87608b.tar.gz
txr-1a583e55bddab7b2146a7a3bfb51e7fcda87608b.tar.bz2
txr-1a583e55bddab7b2146a7a3bfb51e7fcda87608b.zip
pic: clarification and tests.
* tests/018/format.tl: Add tests which combine overflow flagging with +/-. The space generated by - contributes to overflow. * txr.1: Clarify overflow issue in documentation.
-rw-r--r--tests/018/format.tl6
-rw-r--r--txr.110
2 files changed, 13 insertions, 3 deletions
diff --git a/tests/018/format.tl b/tests/018/format.tl
index d1038c30..23f4cc63 100644
--- a/tests/018/format.tl
+++ b/tests/018/format.tl
@@ -109,6 +109,12 @@
(pic "#.#" 123) "123.0")
(mtest
+ (pic "-##!#" 12) " 12.0"
+ (pic "+##!#" 12) "+12.0"
+ (pic "-##!#" -123) "#####"
+ (pic "+##!#" 123) "#####")
+
+(mtest
(pic "X##.#Y<<<Z>>>W" 1 2 3) "X 1.0Y2 Z 3W"
(pic "~###.#~#<<<~#>>>~#" 1 2 3) "# 1.0#2 # 3#")
diff --git a/txr.1 b/txr.1
index 45eb1066..a37342fe 100644
--- a/txr.1
+++ b/txr.1
@@ -54926,14 +54926,18 @@ all specify a field width of four.
If the leading sign is present, it has the following meanings:
.RS
-.coIP -
-If the corresponding numeric argument is non-negative, a space will appear before
-the first digit. Otherwise, the minus character will appear.
.coIP +
If the corresponding numeric argument is non-negative, the
.code +
character shall appear before first digit. Otherwise the minus character
will appear.
+.coIP -
+Like
+.code +
+except that when the numeric argument is non-negative, instead of a
+.code +
+character, a space appears before the first digit. This space counts
+toward the field width and therefore contributes to overflow.
.RE
.IP
If a leading sign is not present, then no extra character appears before