Skip to content

Commit d0f48fc

Browse files
committed
Write ANSI decorated strings directly from buffer
Write the buffer instead of using take! seems like a "why not?" to me.
1 parent 04abf3e commit d0f48fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/io.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function _ansi_writer(string_writer::F, io::IO, s::Union{<:AnnotatedString, SubS
234234
# before we start outputting any styled content.
235235
load_customisations!()
236236
if get(io, :color, false)::Bool
237-
buf = IOBuffer() # Avoid the overhead in repeatadly printing to `stdout`
237+
buf = IOBuffer() # Avoid the overhead in repeatedly printing to `stdout`
238238
lastface::Face = FACES.default[:default]
239239
for (str, styles) in eachregion(s)
240240
face = getface(styles)
@@ -249,7 +249,7 @@ function _ansi_writer(string_writer::F, io::IO, s::Union{<:AnnotatedString, SubS
249249
lastface = face
250250
end
251251
termstyle(buf, FACES.default[:default], lastface)
252-
write(io, take!(buf))
252+
write(io, seekstart(buf))
253253
elseif s isa AnnotatedString
254254
string_writer(io, s.string)
255255
elseif s isa SubString

0 commit comments

Comments
 (0)