From db0d1f2655fee383b449e2a03fd10c3ed4783864 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Mon, 14 Mar 2022 15:42:11 +0100 Subject: [PATCH] Fix print order bug --- src/EnumX.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EnumX.jl b/src/EnumX.jl index 8224166..f13b0d9 100644 --- a/src/EnumX.jl +++ b/src/EnumX.jl @@ -114,12 +114,12 @@ function Base.show(io::IO, ::MIME"text/plain", ::Base.Type{E}) where E <: Enum iob = IOBuffer() insts = Base.Enums.instances(E) n = length(insts) - stringmap = Dict{String, Int32}( + stringmap = Pair{String, Base.Enums.basetype(E)}[ string("$(nameof(parentmodule(E))).", k) => v for (k, v) in symbol_map(E) - ) - mx = maximum(textwidth, keys(stringmap); init = 0) + ] + mx = maximum(x -> textwidth(x.first), stringmap; init = 0) print(iob, - "Enum type $(nameof(parentmodule(E))).Type <: ", + "Enum type $(nameof(parentmodule(E))).$(nameof(E)) <: ", "Enum{$(Base.Enums.basetype(E))} with $(n) instance$(n == 1 ? "" : "s"):" ) for (k, v) in stringmap