Matthew Flatt writes:
> At Sun, 05 Aug 2018 11:50:09 -0400, Christopher Lemmer Webber wrote:
>> DrRacket includes a nice Scheme editor. I don't need the whole
>> thing... but some of it would be nice, like the paren matching. How
>> reusable is DrRacket's text editor tooling? Reusable enough to embed in
>> another application? Or would I have to rewrite this?
>
> You can use `racket:text%`.
Oh I see... this is awesome! :)
I did a quick test:
(require racket/gui
framework)
(define (sexp-editor)
(define frame
(new frame% [label "sexp editor"]))
(define canvas
(new editor-canvas%
[parent frame]
[min-height 480]))
(define racket-text
(new racket:text%))
(send canvas set-editor racket-text)
(send frame show #t))
It works great! I am shocked at how easy that was!
> I usually find that I need something a little different than
> `racket:text%`, for one reason or another, but composing the right
> pieces of the "framework" collection can be tricky. If `racket:text%`
> isn't exactly what you want, you might look at this bit of the
> "slideshow-repl" package (which embeds a Racket editor into a Slideshow
> presentation) as an extra example:
>
>
https://github.com/mflatt/slideshow-repl/blob/master/slideshow/private/editor.rkt
Oh, this is very nice! I didn't even know there was a way to embed a
REPL like this in slideshow! :)