Skip to content

Remove instances of broadcasting #109

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

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/faces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,18 @@ function Face(; font::Union{Nothing, String} = nothing,
else inherit end)
end

Base.:(==)(a::Face, b::Face) =
getfield.(Ref(a), fieldnames(Face)) ==
getfield.(Ref(b), fieldnames(Face))
function Base.:(==)(a::Face, b::Face)
a.font == b.font &&
a.height === b.height &&
a.weight == b.weight &&
a.slant == b.slant &&
a.foreground == b.foreground &&
a.background == b.background &&
a.underline == b.underline &&
a.strikethrough == b.strikethrough &&
a.inverse == b.inverse &&
a.inherit == b.inherit
end

Base.hash(f::Face, h::UInt) =
mapfoldr(Base.Fix1(getfield, f), hash, fieldnames(Face), init=hash(Face, h))
Expand Down Expand Up @@ -714,7 +723,7 @@ function Base.convert(::Type{Face}, spec::Dict{String,Any})
elseif spec["inherit"] isa String
[Symbol(spec["inherit"]::String)]
elseif spec["inherit"] isa Vector{String}
Symbol.(spec["inherit"]::Vector{String})
[Symbol(name) for name in spec["inherit"]::Vector{String}]
else
Symbol[]
end)
Expand Down
2 changes: 1 addition & 1 deletion src/legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ legacy_color(color::Symbol) =
end

function legacy_color(color::String)
namedcolours = String.(NAMED_COLORS)
namedcolours = map(String, NAMED_COLORS)
if color in namedcolours
legacy_color(Symbol(color))
elseif 0 <= (color256 = something(tryparse(Int, color), -1)) <= 255
Expand Down