Skip to content

Commit

Permalink
Don't display() spurious newlines in jupyter
Browse files Browse the repository at this point in the history
Fixes #3274
  • Loading branch information
NickCrews authored Apr 12, 2024
1 parent 0d7e598 commit 8408b4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rich/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,11 @@ def _check_buffer(self) -> None:
if self.is_jupyter: # pragma: no cover
from .jupyter import display

display(self._buffer, self._render_buffer(self._buffer[:]))
content = self._render_buffer(self._buffer[:])
# display() always prints a newline, so if we got no content then
# we don't want a single newline appearing
if content:
display(self._buffer, content)
del self._buffer[:]
else:
if WINDOWS:
Expand Down

0 comments on commit 8408b4c

Please sign in to comment.