Skip to content

Commit

Permalink
optimization for measure
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Feb 8, 2022
1 parent b67d7aa commit 429c6d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
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 <willmcgugan@gmail.com>"]
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

0 comments on commit 429c6d3

Please sign in to comment.