Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@ function exec_options(opts)
interactiveinput = (repl || is_interactive::Bool) && isa(stdin, TTY)
is_interactive::Bool |= interactiveinput

# load terminfo in for styled printing
term_env = get(ENV, "TERM", @static Sys.iswindows() ? "" : "dumb")
global current_terminfo = load_terminfo(term_env)

# load ~/.julia/config/startup.jl file
if startup
try
Expand Down
24 changes: 16 additions & 8 deletions base/terminfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,24 @@ end
"""
The terminfo of the current terminal.
"""
current_terminfo::TermInfo = TermInfo()
const current_terminfo = OncePerProcess{TermInfo}() do
term_env = get(ENV, "TERM", @static Sys.iswindows() ? "" : "dumb")
terminfo = load_terminfo(term_env)
# Ensure setaf is set for xterm terminals
if !haskey(terminfo, :setaf) && startswith(term_env, "xterm")
# For xterm-like terminals without setaf, add a reasonable default
terminfo.strings[:setaf] = "\e[3%p1%dm"
end
return terminfo
end

# Legacy/TTY methods and the `:color` parameter

if Sys.iswindows()
ttyhascolor(term_type = nothing) = true
ttyhascolor() = true
else
function ttyhascolor(term_type = get(ENV, "TERM", ""))
startswith(term_type, "xterm") ||
haskey(current_terminfo, :setaf)
function ttyhascolor()
haskey(current_terminfo(), :setaf)
end
end

Expand Down Expand Up @@ -352,9 +360,9 @@ Multiple conditions are taken as signifying truecolor support, specifically any
function ttyhastruecolor()
# Lasciate ogne speranza, voi ch'intrate
get(ENV, "COLORTERM", "") ∈ ("truecolor", "24bit") ||
get(current_terminfo, :RGB, false) || get(current_terminfo, :Tc, false) ||
(haskey(current_terminfo, :setrgbf) && haskey(current_terminfo, :setrgbb)) ||
@static if Sys.isunix() get(current_terminfo, :colors, 0) > 256 else false end ||
get(current_terminfo(), :RGB, false) || get(current_terminfo(), :Tc, false) ||
(haskey(current_terminfo(), :setrgbf) && haskey(current_terminfo(), :setrgbb)) ||
@static if Sys.isunix() get(current_terminfo(), :colors, 0) > 256 else false end ||
(Sys.iswindows() && Sys.windows_version() ≥ v"10.0.14931") || # See <https://devblogs.microsoft.com/commandline/24-bit-color-in-the-windows-console/>
something(tryparse(Int, get(ENV, "VTE_VERSION", "")), 0) >= 3600 || # Per GNOME bug #685759 <https://bugzilla.gnome.org/show_bug.cgi?id=685759>
haskey(ENV, "XTERM_VERSION") ||
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1762267d32633457c7c64067c1c9d871
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
72ca1b52b8f0c4e3d3ca58526cd34a3f1486c4fe373930bf513570f056700cddc65a4666d5b7767305b115ec0352639c4caaf03b9378911d596f6add3cbb762b

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion stdlib/StyledStrings.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
STYLEDSTRINGS_BRANCH = main
STYLEDSTRINGS_SHA1 = 3fe829fcf611b5fefaefb64df7e61f2ae82db117
STYLEDSTRINGS_SHA1 = 1aafc2f3abb6a977ee36a87206f9ce6446a8ae86
STYLEDSTRINGS_GIT_URL := https://github.com/JuliaLang/StyledStrings.jl.git
STYLEDSTRINGS_TAR_URL = https://api.github.com/repos/JuliaLang/StyledStrings.jl/tarball/$1