From 59d351168e81506eff5e7d8f5746699d1e100044 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Tue, 9 Nov 2021 16:30:25 +0000 Subject: [PATCH] new lines fixes --- CHANGELOG.md | 7 +++++++ rich/live.py | 2 -- rich/progress.py | 4 +++- tests/test_live.py | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0528827..804769d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [10.13.1] - Unreleased + +### Fixed + +- Fixed progress speed not updating when total doesn't change +- Fixed superfluous new line in Status https://github.com/willmcgugan/rich/issues/1662 + ## [10.13.0] - 2021-11-07 ### Added diff --git a/rich/live.py b/rich/live.py index cb36ddb8..8097f7d2 100644 --- a/rich/live.py +++ b/rich/live.py @@ -159,8 +159,6 @@ class Live(JupyterMixin, RenderHook): # jupyter last refresh must occur after console pop render hook # i am not sure why this is needed self.refresh() - if not self.console.is_interactive: - return self.console.print() def __enter__(self) -> "Live": self.start(refresh=self._renderable is not None) diff --git a/rich/progress.py b/rich/progress.py index 8f2ec026..1f670db4 100644 --- a/rich/progress.py +++ b/rich/progress.py @@ -645,6 +645,8 @@ class Progress(JupyterMixin): def stop(self) -> None: """Stop the progress display.""" self.live.stop() + if not self.console.is_interactive: + self.console.print() def __enter__(self) -> "Progress": self.start() @@ -764,7 +766,7 @@ class Progress(JupyterMixin): task = self._tasks[task_id] completed_start = task.completed - if total is not None: + if total is not None and total != task.total: task.total = total task._reset() if advance is not None: diff --git a/tests/test_live.py b/tests/test_live.py index 80002e54..0c732f63 100644 --- a/tests/test_live.py +++ b/tests/test_live.py @@ -158,7 +158,7 @@ def test_growing_display_file_console() -> None: output = console.end_capture() assert ( output - == "Step 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep 9\n\n" + == "Step 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep 9\n" )