From 2c6273b161aef6b908bc69e854b6f25b447aaa5d Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sun, 4 Jun 2017 20:50:29 +0200 Subject: [PATCH] special show for AbstractVector{Method} for ::MIMEtext/plain (#22068) which is currently done for text/html this enables the jump-to-method thingy from #22007 to be used with methodswith(Foo) also This also prevents large spacing in the printing, since the general vector output prints with equal spacing for all elements, and some methods have very long signatures --- base/methodshow.jl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/base/methodshow.jl b/base/methodshow.jl index c6ef522b3261a..d6b223da5f1ab 100644 --- a/base/methodshow.jl +++ b/base/methodshow.jl @@ -289,7 +289,16 @@ end show(io::IO, mime::MIME"text/html", mt::MethodTable) = show(io, mime, MethodList(mt)) -# pretty-printing of Vector{Method} for output of methodswith: +# pretty-printing of AbstractVector{Method} for output of methodswith: +function show(io::IO, mime::MIME"text/plain", mt::AbstractVector{Method}) + resize!(LAST_SHOWN_LINE_INFOS, 0) + for (i, m) in enumerate(mt) + print(io, "[$(i)] ") + show(io, m) + println(io) + push!(LAST_SHOWN_LINE_INFOS, (string(m.file), m.line)) + end +end function show(io::IO, mime::MIME"text/html", mt::AbstractVector{Method}) print(io, summary(mt))