adjust find-string in text% so it doesn't allocate as many temporary strings

Also, Rackety
This commit is contained in:
Robby Findler 2012-12-24 17:06:13 -06:00
parent 3fc8ce0709
commit 1298c11d2f
2 changed files with 8 additions and 6 deletions

View File

@ -3592,7 +3592,7 @@
s)])
(vector-set! smap i s)
(loop s (+ i direction)))))))
(define text "")
(let a-loop ([s beyond]
[s-pos s-pos]
[snip snip]
@ -3618,9 +3618,11 @@
[thisoffset (+ offset (if (direction . < . 0) need checked))]
[wl? write-locked?]
[fl? flow-locked?])
(when (< (string-length text) (send snip get-count))
(set! text (make-string (send snip get-count))))
(set! write-locked? #t)
(set! flow-locked? #t)
(let ([text (send snip get-text thisoffset thistime #f)])
(send snip get-text! text thisoffset thistime 0)
(set! write-locked? wl?)
(set! flow-locked? fl?)
@ -3684,7 +3686,7 @@
(c-loop (+ i direction)
n
s
results)))))))))
results))))))))
(if just-one?
#f
results)))))))))))

View File

@ -1,6 +1,6 @@
#lang scheme/base
(require scheme/class
(only-in scheme/gui/base
#lang racket/base
(require racket/class
(only-in racket/gui/base
color%
font%
the-clipboard