nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] <Happy Dance!>


From: Ralph Corderoy
Subject: Re: [Nmh-workers] <Happy Dance!>
Date: Wed, 16 Aug 2017 22:06:19 +0100

Hi Valdis,

> Actually, could use that now, I've been using a git tree copy for quite some
> time now... :)

Good show.

> man mh-format says:
>
>        When a function or component escape is interpreted and the result  will
>        be  printed  immediately,  an  optional field width can be specified to
>        print the field in exactly a given number of characters.  For  example,
>        a  numeric escape like %4(size) will print at most 4 digits of the mes?
>        sage size; overflow will be indicated by a `?' in  the  first  position
>        (like  `?234').   A  string  escape  like %4(me) will print the first 4
>        characters and truncate at the end.  Short fields  are  padded  at  the
>        right  with the fill character (normally, a blank).

That's an ugly rendering.  With the man(1) here, a environment variable of
`MANOPT=--nh --nj' gives much nicer results.

> We don't mention that negative values left-pad.

Enough with your cans of worms!  If negative width were really
supported...

    $ for w in -9 -3 0 3 9; do
    >     fmttest -raw -format _%$w'(comp{text})_' 31415
    > done
    _    31415_
    _314_
    _31415_
    _314_
    _31415    _
    $

Seems fine.

    $ for w in -9 -3 0 3 9; do
    >     fmttest -raw -format _%$w'(compval{text})_' 31415
    > done
    __
    __
    _31415_
    _?415_
    _    31415_
    $

I wouldn't expect the first two to be missing.  Am I doing something
wrong?  And then the fourth shows overflow, good, but uses four, not
three, characters to do it.

    $ for w in -9 -3 0 3 9; do
    >     fmttest -raw -format '%(void(compval{text}))_%'$w'(minus 0)_' 1718
    > done
    __
    __
    _-1718_
    _?718_
    _    -1718_
    $

Same for a negative number.  (Try passing -1718 to fmttest.)

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]