Skip to content

Commit

Permalink
fix JuliaLang#36492, ensure output is limited even with basic REPLs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbauman committed Jul 10, 2020
1 parent 0d5efa8 commit ac57297
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ end

function display(d::REPLDisplay, mime::MIME"text/plain", x)
with_methodtable_hint(d.repl) do io
io = IOContext(io, :limit => true, :module => Main)
get(io, :color, false) && write(io, answer_color(d.repl))
if isdefined(d.repl, :options) && isdefined(d.repl.options, :iocontext)
# this can override the :limit property set initially
io = foldl(IOContext, d.repl.options.iocontext,
init=IOContext(io, :limit => true, :module => Main))
io = foldl(IOContext, d.repl.options.iocontext, init=io)
end
show(io, mime, x)
println(io)
Expand Down
7 changes: 7 additions & 0 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,13 @@ let term = REPL.Terminals.TTYTerminal("dumb",IOBuffer("1+2\n"),IOContext(IOBuffe
@test_throws KeyError term[:bar]
end

# Ensure even the dumb REPL elides content
let term = REPL.Terminals.TTYTerminal("dumb",IOBuffer("zeros(1000)\n"),IOBuffer(),IOBuffer())
r = REPL.BasicREPL(term)
REPL.run_repl(r)
@test contains(String(take!(term.out_stream)), "")
end


# a small module for alternative keymap tests
module AltLE
Expand Down

0 comments on commit ac57297

Please sign in to comment.