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

Disable line-wrap when output is being redirected #1782

Open
ap0llo opened this issue Mar 24, 2025 · 0 comments
Open

Disable line-wrap when output is being redirected #1782

ap0llo opened this issue Mar 24, 2025 · 0 comments

Comments

@ap0llo
Copy link
Contributor

ap0llo commented Mar 24, 2025

(Please correct me if this already exists)

Is your feature request related to a problem? Please describe.
In my application, we use Spectre.Console for all outputs and logging.
The output is often time longer than 80 characters which works fine for most users since their console is usually wide enough and Spectre.Console uses the current width.

However, when the output is being redirected to a file, the width defaults to 80 which causes lots of line-breaks to be inserted.
In this use case, it would be preferrable to not wrap any lines in case that the output is being redirected.

Describe the solution you'd like
It would be really useful to have an option to disable line wrapping for a specific IAnsiConsole.
I would enable this option when I detect that the output is being redirected.

Describe alternatives you've considered

As a workaround, I'm setting the width to a value > 80 in case the output is being redirected. However, this has some downsides

  • Widgets like Table will take up the full width of the terminal, so I cannot set the width arbitrarily high
  • Lines longer than the width will still be wrapped

I guess the way to really diable all wrapping would be setting the Width to int.MaxValue but that would result in really wide tables.


Please upvote 👍 this issue if you are interested in it.

@github-project-automation github-project-automation bot moved this to Todo 🕑 in Spectre Console Mar 24, 2025
@ap0llo ap0llo changed the title Diable line-wrap when output is being redirected Disable line-wrap when output is being redirected Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo 🕑
Development

No branches or pull requests

1 participant