# \`display\` and line breaks in \`TextDisplay\` and \`LineEditREPL\`

**URL:** <https://discourse.julialang.org/t/display-and-line-breaks-in-textdisplay-and-lineeditrepl/73459>\
**Category:** General Usage\
**Tags:** question, display\
**Created:** [December 21, 2021, 11:22pm UTC](https://discourse.julialang.org/t/display-and-line-breaks-in-textdisplay-and-lineeditrepl/73459 "2021-12-21T23:22:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [December 21, 2021, 11:22pm UTC](https://discourse.julialang.org/t/display-and-line-breaks-in-textdisplay-and-lineeditrepl/73459/1 "2021-12-21T23:22:41Z")

</div>

When I use display in a script and execute Julia from the command line julia script.jl, there seem to be missing line breaks after the display results. How do I make the “script” and REPL output look more similar?

```julia
$ julia -e "A = rand(Int8, 4, 3); display(A); display(A)"
4×3 Matrix{Int8}:
   -4 -60 -10
  -66 17 -64
 -113 50 -57
  -70 92 104×3 Matrix{Int8}:
   -4 -60 -10
  -66 17 -64
 -113 50 -57
  -70 92 10$

```

Meanwhile executing the REPL has correct line breaks:

```julia
julia> A = rand(Int8, 4, 3); display(A); display(A)
4×3 Matrix{Int8}:
  73 -58 124
   0 56 -73
 -70 37 101
 -41 25 -49
4×3 Matrix{Int8}:
  73 -58 124
   0 56 -73
 -70 37 101
 -41 25 -49

julia> 

```

If I `pop!` the `REPL.LineEditREPL` from `Base.Multimedia.displays` then I get a similar result.

```julia
julia> typeof(pop!(Base.Multimedia.displays))
REPL.REPLDisplay{REPL.LineEditREPL}
julia> A = rand(Int8, 4, 3); display(A); display(A)
4×3 Matrix{Int8}:
   75 120 -78
   82 93 36
   54 113 65
 -120 -116 -854×3 Matrix{Int8}:
   75 120 -78
   82 93 36
   54 113 65
 -120 -116 -85

```

What is the expectation here for `TextDisplay` versus `LineEditREPL`? Is there a bug here?

---

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [January 2, 2022, 1:27pm UTC](https://discourse.julialang.org/t/display-and-line-breaks-in-textdisplay-and-lineeditrepl/73459/2 "2022-01-02T13:27:39Z")

</div>

There is an additional `println(io)` for [`REPLDisplay`](https://github.com/JuliaLang/julia/blob/f8f42ec0370b72072498c1b79eb5cf4e6c6864e6/stdlib/REPL/src/REPL.jl#L268), where there is none after the call to `show()` for [`TextDisplay`](https://github.com/JuliaLang/julia/blob/f8f42ec0370b72072498c1b79eb5cf4e6c6864e6/base/multimedia.jl#L242).

This is also annoying for `UnicodePlots` plots, since running a script with `$ julia <script.jl>` will miss newlines after plots, whereas `julia> include("<script.jl>")` won’t.

Do you think we should open a PR for having these definitions instead:

```julia
Base.display(d::TextDisplay, M::MIME"text/plain", @nospecialize x) = (show(d.io, M, x); println(d.io))
function display(d::TextDisplay, M::MIME, @nospecialize x)
    displayable(d, M) || throw(MethodError(display, (d, M, x)))
    show(d.io, M, x); println(d.io)
end

```

?

I feel like this would be more consistent.

---

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [January 12, 2022, 11:08pm UTC](https://discourse.julialang.org/t/display-and-line-breaks-in-textdisplay-and-lineeditrepl/73459/3 "2022-01-12T23:08:57Z")

</div>

For reference: [opened issue](https://github.com/JuliaLang/julia/issues/43766), [PR](https://github.com/JuliaLang/julia/pull/43787).
