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

Why inserting extra characters after wrapping? #12

Open
pedrormjunior opened this issue Aug 7, 2019 · 0 comments
Open

Why inserting extra characters after wrapping? #12

pedrormjunior opened this issue Aug 7, 2019 · 0 comments

Comments

@pedrormjunior
Copy link

I have noticed that after wrapping, this code is inserting some characters by calling the function ansi_terminate_lines. As it is disturbing the behavior I would expect, I would like to know why this function is being called at the end of the wrap function.

return ansi_terminate_lines(wrapped)

My situation is the following: I have a string s with multiple lines (i.e., multiple '\n') with lots of ANSI code all along. When calling ansiwrap.fill(s, replace_whitespace=False), it does not work properly, as it is breaking the line before the width although the next word in the following line would fill properly in the same line.

Then I decided to split s as s.split('\n') and apply ansiwrap.fill(line) as x = [ansiwrap.fill(line, width=columns) for line in s.split('\n')] for joining the result later: s = '\n'.join(x).

In this case, however, some ANSI code in the previous line that should affect the next line is not affecting anymore. By removing the ansi_terminate_lines it works fine for me.

Thank you for the initiative!

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

No branches or pull requests

1 participant