Skip to content

Commit 640b67b

Browse files
committed
🐛 [Text] Do not reset decoration when using empty crayon
1 parent 38a4740 commit 640b67b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/backends/text/display.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ end
5050
Print a string `str` to the `display` with the style given by the `crayon`.
5151
"""
5252
function _text__styled_print(display::Display, str::AbstractString, crayon::Crayon)
53-
(!display.has_color || crayon == _TEXT__DEFAULT) && return _text__print(display, str)
53+
(!display.has_color || crayon == _TEXT__DEFAULT || crayon == _TEXT__EMPTY_CRAYON) &&
54+
return _text__print(display, str)
5455

5556
_text__print(display, string(crayon) * str * _TEXT__STRING_RESET)
5657
return nothing

src/backends/text/types.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,14 @@ Define the format of the borders in the tables printed with the text back end.
9292
end
9393

9494
# Create some default decorations to reduce allocations.
95-
const _TEXT__RESET = crayon"reset"
96-
const _TEXT__DEFAULT = crayon"default"
9795
const _TEXT__BOLD = crayon"bold"
98-
const _TEXT__DARK_GRAY = crayon"fg:dark_gray"
99-
const _TEXT__CYAN = crayon"fg:cyan"
10096
const _TEXT__BOLD_UNDERLINE = crayon"bold underline"
97+
const _TEXT__CYAN = crayon"fg:cyan"
98+
const _TEXT__DARK_GRAY = crayon"fg:dark_gray"
10199
const _TEXT__DARK_GRAY_UNDERLINE = crayon"fg:dark_gray underline"
100+
const _TEXT__DEFAULT = crayon"default"
101+
const _TEXT__EMPTY_CRAYON = crayon""
102+
const _TEXT__RESET = crayon"reset"
102103

103104
# Convert the reset crayon to string to reduce allocations.
104105
const _TEXT__STRING_RESET = string(_TEXT__RESET)

0 commit comments

Comments
 (0)