-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
This may be a feature or a quirk, rather than a bug, but perhaps could be noted in the docs. Also, while the code below that demonstrates the issue only illustrates it with inv(), perhaps it's applicable to any ANSI color setting strings.
The observed behavior (on an Ubuntu 20.04, Linux 5.4.0 system) is that if say Crayon(background = :green) has been in effect, and an inv() for it is printed after a println() instead of before, then there's a green background for the tail of the upcoming line (which I didn't expect).
#!/usr/bin/env julia
# -*- mode: julia; coding: utf-8 -*-
# Tues 11 Jan 2022 - j-waldby
module testcrayoninv
using Crayons
green = Crayon(background = :green)
blue = Crayon(background = :blue)
function plines(nlines, befor, flu)
perline, lex, c = 1:5, 4, 'a'
println("\nbefor is ", befor, " flu is ", flu)
for l in 1:nlines
print("Line ", l)
if l%4<1 print(green) end
if l%5<1 print(blue) end
for p in perline
lex = (lex+5)%9
c = c<'z' ? c+1 : 'a'
print(" ", join([c for i in 1:lex]))
end
if befor
if l%4<1 print(inv(green)) end
if l%5<1 print(inv(blue)) end
if flu flush(stdout) end
end
println() # Print the inv's before or after this println()
if !befor
if l%4<1 print(inv(green)) end
if l%5<1 print(inv(blue)) end
if flu flush(stdout) end
end
end
end
plines(11, false, true)
plines(11, false, false)
plines(11, true, false)
plines(11, true, true)
end # module
Metadata
Metadata
Assignees
Labels
No labels