Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ termcolor(io::IO, ::Nothing, category::Char) =

const ANSI_STYLE_CODES = (
bold_weight = "\e[1m",
dim_weight = "\e[2m",
dim_weight = "\e[2m", # Unused
normal_weight = "\e[22m",
start_italics = "\e[3m",
end_italics = "\e[23m",
Expand All @@ -164,14 +164,18 @@ function termstyle(io::IO, face::Face, lastface::Face=getface())
termcolor(io, face.foreground, '3')
face.background == lastface.background ||
termcolor(io, face.background, '4')
face.weight == lastface.weight ||
face.weight == lastface.weight || begin
if lastface.weight != :normal && face.weight != :normal
print(io, ANSI_STYLE_CODES.normal_weight) # Reset before changing
end
print(io, if face.weight ∈ (:medium, :semibold, :bold, :extrabold, :black)
ANSI_STYLE_CODES.bold_weight
elseif face.weight ∈ (:semilight, :light, :extralight, :thin)
get(Base.current_terminfo, :dim, "")
else # :normal
ANSI_STYLE_CODES.normal_weight
end)
end
face.slant == lastface.slant ||
if haskey(Base.current_terminfo, :enter_italics_mode)
print(io, ifelse(face.slant ∈ (:italic, :oblique),
Expand Down
Loading