parent
d73fc00749
commit
66bda1c9c8
|
@ -11,6 +11,7 @@ needed to really make this work:
|
||||||
racket/class
|
racket/class
|
||||||
racket/gui/base
|
racket/gui/base
|
||||||
racket/match
|
racket/match
|
||||||
|
(prefix-in - racket/base)
|
||||||
"include-bitmap.rkt")
|
"include-bitmap.rkt")
|
||||||
|
|
||||||
(define orig-output-port (current-output-port))
|
(define orig-output-port (current-output-port))
|
||||||
|
@ -46,7 +47,7 @@ needed to really make this work:
|
||||||
(class snip-class%
|
(class snip-class%
|
||||||
(define/override (read stream)
|
(define/override (read stream)
|
||||||
(make-object syntax-snip%
|
(make-object syntax-snip%
|
||||||
(unmarshall-syntax (read (open-input-string (send stream get-bytes))))))
|
(unmarshall-syntax (-read (open-input-bytes (send stream get-bytes))))))
|
||||||
(super-new)))
|
(super-new)))
|
||||||
|
|
||||||
(define snip-class (new syntax-snipclass%))
|
(define snip-class (new syntax-snipclass%))
|
||||||
|
|
15
gui-test/mrlib/tests/syntax-browser.rkt
Normal file
15
gui-test/mrlib/tests/syntax-browser.rkt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#lang racket/gui
|
||||||
|
(require mrlib/syntax-browser rackunit)
|
||||||
|
|
||||||
|
(let ()
|
||||||
|
(struct m ([x #:mutable]))
|
||||||
|
(define v (m 0))
|
||||||
|
(define stx (datum->syntax #'here v))
|
||||||
|
(set-m-x! v stx)
|
||||||
|
(define t (new text%))
|
||||||
|
(send t insert (render-syntax/snip stx))
|
||||||
|
(define bp (open-output-bytes))
|
||||||
|
(send t save-port bp)
|
||||||
|
(define t2 (new text%))
|
||||||
|
(send t2 insert-port (open-input-bytes (get-output-bytes bp)))
|
||||||
|
(check-regexp-match #rx"syntax-snip" (~s (send t2 find-first-snip))))
|
Loading…
Reference in New Issue
Block a user