summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-13 07:19:28 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-13 07:19:28 -0700
commit4b308561021d4dedd7e83e5df30534d1fdde2216 (patch)
tree5dfe9d9f3463b3d819387618e1dc6005d831aec9 /txr.1
parent1684fc0bedfa9fa9a5a7a22d6fb44e660a203a1c (diff)
downloadtxr-4b308561021d4dedd7e83e5df30534d1fdde2216.tar.gz
txr-4b308561021d4dedd7e83e5df30534d1fdde2216.tar.bz2
txr-4b308561021d4dedd7e83e5df30534d1fdde2216.zip
Observe display width in format.
Take into account string display width in field trimming and padding calculations, including situations where only half a character fits. * stream.c (calc_fitlen): New function. (vformat_str): Revised to use calc_fitlen. If calc_fitlen indicates that there is no trimming or padding, then use put_string rather than put_char. * txr.1: Update description of format with regard to use of dispaly width in field calculations.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.126
1 files changed, 23 insertions, 3 deletions
diff --git a/txr.1 b/txr.1
index d788c6bb..fe7a8536 100644
--- a/txr.1
+++ b/txr.1
@@ -26945,6 +26945,20 @@ or
prefix character is present in the width
specifier, then the field is adjusted according to that character.
+The padding calculations for alignment and centering take into account
+character display width, as defined by the
+.code display-width
+function. For instance, a character string containing four Chinese
+characters (kanji) has a display width of 8, not 4.
+
+The width specification does not restrict the printed portion of a datum.
+Rather, for some kinds of conversions, it is the precision specification that
+performs such truncation. A datum's display width (or that of its printed
+portion, after such truncation is applied) can equal or exceed the specified
+field width. In this situation it overflows the field: the printed portion is
+rendered in its entirety without any padding applied on either side for
+alignment or centering.
+
.meIP < precision
The precision specifier is introduced by a leading comma. If this comma appears
immediately after the directive's
@@ -27007,9 +27021,15 @@ numbers are unconditionally prefixed with a
.code -
sign.
-For all other objects, the precision specifies the maximum number of characters
-to print. The object's printed representation is crudely truncated at that
-number of characters.
+For all other objects, the precision specifies the maximum number of
+print positions to occupy, taking into account the display width of each
+character of the printed representation of the object, as according
+to the
+.code display-width
+function. The object's printed representation is truncated, if necessary, to
+the maximum number of characters which will not exceed the specified number of
+print positions.
+
.RE
.TP* "Format directives:"