New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] One trailing newline ignored by rich.print in some cases #178
Comments
Reproduced with: rich 4.0.0 on Python 3.8.0 |
Reproduced with: |
Please try v4.2.0 |
Btw I don't know if you use r"""
Test examples for `rich.print`:
>>> from rich import print
>>> for i in range(3): print('Hey' + '\n' * i)
...
Hey
Hey
<BLANKLINE>
Hey
<BLANKLINE>
<BLANKLINE>
>>> print('[red]Hey[/]')
Hey
>>> print('[red]Hey[/]\n')
Hey
<BLANKLINE>
>>> print('[red]Hey[/]\n\n')
Hey
<BLANKLINE>
<BLANKLINE>
"""
import doctest
if __name__ == '__main__':
doctest.testmod() |
Might be useful occasionally, but it would be difficult to test control codes and differences across platforms with doctests. There are tests now for this case btw. |
Hi, thanks for this great library.
Not sure if this is expected behavior or a bug. In certain cases,
rich.print
handles newlines in a slightly different manner than theprint
built-in.Example:
Apparently, when the printed string contains at least one trailing newline (i.e. when
i == 1
ori == 2
), one newline is ignored byrich.print
.A screenshot of a similar example:
(rich 3.3.2, Python 3.8.0, GNOME Terminal 3.18.3 on Linux Mint 18.2 64-bit)
The text was updated successfully, but these errors were encountered: