diff --git a/src/AbstractAlgebra.jl b/src/AbstractAlgebra.jl index 3517fee901..d12f563436 100644 --- a/src/AbstractAlgebra.jl +++ b/src/AbstractAlgebra.jl @@ -381,8 +381,10 @@ macro show_name(io, O) set_name!(o, s) end end - if get(i, :compact, false) && - s !== nothing + if get(i, :compact, false) && s !== nothing + if AbstractAlgebra.PrettyPrinting._supports_io_custom(i) + print(i, LowercaseOff()) + end print(i, s) return end diff --git a/src/PrettyPrinting.jl b/src/PrettyPrinting.jl index 685885ffeb..613e0fbbb9 100644 --- a/src/PrettyPrinting.jl +++ b/src/PrettyPrinting.jl @@ -1504,9 +1504,12 @@ mutable struct IOCustom{IO_t <: IO} <: Base.AbstractPipe end _unwrap(io::IOCustom) = io - _unwrap(io::IOContext) = io.io +_supports_io_custom(io::IOCustom) = true +_supports_io_custom(io::IOContext) = _supports_io_custom(io.io) +_supports_io_custom(io::Any) = false + indent_string!(io::IO, str::String) = (_unwrap(io).indent_str = str; io) IOCustom(io::IO, force_newlines = false) = IOCustom{typeof(io)}(io, 0, false, " ", 0, false, force_newlines)