That deletes everything, but really I just want to hide the current prompt. So 
say this is how the console looks:

````

julia> println(5)

5

julia>function foo(x)

   println(x)

````

So in this case the users is in the middle of entering something new into the 
REPL (i.e. the definition of foo). Assume that at this point my background task 
receives a message. I then want to be able to delete line 3+5, and position the 
cursor on column 1 line 3. Then I’ll execute the code that was sent to the 
server. Once that is finished, I want to print line 3+4, as it was before I hid 
the current prompt, again, starting at whatever the current cursor position is.

 

For example, say the background task received some code that printed “Foooooo” 
to the console, then I want the console to look like this, immediately after 
that code was executed:

````

julia> println(5)

5

Foooooo

julia>function foo(x)

   println(x)

````

I.e. the user could continue editing the stuff that he/she was working on 
before the background task briefly took over.

 

Thanks,

David

 

From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On 
Behalf Of Steven G. Johnson
Sent: Tuesday, November 15, 2016 5:29 AM
To: julia-users <julia-users@googlegroups.com>
Subject: Re: [julia-users] Re: Hide and disable REPL

 



On Friday, November 4, 2016 at 1:28:16 PM UTC-4, David Anthoff wrote: 

 

The complete setup is slightly more complicated, but you can imagine just the 
following: start a normal julia REPL. Then include a file that will start a 
server listening on some socket. This server is all async, so as soon as the 
server is started, the prompt appears again and one can use this REPL window in 
the normal way. Now some other process connects to the socket, and sends some 
code that this server will eval. Before the server evals this code, I would 
like it to switch off the prompt, then eval the code, then switch the prompt on 
again.

 

Base.Terminals.clear(Base.active_repl.t); sleep(10)

 

will clear the REPL window (including prompt) for 10 seconds.  Instead of 
sleep(10), you can do wait(c) where c is a Condition variable that gets 
notified by the server thread once it is ready.  See 
http://docs.julialang.org/en/latest/stdlib/parallel/?highlight=wait

Reply via email to