[racket] Asynchronously inserting text to editor%

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Aug 26 08:30:37 EDT 2014

See also

http://docs.racket-lang.org/gui/editor-overview.html#%28part._editorthreads%29

which explains why you probably need to make sure your changes from the
non-main thread are always between `begin-edit-sequence` and
`end-edit-sequence`.

At Tue, 26 Aug 2014 07:25:37 -0500, Robby Findler wrote:
> The real issue here is that the implementation of text% is not
> thread-safe (nor are the GUI controls generally speaking). So when you
> modify them from two threads, strange things can happen.
> 
> Robby
> 
> On Tue, Aug 26, 2014 at 6:11 AM, Eli Barzilay <eli at barzilay.org> wrote:
> > On Tue, Aug 26, 2014 at 6:46 AM, Dmitry Cherkassov
> > <dcherkassov at gmail.com> wrote:
> >> Thanks for your reply. I've found that `disable`-ing canvas of text editor
> >> when inserting works too. But with downside that you cant select anything or
> >> move the cursor when bulk of text strings are inserted.
> >
> > Well, that's why I said that you're much better off just doing the
> > callback -- even if you disable things, you're likely to get the same
> > problem later on.  OTOH, doing a callback is easy, and can be done from
> > a different thread with no issues, since the actual addition happens
> > when the GUI is prepared to do so.
> >
> > --
> >           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
> >                     http://barzilay.org/                   Maze is Life!
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.