Closed asottile closed 5 years ago
i cant wait to kill the pylib dependency of terminal-writer ^^
question - how does this affect normal terminal output?
if this triggers line-wraps of separator lines for single separators, then its absolutely unacceptable
as for a solution - if that is the case - we could opt in or out based on whether its a tty - but it would trigger inconsistent line lengths
This change can cause more wrapping, but I think the consistency in output is worth it.
Here's a small demo:
from py.io import TerminalWriter
tw = TerminalWriter()
for i in range(70, 82):
msg = f'{i} chars: '
msg += 'X' * (i - len(msg))
tw.sep('=', msg)
print()
Some notably bad actors:
basically, the only time this is going to make a difference is when the centered string is N - 3
and N - 2
characters in length -- otherwise it was already going to wrap
@asottile this is about as bad as rubbing my ocd with napalm
oh right, I don't have merge or release privs here 🙃
Before:
After:
This is slightly selfish -- I'm doing this to make the output in this case possible to colorize for pygments-pytest