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

reset height of children #2043

Merged
merged 8 commits into from Mar 10, 2022
Merged

reset height of children #2043

merged 8 commits into from Mar 10, 2022

Conversation

willmcgugan
Copy link
Collaborator

@willmcgugan willmcgugan commented Mar 9, 2022

Reset height of children in render.

Fix for #2042

When rendering an object with a height, that height is passed to the renderable via options. The problem was that any renderables yielded by __rich_console__ were passed that same height, which was not intended.

This change ensures that height is reset for these sub objects.

Also removes tabulate.py which was marked for deprecation a while ago.

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2022

Codecov Report

Merging #2043 (ebf4c90) into master (91e0146) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2043      +/-   ##
==========================================
- Coverage   99.49%   99.49%   -0.01%     
==========================================
  Files          73       72       -1     
  Lines        7361     7337      -24     
==========================================
- Hits         7324     7300      -24     
  Misses         37       37              
Flag Coverage Δ
unittests 99.49% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rich/align.py 100.00% <ø> (ø)
rich/layout.py 100.00% <ø> (ø)
rich/console.py 99.63% <100.00%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c6d1cd...ebf4c90. Read the comment docs.

@willmcgugan willmcgugan merged commit d72f319 into master Mar 10, 2022
Copy link
Member

@darrenburns darrenburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor docstring change suggested, take it or leave it :)

@@ -25,14 +24,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix syntax lexer guessing.
- Fixed Pretty measure not respecting expand_all https://github.com/Textualize/rich/issues/1998
- Collapsed definitions for single-character spinners, to save memory and reduce import time.
- Fix print_json indent type in __init__.py
- Fix print_json indent type in **init**.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly an issue but just curious - is this some markdown formatter thing that caused this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that may have been vscode. I need to put it inside backticks.

@@ -224,6 +224,16 @@ def update_height(self, height: int) -> "ConsoleOptions":
options.max_height = options.height = height
return options

def reset_height(self) -> "ConsoleOptions":
"""Resets the height to None.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring makes it sound like the method is doing self.height = None

Suggested change
"""Resets the height to None.
"""Returns a copy of the ConsoleOptions with height=None

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

I had auto-merge on. Feel free to "request changes" if there is a worthwhile change.

@willmcgugan willmcgugan deleted the reset-height branch March 10, 2022 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants