Skip to content

Conversation

@Faheem12005
Copy link

@Faheem12005 Faheem12005 commented Dec 24, 2025

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

AI?

  • AI was used to generate this PR

AI generated PRs may be accepted, but only if @willmcgugan has responded on an issue or discussion.

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate (see note about typos above).
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

When Live is used with an empty renderable like an empty list, it still emits a newline because an empty renderable is treated as producing one renderable line. As a result, Live advances the cursor and leaves behind a blank line even though nothing was rendered.

This PR fixes the issue by detecting empty renderables during the render phase and preventing Live from advancing the cursor when no renderable output is produced.

Can be tested with this snippet:

from rich.live import Live
from rich.console import Console

console = Console()

with Live([], console=console):
    pass

Fixes #3796

@Faheem12005 Faheem12005 marked this pull request as ready for review December 25, 2025 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Live with empty render leaves behind a spurious newline

1 participant