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

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Sep 3 20:07:05 EDT 2007

Yeah, that's a long standing one. Somewhere, something is doing stuff
with text-based methods instead of snip-based methods, probably
because the transpose sexp is based on positions. Probably someone
needs to insert a call to split-snip and then change some loop to be
snip-based ....

Robby

On 9/3/07, Danny Yoo <dyoo at cs.wpi.edu> wrote:
> 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)))
>        (cond
>          [snipclass
>           (printf "~a: ~a~n" index (send snipclass get-classname))]
>          [else
>           (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:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> before
> 0: (lib "collapsed-snipclass.ss" "framework")
> 1: no snip class
> after
> 0: wxtext
> 1: wxtext
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> So my snips are being mangled into wxtext instances.  I hope this helps
> trace down what's happening!
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.