Trigger redisplay of the REPL prompt

repl
#1

I have an asynchronous event that triggers some output in the REPL, and I’d like to trigger a redisplay of the prompt afterwards, so that users know the REPL is still active. Is there something in the REPL std lib to do this?


M(NY)WE:

julia> Timer(_->println("OK"), 3);

julia> OK

To be clear: I’d like a new prompt to be redisplayed after “OK”

0 Likes

#2

Try this:

julia> using REPL

julia> Timer(_->(println("OK\n"); REPL.LineEdit.refresh_line(Base.active_repl.mistate)), 3);

julia> OK

julia>

Alternatively, you can always hack it…

julia> using REPL

julia> Timer(_->print("OK\n\n\e[1m", Base.active_repl.prompt_color, REPL.JULIA_PROMPT, "\e[m"), 3);

julia> OK

julia>
1 Like

#3

Thanks!


Yes, that is the workaround I was using, but I was almost sure something better existed…

0 Likes