[plt-scheme] Framework bug involving snips and transpose-sexp

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Mon Sep 3 19:41:18 EDT 2007

Hi everyone,

There's a bug that where transpose-exp seems to mangle snips in mred.  As 
a concrete example:

(module foo mzscheme
   (require (lib "class.ss")
            (lib "mred.ss" "mred")
            (lib "framework.ss" "framework")
            (lib "etc.ss"))

   (define (show-snip-at index)
     (local ((define snipclass
               (send (send text find-snip index 'after) get-snipclass)))
          (printf "~a: ~a~n" index (send snipclass get-classname))]
          (printf "~a: no snip class~n" index)])))

   (define text (new scheme:text%))
   (define s1 (new scheme:sexp-snip%
                   [left-bracket #\[] [right-bracket #\]]
                   [saved-snips '()]))
   (define s2 (new snip%))
   (send text insert s1)
   (send text insert s2)

   (printf "before~n")
   (show-snip-at 0)
   (show-snip-at 1)
   (send text transpose-sexp 1)

   (printf "after~n")
   (show-snip-at 0)
   (show-snip-at 1))

Here are the results I see:

0: (lib "collapsed-snipclass.ss" "framework")
1: no snip class
0: wxtext
1: wxtext

So my snips are being mangled into wxtext instances.  I hope this helps 
trace down what's happening!

Posted on the users mailing list.