Skip to content

Commit 7772995

Browse files
committed
correctly overload show instead of print
1 parent 4e673f7 commit 7772995

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/crayon.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function _have_color()
106106
Base.have_color
107107
end
108108
end
109-
function Base.print(io::IO, x::Crayon)
109+
function Base.show(io::IO, x::Crayon)
110110
if anyactive(x) && (_have_color() || _force_color())
111111
print(io, CSI)
112112
if (x.fg.style == COLORS_24BIT || x.bg.style == COLORS_24BIT)
@@ -121,7 +121,7 @@ function Base.print(io::IO, x::Crayon)
121121
end
122122
end
123123

124-
function Base.show(io::IO, x::Crayon)
124+
function Base.show(io::IO, ::MIME"text/plain", x::Crayon)
125125
if anyactive(x)
126126
print(io, x)
127127
print(io, ESCAPED_CSI)

src/crayon_wrapper.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ end
1212

1313
Base.show(io::IO, cw::CrayonWrapper) = _show(io, cw, CrayonStack(incremental = true))
1414

15-
_show(io::IO, str::String, stack::CrayonStack) = print(io, str)
15+
_show(io::IO, str::String, stack::CrayonStack) = show(io, str)
1616

1717
function _show(io::IO, cw::CrayonWrapper, stack::CrayonStack)
1818
print(io, push!(stack, cw.c))

0 commit comments

Comments
 (0)