From 477d031407b74343750d0831383a909ed9679380 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 4207b9d12f910..cc6ff5eeff3a4 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 9043c1a65b877..325f97098b037 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