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

Error when concatenating unstyled unicode symbol #90

Open
hexaeder opened this issue Sep 10, 2024 · 3 comments
Open

Error when concatenating unstyled unicode symbol #90

hexaeder opened this issue Sep 10, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@hexaeder
Copy link

julia> using StyledStrings
julia> "τ" * styled"{blue:blue}" # errors
"Error showing value of type Base.AnnotatedString{String}:
ERROR: StringIndexError: invalid index [2], valid nearby indices [1]=>'τ', [3]=>'b'

when explicitly giving default style it works

styled"τ" * styled"{blue:blue}" # no style errors
styled"{default:τ}"*styled"{blue:blue}" # explicit default style works
@hexaeder hexaeder changed the title Error when concating unstyled unicode symbol Error when concatenating unstyled unicode symbol Sep 10, 2024
hexaeder added a commit to JuliaDynamics/NetworkDynamics.jl that referenced this issue Sep 10, 2024
@tecosaur
Copy link
Collaborator

tecosaur commented Sep 10, 2024

This is really two issues:

  1. An oversight with multi-codeunit strings
  2. Printing trying to access invalid codeunits

(2) has already been fixed in #86, and (1) seems to be working in a development version of Julia + StyledStrings locally, so I suspect this is just a matter of the fixes being released.

julia> s = "τ" * styled"{blue:blue}"
"τblue"

julia> show(s)
Base.AnnotatedString{String}("τblue", [@NamedTuple{region::UnitRange{Int64}, label::Symbol, value}((3:6, :face, :blue))])

@tecosaur
Copy link
Collaborator

tecosaur commented Sep 10, 2024

I'll check the compat release of StyledStrings for this issue on the weekend.

@tecosaur tecosaur added the bug Something isn't working label Oct 15, 2024
@tecosaur
Copy link
Collaborator

I'm now doing the "backport the new stuff" run for the compat release, sorting this out will be part of that work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants