Skip to content

Commit

Permalink
Update README (#64)
Browse files Browse the repository at this point in the history
Replace references to deprecated `takebuf_string(io)` (#19088) with `String(take!(io))`.
  • Loading branch information
adrhill authored Jan 2, 2023
1 parent 417e3af commit 28630f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ stack = CrayonStack(incremental = true)
print(io, push!(stack, Crayon(foreground = :red)))
print(io, push!(stack, Crayon(foreground = :red)))
print(io, stack, "This will be red")
print(takebuf_string(io))
print(String(take!(io)))

# Does not work
io = IOBuffer()
stack = CrayonStack(incremental = true)
push!(stack, Crayon(foreground = :red)) # <- not printing the stack even though we modify it!
print(io, push!(stack, Crayon(foreground = :red)))
print(io, stack, "This will not be red")
print(takebuf_string(io))
print(String(take!(io)))
```

The reason why the last example did not work is because the stack notices that there is no change of text state on the second call to `push!`, since the foreground was just kept red.
Expand Down

0 comments on commit 28630f6

Please sign in to comment.