-
-
Notifications
You must be signed in to change notification settings - Fork 12
Closed as not planned
Description
Some low level StyledStrings
functions are not pure, they depend on global states e.g. Base.have_truecolor
, ...
E.g.:
Lines 116 to 120 in 8985a37
if Base.get_have_truecolor() | |
termcolor24bit(io, color.value, category) | |
else | |
termcolor8bit(io, color.value, category) | |
end |
which induces annoying workarounds such as
StyledStrings.jl/test/runtests.jl
Lines 23 to 32 in 8985a37
prev_terminfo = getglobal(Base, :current_terminfo) | |
prev_truecolor = getglobal(Base, :have_truecolor) | |
try | |
setglobal!(Base, :current_terminfo, tinfo) | |
setglobal!(Base, :have_truecolor, haskey(tinfo, :setrgbf)) | |
fn() | |
finally | |
setglobal!(Base, :current_terminfo, prev_terminfo) | |
setglobal!(Base, :have_truecolor, prev_truecolor) | |
end |
This is currently blocking in my trial PR to transition from Crayons.jl to the StyledsStrings
stdlib, for UnicodePlots.jl.
Also, I'm not sure transitioning will lead to a performance statu quo or gain in terms of performance / allocations.
Metadata
Metadata
Assignees
Labels
No labels