Re: [PATCH 12/12] pretty: support %>> that steal trailing spaces
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 17, 2013, 09:06 UTC
- Message-ID
- <CAPig+cSzHuSnT2+e+U+zJtOUtReUo=3JWZDQcCbMKS4ibZtjvA@mail.gmail.com>
- In-Reply-To
- <1363400683-14813-13-git-send-email-pclouds@gmail.com>
On Fri, Mar 15, 2013 at 10:24 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> This is pretty useful in `%<(100)%s%Cred%>(20)% an' where %s does not
s/% an/%an/
Show 13 quoted lines
> use up all 100 columns and %an needs more than 20 columns. By > replacing %>(20) with %>>(20), %an can steal spaces from %s. > > diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt > index 17f82f4..036c14a 100644 > --- a/Documentation/pretty-formats.txt > +++ b/Documentation/pretty-formats.txt > @@ -170,7 +170,10 @@ The placeholders are: > columns, padding spaces on the right if necessary > - '%>(<N>)', '%>|(<N>)': similar to '%<(<N<)', '%<|(<N<)' > respectively, but padding spaces on the left > -- '%><(<N>)', '%><|(<N>)': similar to '%<(<N<)', '%<|(<N<)' > +- '%>>(<N>)', '%>>|(<N>)': similar to '%>(<N<)', '%>|(<N<)'
s/<N</<N>/g
> + respectively, except that if the next placeholder takes more spaces > + than given and there are spaces on its left, use those spaces > +- '%><(<N>)', '%><|(<N>)': similar to '% <(<N<)', '%<|(<N<)'
Ditto: s/<N</<N>/g
> respectively, but padding both sides (i.e. the text is centered)