Fixes another bug in the stepper's diff highlighting

This commit is contained in:
Casey Klein 2011-03-29 13:04:20 -05:00
parent df3bc8980b
commit b958e21f46
2 changed files with 17 additions and 5 deletions

View File

@ -52,7 +52,9 @@
(let loop ([s s])
(cond
[(pair? s) (cons (loop (car s))
(loop (cdr s)))]
(if (null? (cdr s))
'()
(loop (cdr s))))]
[(vector? s)
(list->vector (map loop (vector->list s)))]
[(box? s)
@ -60,6 +62,8 @@
[(syntax? s) (datum->syntax s (unkink (loop (syntax-e s))) s)]
[(number? s) (make-wrap s)]
[(symbol? s) (make-wrap s)]
[(null? s) (make-wrap s)]
[(boolean? s) (make-wrap s)]
[else s])))
(define-struct wrap (content) #:inspector (make-inspector))

View File

@ -20,10 +20,11 @@
[change-path 'dont-care]
[init-cw (initial-char-width)]))
(define (ranges node)
(map (λ (range) (cons (text:range-start range)
(text:range-end range)))
(send (send (send node get-big-snip) get-editor)
get-highlighted-ranges)))
(sort (map (λ (range) (cons (text:range-start range)
(text:range-end range)))
(send (send (send node get-big-snip) get-editor)
get-highlighted-ranges))
< #:key car))
(define from-node (make-node from))
(define to-node (make-node to))
(show-diff from-node to-node)
@ -34,4 +35,11 @@
(test (diff (term (,'hole a)) (term (,'hole b)))
(cons (list (cons 8 9)) (list (cons 8 9))))
(test (diff (term (() #f () #f)) (term (1 2 () #f)))
(cons (list (cons 1 3) (cons 4 6))
(list (cons 1 2) (cons 3 4))))
(test (diff (term (<> ((a b)) () e)) (term (<> ((a b)) () (c d))))
(cons (list (cons 15 16))
(list (cons 15 20))))
(print-tests-passed 'stepper-test.ss)