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

add code_width in traceback #2870

Merged
merged 1 commit into from
Jul 1, 2024
Merged

add code_width in traceback #2870

merged 1 commit into from
Jul 1, 2024

Conversation

LCH-1
Copy link
Contributor

@LCH-1 LCH-1 commented Mar 9, 2023

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

Please describe your changes here. If this fixes a bug, please link to the issue, if possible.

#2795

add code_width option for traceback

from rich.traceback import install

install(
    width=120,
    code_width=120, # new option
    word_wrap=True,
)

or

import logging
from rich.logging import RichHandler

logging.basicConfig(
    handlers=[
        RichHandler(
            rich_tracebacks=True,
            tracebacks_code_width=120, # new option
        )
    ],
)

before
image

after
image

@willmcgugan willmcgugan merged commit 4bd7108 into Textualize:master Jul 1, 2024
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.

2 participants