Fixes another bug in the stepper's diff highlighting
This commit is contained in:
parent
df3bc8980b
commit
b958e21f46
|
@ -52,7 +52,9 @@
|
||||||
(let loop ([s s])
|
(let loop ([s s])
|
||||||
(cond
|
(cond
|
||||||
[(pair? s) (cons (loop (car s))
|
[(pair? s) (cons (loop (car s))
|
||||||
(loop (cdr s)))]
|
(if (null? (cdr s))
|
||||||
|
'()
|
||||||
|
(loop (cdr s))))]
|
||||||
[(vector? s)
|
[(vector? s)
|
||||||
(list->vector (map loop (vector->list s)))]
|
(list->vector (map loop (vector->list s)))]
|
||||||
[(box? s)
|
[(box? s)
|
||||||
|
@ -60,6 +62,8 @@
|
||||||
[(syntax? s) (datum->syntax s (unkink (loop (syntax-e s))) s)]
|
[(syntax? s) (datum->syntax s (unkink (loop (syntax-e s))) s)]
|
||||||
[(number? s) (make-wrap s)]
|
[(number? s) (make-wrap s)]
|
||||||
[(symbol? s) (make-wrap s)]
|
[(symbol? s) (make-wrap s)]
|
||||||
|
[(null? s) (make-wrap s)]
|
||||||
|
[(boolean? s) (make-wrap s)]
|
||||||
[else s])))
|
[else s])))
|
||||||
|
|
||||||
(define-struct wrap (content) #:inspector (make-inspector))
|
(define-struct wrap (content) #:inspector (make-inspector))
|
||||||
|
|
|
@ -20,10 +20,11 @@
|
||||||
[change-path 'dont-care]
|
[change-path 'dont-care]
|
||||||
[init-cw (initial-char-width)]))
|
[init-cw (initial-char-width)]))
|
||||||
(define (ranges node)
|
(define (ranges node)
|
||||||
(map (λ (range) (cons (text:range-start range)
|
(sort (map (λ (range) (cons (text:range-start range)
|
||||||
(text:range-end range)))
|
(text:range-end range)))
|
||||||
(send (send (send node get-big-snip) get-editor)
|
(send (send (send node get-big-snip) get-editor)
|
||||||
get-highlighted-ranges)))
|
get-highlighted-ranges))
|
||||||
|
< #:key car))
|
||||||
(define from-node (make-node from))
|
(define from-node (make-node from))
|
||||||
(define to-node (make-node to))
|
(define to-node (make-node to))
|
||||||
(show-diff from-node to-node)
|
(show-diff from-node to-node)
|
||||||
|
@ -34,4 +35,11 @@
|
||||||
(test (diff (term (,'hole a)) (term (,'hole b)))
|
(test (diff (term (,'hole a)) (term (,'hole b)))
|
||||||
(cons (list (cons 8 9)) (list (cons 8 9))))
|
(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)
|
(print-tests-passed 'stepper-test.ss)
|
Loading…
Reference in New Issue
Block a user