Skip to content

Commit 201b203

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 00c5955 commit 201b203

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
@@ -274,36 +274,12 @@ is set to either `"truecolor"` or `"24bit"`.
274274
275275
As a fallback, first on unix systems the `colors` terminal capability is checked
276276
— should more than 256 colors be reported, this is taken to signify 24-bit
277-
support. Lastly, the color is attempted to be set to `#010203` and then the
278-
current color queried via the DCS (Device Control String) sequence `\$qm`. If
279-
the output contains `":1:2:3"` this is taken to signify 24-bit support.
280-
281-
If the fallbacks are used, the `"COLORTERM"` entry in `ENV` is updated according
282-
to the result. This ensures that frequent calls will only potentially be slow
283-
the first time.
277+
support.
284278
"""
285279
function ttyhastruecolor()
286-
function test24bitcolor_dcs()
287-
REPL.Terminals.raw!(REPL.TerminalMenus.terminal, true)
288-
print(stdout, "\e[48;2;1;2;3m\eP\$qm\e\\\e[m")
289-
flush(stdout)
290-
# Some terminals are bad and haven't got DCS sequence support,
291-
# if we don't see a response from stdin we need to abort.
292-
output = @task readuntil(stdin, 'm')
293-
schedule(output)
294-
Timer(0.1) do _
295-
istaskdone(output) || Base.throwto(output, InterruptException())
296-
end
297-
color::String = try
298-
fetch(output)
299-
catch _ "" end
300-
REPL.Terminals.raw!(REPL.TerminalMenus.terminal, false)
301-
occursin(":1:2:3", color)
302-
end
303280
get(ENV, "COLORTERM", "") ("truecolor", "24bit") ||
304281
@static if Sys.isunix()
305-
get(current_terminfo, :colors, 0) > 256 ||
306-
isinteractive() && test24bitcolor_dcs()
282+
get(current_terminfo, :colors, 0) > 256
307283
else
308284
false
309285
end

0 commit comments

Comments
 (0)