Skip to content

Commit fec3fe1

Browse files
committed
Remove DCS-based TTY truecolor test
The idea is still sound, but the REPL stdlib is not available in Base, and REPL.Terminals.raw! is non-trivial. Since this is the final fallback, and it's also been a bit flakey on various terminal emulators, we'll just remove it for now.
1 parent 605150b commit fec3fe1

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

base/terminfo.jl

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -270,36 +270,12 @@ is set to either `"truecolor"` or `"24bit"`.
270270
271271
As a fallback, first on unix systems the `colors` terminal capability is checked
272272
— should more than 256 colors be reported, this is taken to signify 24-bit
273-
support. Lastly, the color is attempted to be set to `#010203` and then the
274-
current color queried via the DCS (Device Control String) sequence `\$qm`. If
275-
the output contains `":1:2:3"` this is taken to signify 24-bit support.
276-
277-
If the fallbacks are used, the `"COLORTERM"` entry in `ENV` is updated according
278-
to the result. This ensures that frequent calls will only potentially be slow
279-
the first time.
273+
support.
280274
"""
281275
function ttyhastruecolor()
282-
function test24bitcolor_dcs()
283-
REPL.Terminals.raw!(REPL.TerminalMenus.terminal, true)
284-
print(stdout, "\e[48;2;1;2;3m\eP\$qm\e\\\e[m")
285-
flush(stdout)
286-
# Some terminals are bad and haven't got DCS sequence support,
287-
# if we don't see a response from stdin we need to abort.
288-
output = @task readuntil(stdin, 'm')
289-
schedule(output)
290-
Timer(0.1) do _
291-
istaskdone(output) || Base.throwto(output, InterruptException())
292-
end
293-
color::String = try
294-
fetch(output)
295-
catch _ "" end
296-
REPL.Terminals.raw!(REPL.TerminalMenus.terminal, false)
297-
occursin(":1:2:3", color)
298-
end
299276
get(ENV, "COLORTERM", "") ("truecolor", "24bit") ||
300277
@static if Sys.isunix()
301-
get(current_terminfo, :colors, 0) > 256 ||
302-
isinteractive() && test24bitcolor_dcs()
278+
get(current_terminfo, :colors, 0) > 256
303279
else
304280
false
305281
end

0 commit comments

Comments
 (0)