From 7e83aa415e2ad0e244df133da11f76c3fd3f90b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Richard?= Date: Wed, 13 May 2026 16:46:22 +0200 Subject: [PATCH 1/2] Change display in :compact IOContext --- src/root_object.jl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/root_object.jl b/src/root_object.jl index 3b997f7..e5ae3eb 100644 --- a/src/root_object.jl +++ b/src/root_object.jl @@ -57,11 +57,8 @@ isunique(rt::Root{T}) where {T} = (rt.status == :unique) function show(io::IO, rt::Root) print(io, "Root($(rt.region), :$(rt.status))") -end -function show(io::IO, ::MIME"text/plain", rt::Root) - show(io, rt) - if rt.status == :unknown + if !get(io, :compact, false) && rt.status == :unknown if rt.convergence == :tolerance print(io, "\n Not converged: region size smaller than the tolerance") elseif rt.convergence == :max_iterartion From 48f0a8201344b37a82e635c42e172efe328f4b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Richard?= Date: Wed, 13 May 2026 17:11:29 +0200 Subject: [PATCH 2/2] Use fancy connectors to group the information --- src/root_object.jl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/root_object.jl b/src/root_object.jl index e5ae3eb..5292cc5 100644 --- a/src/root_object.jl +++ b/src/root_object.jl @@ -59,18 +59,20 @@ function show(io::IO, rt::Root) print(io, "Root($(rt.region), :$(rt.status))") if !get(io, :compact, false) && rt.status == :unknown + connector = isnothing(rt.error) ? "└" : "├" + if rt.convergence == :tolerance - print(io, "\n Not converged: region size smaller than the tolerance") + print(io, "\n $connector Not converged: region size smaller than the tolerance") elseif rt.convergence == :max_iterartion - print(io, "\n Not converged: reached maximal number of iterations") + print(io, "\n $connector Not converged: reached maximal number of iterations") elseif rt.convergence == :none - print(io, "\n Not converged: the root is still being processed") + print(io, "\n $connector Not converged: the root is still being processed") else - print(io, "\n Not converged: unknown reason $(rt.convergence)") + print(io, "\n $connector Not converged: unknown reason $(rt.convergence)") end if !isnothing(rt.error) - print(io, "\n Warning: error encountered during computation (use showerror(root.error) to see the whole stacktrace)\n ") + print(io, "\n ├ Warning: error encountered during computation (use showerror(root.error) to see the whole stacktrace)\n └ ") showerror(io, rt.error[1]) end end