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

Utilize rich "soft_wrap" feature for Improved Display #861

Merged
merged 3 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions floss/render/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from rich import box
from rich.table import Table
from rich.markup import escape
from rich.console import Console
from enrich.console import Console

import floss.utils as util
import floss.logging_
Expand Down Expand Up @@ -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)
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, the soft_wrap parameter is already set to true by default.


Screenshot from 2023-08-21 17-07-36

Copy link
Collaborator

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?

Copy link
Collaborator Author

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! 😅


if not disable_headers:
console.print("\n")
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"halo==0.0.31",
"rich==13.4.2",
"pefile>=2022.5.30",
"enrich==1.2.7",
]

# this sets __version__
Expand Down