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

[BUG] highlight keyword does not affect padded content #1404

Closed
rybesh opened this issue Aug 12, 2021 · 3 comments
Closed

[BUG] highlight keyword does not affect padded content #1404

rybesh opened this issue Aug 12, 2021 · 3 comments

Comments

@rybesh
Copy link

rybesh commented Aug 12, 2021

Describe the bug

The highlight keyword does not affect padded text, either to turn highlighting off or to turn it on.

To Reproduce

from rich.console import Console
from rich.padding import Padding
console = Console(highlight=True)
console.print(Padding("1 2 3 4", (1,1)), highlight=False)

Expected output: numbers are not highlighted.
Actual output: numbers are highlighted.

from rich.console import Console
from rich.padding import Padding
console = Console(highlight=False)
console.print(Padding("1 2 3 4", (1,1)), highlight=True)

Expected output: numbers are highlighted.
Actual output: numbers are not highlighted.

Platform

macOS 11.5.1
iTerm2 3.4.8
rich==10.7.0

@mlittlec
Copy link

Reproduced the behaviour on Windows 10 (and Windows 11 Beta)

Platform

MS Windows 10 (and 11 Beta)
Windows Terminal 1.9.1942.0
rich==10.0.7.0

Possible explanation
It appears that setting this line:

console = Console(highlight=False)

overrides the use of the 'highlight=True' in this line:

console.print(Padding("1 2 3 4", (1,1)), highlight=True)

It unclear to me at this time whether there is any hierarchy controlling whether it is possible to override the systemwide setting of 'highlight' variable in the Console() function or not.

@willmcgugan
Copy link
Collaborator

Should be fixed in v10.8.0

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Aug 29, 2021
10.8.0

Added

Added Panel.subtitle
Added Panel.subtitle_align
Added rich.json.JSON
Added rich.print_json and Console.print_json

Fixed

Fixed a bug where calling rich.reconfigure within a pytest_configure hook would lead to a crash
Fixed highlight not being passed through options Textualize/rich#1404
@github-actions
Copy link

github-actions bot commented Sep 3, 2021

Did I solve your problem?

Consider sponsoring the ongoing work on Rich and Textual.

Or buy me a coffee to say thanks.

Will McGugan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants