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

Ignore ANSI colour codes in printing Diagonal, etc #47430

Merged
merged 3 commits into from
Nov 3, 2022

Conversation

mcabbott
Copy link
Contributor

@mcabbott mcabbott commented Nov 2, 2022

Follow-up to #45751

Uses ANSIIterator from #45521 so that the printing of structured matrices isn't thrown off by the presence of invisible colour codes.

@KristofferC KristofferC added the backport 1.8 Change should be backported to release-1.8 label Nov 2, 2022
@jariji
Copy link
Contributor

jariji commented Nov 2, 2022

https://github.com/JuliaLang/julia/pull/47430/files#diff-63cd93d3cd07c385b6902e3d5da2bc8f8bb4d3c7a5f70287d22df0212572c9c4R2383

mius -> minus

@KristofferC KristofferC merged commit 9f572b6 into JuliaLang:master Nov 3, 2022
@mcabbott mcabbott deleted the patch-3 branch November 3, 2022 13:23
@KristofferC KristofferC mentioned this pull request Nov 8, 2022
26 tasks
KristofferC pushed a commit that referenced this pull request Dec 14, 2022
KristofferC pushed a commit that referenced this pull request Dec 14, 2022
KristofferC pushed a commit that referenced this pull request Dec 14, 2022
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label Dec 14, 2022
jishnub pushed a commit to JuliaArrays/BlockArrays.jl that referenced this pull request Jan 12, 2025
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](https://github.com/user-attachments/assets/722037b0-aeb1-4aca-b8aa-2c603290cf02)
With this, it displays as:

![image](https://github.com/user-attachments/assets/a0d5098d-8d5a-4019-a733-2a1acbcdaa4a)
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.

3 participants