Closed ericfrederich closed 2 months ago
Rich syntax doesn't just apply highlighting to a stream of text. It changes tabs to spaces, wraps or truncates lines. It can add line numbers, indentation guides etc. i.e. it makes no guarantee that all it will do is add color.
I hope we solved your problem.
If you like using Rich, you might also enjoy Textual
Describe the bug
While running
rich.syntax
as a module a new line is added on each invocation.Provide a minimal code example that demonstrates the issue if you can. If the issue is visual in nature, consider posting a screenshot.
I use an alias of
alias hili='python -m rich.syntax -b default'
. It always adds a newline. Subsequent invocations of this do as well.When running through
xxd
you can see it adding newlines (0x0A
) characters. Ideally when running through a pipe nothing should be modified.Platform
Click to expand
> What platform (Win/Linux/Mac) are you running on? What terminal software are you using? Linux VM (via WSL2) > I may ask you to copy and paste the output of the following commands. It may save some time if you do it now. > > If you're using Rich in a terminal: > > ``` > python -m rich.diagnose > pip freeze | grep rich > ``` ``` # python -m rich.diagnose ╭───────────────────────