fix broken annotate! for AnnotatedChar#60488
Conversation
this sounds like a fair suggestion, but since |
Are you sure? It's in the list of public names: |
|
ah, you are right I was looking at |
|
The API used to be based on - annotate!(str::AnnotatedString, [range::UnitRange{Int}], label::Symbol => value)
- annotate!(str::SubString{AnnotatedString}, [range::UnitRange{Int}], label::Symbol => value)
+ annotate!(str::AnnotatedString, [range::UnitRange{Int}], label::Symbol, value)
+ annotate!(str::SubString{AnnotatedString}, [range::UnitRange{Int}], label::Symbol, value)This bugfix (thanks!) seems to correct an oversight from #55741. There is still some scope for adjusting this API, because while it is the intended point for annotations to be changed (hence the https://docs.julialang.org/en/v1/manual/strings/#man-annotated-strings
We should discuss whether any changes are worth it somewhere else though I think, it isn't worth holding up this bugfix PR. |
The function
annotate!has been broken forAnnotatedChar, at least since the inclusion StyledStrings.jl into Julia 1.11:This PR fixed this:
(The red color is shown in the REPL.)
Side remark: Given that no-one can use this function at present, I wonder if one should reconsider the choice of arguments. Even if the annotations do not form a dictionary, I would see some benefit in writing
An extension to more than one annotation
would then be more natural.