clean up ascii art => unicode a little

adjust the way it changes characters so it
doesn't change them when they are already the right
thing (this means set-modified is not always called
and also improves performance in the case that little
changes in a big diagram)

original commit: 5a9c5f681b11d563275f7672c3af5160bb68113c
This commit is contained in:
Robby Findler 2012-12-24 12:29:57 -06:00
parent 8109170a3a
commit 021c4b97d8

View File

@ -1491,10 +1491,9 @@
(f click-pos eol start-pos click-pos)
(f click-pos eol click-pos end-pos)))))
(define (do-unicode-ascii-art-boxes t pos)
(define visited (make-hash))
(when (i? t pos)
(define visited (make-hash))
(send t begin-edit-sequence)
(let loop ([pos pos])
(unless (hash-ref visited pos #f)
@ -1531,8 +1530,9 @@
(member (send t get-character pos)
adjustable-chars)))
(define (set t pos s)
(send t delete pos (+ pos 1))
(send t insert s pos pos))
(unless (equal? (string-ref s 0) (send t get-character pos))
(send t delete pos (+ pos 1))
(send t insert s pos pos)))
(define (pos->xy text pos)
(define para (send text position-paragraph pos))