This commit is contained in:
Will McGugan 2022-02-26 19:03:23 +00:00
parent 4b3b6531ad
commit 3b1518f943
3 changed files with 20 additions and 7 deletions

View File

@ -10,18 +10,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added ProgressColumn `MofNCompleteColumn` to display raw `completed/total` column (similar to DownloadColumn,
but displays values as ints, does not convert to floats or add bit/bytes units).
but displays values as ints, does not convert to floats or add bit/bytes units).
https://github.com/Textualize/rich/pull/1941
### Fixed
- In Jupyter mode make the link target be set to "_blank"
- In Jupyter mode make the link target be set to "\_blank"
- Fix some issues with markup handling around "[" characters https://github.com/Textualize/rich/pull/1950
- Fix syntax lexer guessing.
- Fixed Pretty measure not respecting expand_all https://github.com/Textualize/rich/issues/1998
### Added
### Change
- Add support for enum.Flag in ReprHighlighter https://github.com/Textualize/rich/pull/1920
- Improved support for enum.Flag in ReprHighlighter https://github.com/Textualize/rich/pull/1920
## [11.2.0] - 2022-02-08

View File

@ -323,6 +323,7 @@ class Pretty(JupyterMixin):
indent_size=self.indent_size,
max_length=self.max_length,
max_string=self.max_string,
expand_all=self.expand_all,
)
text_width = (
max(cell_len(line) for line in pretty_str.splitlines()) if pretty_str else 0

View File

@ -1,15 +1,16 @@
import io
import sys
from array import array
from collections import defaultdict, UserDict
from collections import UserDict, defaultdict
from dataclasses import dataclass, field
from typing import List
import attr
import pytest
from dataclasses import dataclass, field
from rich.console import Console
from rich.pretty import install, Pretty, pprint, pretty_repr, Node, _ipy_display_hook
from rich.measure import Measurement
from rich.pretty import Node, Pretty, _ipy_display_hook, install, pprint, pretty_repr
from rich.text import Text
skip_py36 = pytest.mark.skipif(
@ -464,3 +465,13 @@ def test_lying_attribute():
foo = Foo()
result = pretty_repr(foo)
assert "Foo" in result
def test_measure_pretty():
"""Test measure respects expand_all"""
# https://github.com/Textualize/rich/issues/1998
console = Console()
pretty = Pretty(["alpha", "beta", "delta", "gamma"], expand_all=True)
measurement = console.measure(pretty)
assert measurement == Measurement(12, 12)