From a1da84c3b0406e8378d8af781fe74ce749725d1f Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Tue, 13 Oct 2020 08:46:44 -0500 Subject: [PATCH] Relax a couple of REPL signatures (#37998) Fixes #37765 and PyPlot docs --- stdlib/REPL/src/REPL.jl | 4 ++-- stdlib/REPL/src/docview.jl | 3 ++- stdlib/REPL/test/docview.jl | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index 8989c7454cc75..c98d4431a787b 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -447,9 +447,9 @@ function complete_line(c::ShellCompletionProvider, s::PromptState) return unique!(map(completion_text, ret)), partial[range], should_complete end -function complete_line(c::LatexCompletions, s::PromptState) +function complete_line(c::LatexCompletions, s) partial = beforecursor(LineEdit.buffer(s)) - full = LineEdit.input_string(s) + full = LineEdit.input_string(s)::String ret, range, should_complete = bslash_completions(full, lastindex(partial))[2] return unique!(map(completion_text, ret)), partial[range], should_complete end diff --git a/stdlib/REPL/src/docview.jl b/stdlib/REPL/src/docview.jl index 3d4dddc72176c..fad0e97878974 100644 --- a/stdlib/REPL/src/docview.jl +++ b/stdlib/REPL/src/docview.jl @@ -69,10 +69,11 @@ end _helpmode(line::AbstractString) = _helpmode(stdout, line) # Print vertical lines along each docstring if there are multiple docs -function insert_hlines(io::IO, docs::Markdown.MD) +function insert_hlines(io::IO, docs) if !isa(docs, Markdown.MD) || !haskey(docs.meta, :results) || isempty(docs.meta[:results]) return docs end + docs = docs::Markdown.MD v = Any[] for (n, doc) in enumerate(docs.content) push!(v, doc) diff --git a/stdlib/REPL/test/docview.jl b/stdlib/REPL/test/docview.jl index 89e07da952106..aec0fdd52408a 100644 --- a/stdlib/REPL/test/docview.jl +++ b/stdlib/REPL/test/docview.jl @@ -2,6 +2,7 @@ using Test import REPL +import Markdown @testset "symbol completion" begin @test startswith(let buf = IOBuffer() @@ -14,3 +15,7 @@ import REPL String(take!(buf)) end, "\"🐨\" can be typed by \\:koala:\n") end + +@testset "Non-Markdown" begin + @test isa(REPL.insert_hlines(IOBuffer(), Markdown.Text("foo")), Markdown.Text) +end