Skip to content

Commit

Permalink
Avoid a crash for graphemes with textwidth > 1
Browse files Browse the repository at this point in the history
  • Loading branch information
aaruni96 committed Feb 5, 2024
1 parent b4a7478 commit 9d6ae07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PrettyPrinting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1606,13 +1606,13 @@ function _write_line(io::IOCustom, str::AbstractString)
end
io.printed += textwidth(firststr)
reststr = join(restiter)
it = Iterators.partition(1:textwidth(reststr), c - ind > 0 ? c - ind : c)
it = Iterators.partition(1:length(reststr), c - ind > 0 ? c - ind : c)
for i in it
# partitions of the spillover text
written += write(io.io, "\n")
written += write_indent(io)
written += write(io.io, join(collect(restiter)[i]))
io.printed = length(i)
io.printed = textwidth(join(collect(restiter)[i]))
println()
end
return written
Expand Down

0 comments on commit 9d6ae07

Please sign in to comment.