-
Notifications
You must be signed in to change notification settings - Fork 454
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
Utilize rich "soft_wrap" feature for Improved Display #861
Conversation
Cool, can you share a before and after output? Also black is not happy here, so please address. |
floss/render/default.py
Outdated
@@ -301,7 +301,7 @@ def get_color(color): | |||
|
|||
def render(results: floss.results.ResultDocument, verbose, disable_headers, color): | |||
sys.__stdout__.reconfigure(encoding="utf-8") | |||
console = Console(file=io.StringIO(), color_system=get_color(color), highlight=False) | |||
console = Console(file=io.StringIO(), color_system=get_color(color), highlight=False, redirect=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be using soft_wrap=True
? i don't see how this change affects the wrapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we could also achieve this with rich
and setting soft_wrap=True
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, my mistake! You're right. Using rich
and turning on soft_wrap=True
would definitely give us the result we want. Thanks for letting me know! 😅
We can leverage the
rich
library'ssoft_wrap
feature, which neatly handles line breaks while maintaining the string's integrity.Reference:- https://github.com/pycontribs/enrich
Fixes:- #826