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

Render height fix #2246

Merged
merged 6 commits into from May 3, 2022
Merged

Render height fix #2246

merged 6 commits into from May 3, 2022

Conversation

darrenburns
Copy link
Member

@darrenburns darrenburns commented May 3, 2022

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Fixes the following example:

    from rich.console import Console
    from rich.padding import Padding

    console = Console()
    options = console.options.update_height(1)

    padding = Padding("hello", pad=(1, 1, 1, 1))
    console.render_lines(padding, options=options)

The height is ending up negative when specified as 1, because we subtract the vertical padding from it (1-2 = -1). It gets passed to itertools.islice in render_lines as the "stop" argument, and that bombs out.

@codecov-commenter
Copy link

codecov-commenter commented May 3, 2022

Codecov Report

Merging #2246 (8d8532d) into master (14d47c9) will decrease coverage by 0.08%.
The diff coverage is 95.91%.

@@            Coverage Diff             @@
##           master    #2246      +/-   ##
==========================================
- Coverage   98.88%   98.79%   -0.09%     
==========================================
  Files          73       73              
  Lines        7629     7659      +30     
==========================================
+ Hits         7544     7567      +23     
- Misses         85       92       +7     
Flag Coverage Δ
unittests 98.79% <95.91%> (-0.09%) ⬇️

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

Impacted Files Coverage Δ
rich/_export_format.py 100.00% <ø> (ø)
rich/console.py 98.28% <95.87%> (-0.50%) ⬇️
rich/terminal_theme.py 100.00% <100.00%> (ø)
rich/traceback.py 98.68% <0.00%> (-0.88%) ⬇️

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 da3d59d...8d8532d. Read the comment docs.

@darrenburns darrenburns marked this pull request as ready for review May 3, 2022 11:39
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