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

printing with styled/non-unit-textwidth-character contents #443

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

thchr
Copy link

@thchr thchr commented Dec 17, 2024

Previously, BlockArrays with elements that used styling would throw off the printing, because the textwidth computation didn't account for the fact that some contents might have a different length relative to how much space they take up when printed.

This fixes that by using the ANSIIterator from Base, ala JuliaLang/julia#47430. Unfortunately, ANSIIterator isn't exported at the moment - but the alternative is to depend on StringManipulations.jl or copy over the Base implementation.

I added a test that shows the problem. Previously, it displayed as:
image
With this, it displays as:
image

@thchr thchr changed the title printing of BlockArrays with styled/non-unit-textwidth-character contents printing with styled/non-unit-textwidth-character contents Dec 17, 2024
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.55%. Comparing base (4d386cf) to head (4ea3b1d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #443   +/-   ##
=======================================
  Coverage   93.55%   93.55%           
=======================================
  Files          18       18           
  Lines        1644     1644           
=======================================
  Hits         1538     1538           
  Misses        106      106           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

1 participant