-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
Use rich instead of ansiwrap to wrap text #1693
Use rich instead of ansiwrap to wrap text #1693
Conversation
…ept that it is un-colorizing the indent character
# Conflicts: # poetry.lock
I am not sure why this last test is failing:
Adding a space to the end of the second line makes it pass. However, when I run the test with manual jrnl commands, I don't see that extra space. The original test result may seem a bit odd, too: the last word is on its own line. Both the original ansiwrap and the new rich wrappers are giving it its own line because the source data is actually already wrapped, and this is the only line in the source data that is at least as long as the linewrap value (80 characters). In fact, it's exactly the length of the linewrap value. Still, I have no explanation as to why this space isn't being preserved in my manual tests. It would be nice to know what's going on instead of just changing the test to make it pass. |
poetry.lock retrieved from develop then re-locked with poetry lock --no-update
We found that the issue is that rich doesn't remove trailing spaces when it wraps, whereas ansiwrap did. We're staying with rich's default behavior and I've made a note about this in the PR description. |
… preserves spaces
…r, which preserves spaces" This reverts commit c0faa67.
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.
🫡
Ansiwrap hasn't been updated in several years, and looks like it will break with Python 3.12. Rich bring quite a few sub-dependencies, but is more powerful than it is being used here and actively developed. c.f. jrnl-org/jrnl#1693
Fixes #1191. This PR removes ansiwrap and uses rich instead. It only affects "pretty printing" -- the default display format that jrnl uses.
⚠ This PR modifies the line wrapping behavior slightly: the old method removed trailing spaces, whereas this new method includes them. We don't consider this a breaking change because this format is meant to be read by humans instead of machines.
Checklist
for the same issue.