ascii-boxes / boxes

Command line ASCII boxes unlimited!
https://boxes.thomasjensen.com/
GNU General Public License v3.0
613 stars 75 forks source link

Added empty align box #90

Closed Davidy22 closed 3 years ago

Davidy22 commented 3 years ago

Used a full width space character to cheat the check. Potential resolution to #88.

Davidy22 commented 3 years ago

Hrm. just noticed this alignment method mangles asymmetric inputs when centering.

Edit: Ok, came back, tried it some more and for some reason, asymmetric width input things like unicornthink are mangled when passed into this blank box with -a c, but -a hc works perfectly. Isn't the only difference vertical centering? I tested with -a hcvc and that worked great too. I also notice that other boxes also crush asymmetric inputs with -a c so it's not actually an issue with this box.

tsjensen commented 3 years ago

According to the docs, -ac is short for -a hcvcjc, the jc part of which means:

jx - justification of lines within the input text block. Possible values for x are l (ell, for left justification), c (center), or r (right). This does not affect the alignment of the input text block itself within the box. Use the h and v arguments for input text block positioning.

In the FAQ, I explained it like this:

Note that we -a hc instead of just -ac, because we want to align the whole block of text, not individual lines.

tsjensen commented 3 years ago

The greater problem is that the config file is in ASCII format, so the unicode space character is a forbidden character atm. 😢

tsjensen commented 3 years ago

But it seems you can still use this trick on unicode-enabled terminals using the -c option (the argument to -c is your full-width space!):

echo -e foo\\ncentered | boxes -d parchment -p h5 | boxes -s $(tput cols) -c " " -a hc -i none

This works for me, although the centering might be off by one or two columns because the space gets counted as three columns.