pretty: fix printing of long strings e.g. pi.evalf(100) (#941)
commit43d608e95941fb5ae2b24e00676e79207dc0c351
authorKirill Smelkov <kirr@landau.phys.spbu.ru>
Fri, 25 Jul 2008 17:43:59 +0000 (25 21:43 +0400)
committerKirill Smelkov <kirr@landau.phys.spbu.ru>
Fri, 25 Jul 2008 17:43:59 +0000 (25 21:43 +0400)
treeb890a15c10cfe4a8a3b0060a39255ff4dc45ee19
parent30dfb0651d93ff902e69ca0cb33bea503d2499c8
pretty: fix printing of long strings e.g. pi.evalf(100)   (#941)

When pretty needs to print long stringPicts, we see at what terminal width is,
and wraps the picture. Also currently we add vertical spacer between blocks.

For mathematical formulas with height > 1 this is certainly the right thing to
do, e.g.:

       2  2        3        3    4    4
    6*x *y  + 4*x*y  + 4*y*x  + x  + y

is wrapped into this:

       2  2        3
    6*x *y  + 4*x*y  +
                        <-- note vertical spacer
         3    4    4
    4*y*x  + x  + y

But if we'll look at pi.evalf(100), or long dict or another string which is
originally 1-character in height, it seems putting such v-spacers is not
convenient:

In [2]: pi.evalf(48)    |  In [2]: pi.evalf(48)
Out[2]:                 |  Out[2]:
3.14159265358979323     |  3.14159265358979323
8462643383279502884     |
19716939937             |  8462643383279502884
                        |
                        |  19716939937

That's why I propose we stop adding this v-spacers if original picture is
1-character in height.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Ondrej Certik <ondrej@certik.cz>
sympy/printing/pretty/stringpict.py