Skip to content

Commit

Permalink
Markdown: prevent display() error with empty list item (#40122)
Browse files Browse the repository at this point in the history
  • Loading branch information
anaveragehuman committed Mar 23, 2021
1 parent e3dffb9 commit cc639ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions stdlib/Markdown/src/render/terminal/formatting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ wrapped_lines(io::IO, f::Function, args...; width = 80, i = 0) =

function print_wrapped(io::IO, s...; width = 80, pre = "", i = 0)
lines = wrapped_lines(io, s..., width = width, i = i)
isempty(lines) && return 0, 0
print(io, lines[1])
for line in lines[2:end]
print(io, '\n', pre, line)
Expand Down
9 changes: 9 additions & 0 deletions stdlib/Markdown/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1213,3 +1213,12 @@ end
| $x |
""")
end

@testset "issue 40080: empty list item breaks display()" begin
d = TextDisplay(devnull)
display(d, md"""
1. hello
2.
""")
end

2 comments on commit cc639ec

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

Please sign in to comment.