Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimization for measure #1936

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ 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
## [11.2.0] - 2022-02-08

### Added

- Add support for US spelling of "gray" in ANSI color names https://github.com/Textualize/rich/issues/1890
- Added `rich.diagnose.report` to expose environment debugging logic as function https://github.com/Textualize/rich/pull/1917
- Added classmethod `Progress.get_default_columns()` to get the default list of progress bar columns https://github.com/Textualize/rich/pull/1894

### Fixed

- Fixed performance issue in measuring text

## [11.1.0] - 2022-01-28

### Added


- Workaround for edge case of object from Faiss with no `__class__` https://github.com/Textualize/rich/issues/1838
- Add Traditional Chinese readme
- Add `Syntax.guess_lexer`, add support for more lexers (e.g. Django templates etc.) https://github.com/Textualize/rich/pull/1869
Expand Down Expand Up @@ -1627,6 +1630,7 @@ Major version bump for a breaking change to `Text.stylize signature`, which corr

- First official release, API still to be stabilized

[11.2.0]: https://github.com/willmcgugan/rich/compare/v11.1.0...v11.2.0
[11.1.0]: https://github.com/willmcgugan/rich/compare/v11.0.0...v11.1.0
[11.0.0]: https://github.com/willmcgugan/rich/compare/v10.16.1...v11.0.0
[10.16.1]: https://github.com/willmcgugan/rich/compare/v10.16.0...v10.16.1
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "rich"
homepage = "https://github.com/willmcgugan/rich"
documentation = "https://rich.readthedocs.io/en/latest/"
version = "11.1.0"
version = "11.2.0"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
authors = ["Will McGugan <[email protected]>"]
license = "MIT"
Expand Down
6 changes: 4 additions & 2 deletions rich/measure.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from operator import itemgetter
from typing import Callable, Iterable, NamedTuple, Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Callable, Iterable, NamedTuple, Optional

from . import errors
from .protocol import is_renderable, rich_cast
Expand Down Expand Up @@ -96,7 +96,9 @@ def get(
if _max_width < 1:
return Measurement(0, 0)
if isinstance(renderable, str):
renderable = console.render_str(renderable, markup=options.markup)
renderable = console.render_str(
renderable, markup=options.markup, highlight=False
)
renderable = rich_cast(renderable)
if is_renderable(renderable):
get_console_width: Optional[
Expand Down