fix marshalling bug in syntax-browser

closes #35
This commit is contained in:
Robby Findler 2016-07-22 03:25:04 -05:00
parent d73fc00749
commit 66bda1c9c8
2 changed files with 17 additions and 1 deletions

View File

@ -11,6 +11,7 @@ needed to really make this work:
racket/class
racket/gui/base
racket/match
(prefix-in - racket/base)
"include-bitmap.rkt")
(define orig-output-port (current-output-port))
@ -46,7 +47,7 @@ needed to really make this work:
(class snip-class%
(define/override (read stream)
(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)))
(define snip-class (new syntax-snipclass%))

View 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))))