From e56d0820b93439df71bc34b24a6a7bd1ba7608b0 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Wed, 12 Feb 2020 01:22:53 -0600 Subject: [PATCH] Char compact 3-arg show (#34730) --- base/char.jl | 1 + test/char.jl | 1 + 2 files changed, 2 insertions(+) diff --git a/base/char.jl b/base/char.jl index 4207b9d12f910d..cc6ff5eeff3a45 100644 --- a/base/char.jl +++ b/base/char.jl @@ -295,6 +295,7 @@ end function show(io::IO, ::MIME"text/plain", c::T) where {T<:AbstractChar} show(io, c) + get(io, :compact, false) && return if !ismalformed(c) print(io, ": ") if isoverlong(c) diff --git a/test/char.jl b/test/char.jl index 9043c1a65b8775..325f97098b0378 100644 --- a/test/char.jl +++ b/test/char.jl @@ -185,6 +185,7 @@ end @testset "sprint, repr" begin @test sprint(show, "text/plain", '$') == "'\$': ASCII/Unicode U+0024 (category Sc: Symbol, currency)" + @test sprint(show, "text/plain", '$', context=:compact => true) == "'\$'" @test repr('$') == "'\$'" end