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

fix: Use the full width of the terminal for output if it is less than the MAX_WIDTH setting #110

Merged
merged 8 commits into from
Oct 2, 2023

Conversation

ealap
Copy link
Contributor

@ealap ealap commented Jun 12, 2023

Fixes #109

Let rich.console.Console set the width from current terminal width, then override it afterwards if MAX_WIDTH setting is smaller.

@ealap
Copy link
Contributor Author

ealap commented Jun 12, 2023

Welp, looks like the console of Github Actions maxes out at 80 while expected outputs are all set to 100.

@ewels
Copy link
Owner

ewels commented Jun 12, 2023

What about adding a new flag WIDTH which works in the same way that MAX_WIDTH currently works? 🤔

@ealap
Copy link
Contributor Author

ealap commented Jun 12, 2023

@ewels I considered that idea but I thought that it was beyond the scope of what I was initially trying to fix.

Anyway, I'll give it another try 😁

- Fix ewels#109 by changing the behavior of MAX_WIDTH to still use the full width of the
  terminal if it is less than the limit
- Add new flag WIDTH to take over the previous functionality of
  MAX_WIDTH
- Adopt test expectations to new and modified configuration flags
- Add new test for MAX_WIDTH

Signed-off-by: Emmanuel Alap <15620712+ealap@users.noreply.github.com>

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch fix-max-width
# Your branch is up to date with 'origin/fix-max-width'.
#
# Changes to be committed:
#	modified:   README.md
#	modified:   src/rich_click/rich_click.py
#	modified:   src/rich_click/rich_help_configuration.py
#	modified:   src/rich_click/rich_help_formatter.py
#	modified:   tests/conftest.py
#	modified:   tests/expectations/test_rich_click[test arguments with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test arguments].config.json
#	modified:   tests/expectations/test_rich_click[test custom errors help].config.json
#	modified:   tests/expectations/test_rich_click[test custom errors with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test declarative with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test declarative].config.json
#	modified:   tests/expectations/test_rich_click[test environment variables with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test envvar].config.json
#	modified:   tests/expectations/test_rich_click[test group sorting].config.json
#	modified:   tests/expectations/test_rich_click[test groups sorting with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test markdown with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test markdown].config.json
#	modified:   tests/expectations/test_rich_click[test metavars default with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test metavars default].config.json
#	modified:   tests/expectations/test_rich_click[test metavars with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test metavars].config.json
#	modified:   tests/expectations/test_rich_click[test rich markup with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test rich markup].config.json
#	modified:   tests/expectations/test_rich_click[test simple with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test simple].config.json
#	modified:   tests/expectations/test_rich_click[test table styles with rich_config].config.json
#	modified:   tests/expectations/test_rich_click[test table styles].config.json
#	modified:   tests/test_help.py
#
@dwreeves
Copy link
Collaborator

Making sure this can still eventually get merged -- ealap#1

@ewels
Copy link
Owner

ewels commented Sep 24, 2023

@dwreeves - now that you're a maintainer on this repo, I think that you should be able to push the changes you did to fix the merge conflicts already directly to this PR. Hopefully means we can get it ready to merge.

CleanShot 2023-09-24 at 22 31 32@2x

@dwreeves
Copy link
Collaborator

Nice! I'll work on this (and a couple other open issues) without bugging you directly then.

@dwreeves dwreeves merged commit 277a5e4 into ewels:main Oct 2, 2023
32 checks passed
@dwreeves
Copy link
Collaborator

dwreeves commented Oct 2, 2023

Thanks for the PR @ealap!

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.

MAX_WIDTH setting acts only as fixed width
3 participants