@@ -302,6 +302,7 @@ mutable struct BasicREPL <: AbstractREPL
302302end
303303
304304outstream (r:: BasicREPL ) = r. terminal
305+ hascolor (r:: BasicREPL ) = hascolor (r. terminal)
305306
306307function run_frontend (repl:: BasicREPL , backend:: REPLBackendRef )
307308 d = REPLDisplay (repl)
@@ -428,13 +429,14 @@ mutable struct LineEditREPL <: AbstractREPL
428429 interface:: ModalInterface
429430 backendref:: REPLBackendRef
430431 LineEditREPL (t,hascolor,prompt_color,input_color,answer_color,shell_color,help_color,history_file,in_shell,in_help,envcolors) =
431- new (t,true ,prompt_color,input_color,answer_color,shell_color,help_color,history_file,in_shell,
432+ new (t,hascolor ,prompt_color,input_color,answer_color,shell_color,help_color,history_file,in_shell,
432433 in_help,envcolors,false ,nothing , Options (), nothing )
433434end
434435outstream (r:: LineEditREPL ) = r. t
435436specialdisplay (r:: LineEditREPL ) = r. specialdisplay
436437specialdisplay (r:: AbstractREPL ) = nothing
437438terminal (r:: LineEditREPL ) = r. t
439+ hascolor (r:: LineEditREPL ) = r. hascolor
438440
439441LineEditREPL (t:: TextTerminal , hascolor:: Bool , envcolors:: Bool = false ) =
440442 LineEditREPL (t, hascolor,
@@ -813,7 +815,7 @@ function respond(f, repl, main; pass_empty = false, suppress_on_semicolon = true
813815 response = (catch_stack (), true )
814816 end
815817 hide_output = suppress_on_semicolon && ends_with_semicolon (line)
816- print_response (repl, response, ! hide_output, Base . have_color )
818+ print_response (repl, response, ! hide_output, hascolor (repl) )
817819 end
818820 prepare_next (repl)
819821 reset_state (s)
@@ -955,7 +957,7 @@ function setup_interface(
955957 end
956958 hist_from_file (hp, f, hist_path)
957959 catch
958- print_response (repl, (catch_stack (),true ), true , Base . have_color )
960+ print_response (repl, (catch_stack (),true ), true , hascolor (repl) )
959961 println (outstream (repl))
960962 @info " Disabling history file for this session"
961963 repl. history_file = false
@@ -1155,6 +1157,7 @@ StreamREPL(stream::IO) = StreamREPL(stream, Base.text_colors[:green], Base.input
11551157run_repl (stream:: IO ) = run_repl (StreamREPL (stream))
11561158
11571159outstream (s:: StreamREPL ) = s. stream
1160+ hascolor (s:: StreamREPL ) = get (s. stream, :color , false )
11581161
11591162answer_color (r:: LineEditREPL ) = r. envcolors ? Base. answer_color () : r. answer_color
11601163answer_color (r:: StreamREPL ) = r. answer_color
@@ -1213,7 +1216,7 @@ function ends_with_semicolon(line::AbstractString)
12131216end
12141217
12151218function run_frontend (repl:: StreamREPL , backend:: REPLBackendRef )
1216- have_color = Base . have_color
1219+ have_color = hascolor (repl)
12171220 Base. banner (repl. stream)
12181221 d = REPLDisplay (repl)
12191222 dopushdisplay = ! in (d,Base. Multimedia. displays)
0 commit comments