diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index dbadb79d8..40685a56e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [windows-latest, ubuntu-latest, macos-latest] - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11.0-beta.4"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] defaults: run: shell: bash @@ -36,15 +36,9 @@ jobs: source $VENV make typecheck - name: Test with pytest (with coverage) - if: matrix.python-version != '3.11.0-beta.4' run: | source $VENV pytest tests -v --cov=./rich --cov-report=xml:./coverage.xml --cov-report term-missing - - name: Test with pytest (no coverage) - if: matrix.python-version == '3.11.0-beta.4' - run: | - source $VENV - pytest tests -v - name: Upload code coverage uses: codecov/codecov-action@v2 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 90cd313d6..4b2800e89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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). +## [Unreleased] + +### Fixed + +- Fix NO_COLOR support on legacy Windows https://github.com/Textualize/rich/pull/2458 + ## [12.5.2] - 2022-07-18 ### Added diff --git a/rich/console.py b/rich/console.py index 8c6049a49..4f4675b10 100644 --- a/rich/console.py +++ b/rich/console.py @@ -1996,9 +1996,11 @@ def _check_buffer(self) -> None: from rich._win32_console import LegacyWindowsTerm from rich._windows_renderer import legacy_windows_render - legacy_windows_render( - self._buffer[:], LegacyWindowsTerm(self.file) - ) + buffer = self._buffer[:] + if self.no_color and self._color_system: + buffer = list(Segment.remove_color(buffer)) + + legacy_windows_render(buffer, LegacyWindowsTerm(self.file)) else: # Either a non-std stream on legacy Windows, or modern Windows. text = self._render_buffer(self._buffer[:])