From 9d6ae07297d0078743adc86b0cb186875907e48c Mon Sep 17 00:00:00 2001 From: Aaruni Kaushik Date: Mon, 5 Feb 2024 12:15:17 +0100 Subject: [PATCH] Avoid a crash for graphemes with textwidth > 1 --- src/PrettyPrinting.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PrettyPrinting.jl b/src/PrettyPrinting.jl index 03cff30ac6..64b5a2ec81 100644 --- a/src/PrettyPrinting.jl +++ b/src/PrettyPrinting.jl @@ -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