@@ -4494,6 +4494,62 @@ designates the character that triggers autocompletion
44944494(define-struct saved-dc-state (smoothing pen brush font text-foreground-color text-mode))
44954495(define padding-dc (new bitmap-dc% [bitmap (make-screen-bitmap 1 1 )]))
44964496
4497+ (define all-string-snips<%>
4498+ (interface ()
4499+ all-string-snips?))
4500+
4501+ (define all-string-snips-mixin
4502+ (mixin ((class->interface text%)) (all-string-snips<%>)
4503+ (inherit find-first-snip find-snip)
4504+
4505+ (define/private (all-string-snips?/slow)
4506+ (let loop ([s (find-first-snip)])
4507+ (cond
4508+ [(not s) #t ]
4509+ [(is-a? s string-snip%) (loop (send s next))]
4510+ [else #f ])))
4511+
4512+ (define/augment (after-insert start end)
4513+ (inner (void) after-insert start end)
4514+
4515+ (when (equal? all-string-snips-state #t )
4516+ (let loop ([s (find-snip start 'after-or-none )]
4517+ [i start])
4518+ (cond
4519+ [(not s) (void)]
4520+ [(not (< i end)) (void)]
4521+ [(is-a? s string-snip%)
4522+ (define size (send s get-count))
4523+ (loop (send s next) (+ i size))]
4524+ [else (set! all-string-snips-state #f )]))))
4525+
4526+ (define/augment (on-delete start end)
4527+ (inner (void) on-delete start end)
4528+ (when (equal? all-string-snips-state #f )
4529+ (let loop ([s (find-snip start 'after-or-none )]
4530+ [i start])
4531+ (cond
4532+ [(not s) (void)]
4533+ [(not (< i end)) (void)]
4534+ [(is-a? s string-snip%)
4535+ (define size (send s get-count))
4536+ (loop (send s next) (+ i size))]
4537+ [else (set! all-string-snips-state 'dont-know )]))))
4538+
4539+
4540+ ;; (or/c #t #f 'dont-know)
4541+ (define all-string-snips-state #t )
4542+ (define/public (all-string-snips?)
4543+ (cond
4544+ [(boolean? all-string-snips-state)
4545+ all-string-snips-state]
4546+ [else
4547+ (define all-string-snips? (all-string-snips?/slow))
4548+ (set! all-string-snips-state all-string-snips?)
4549+ all-string-snips?]))
4550+
4551+ (super-new )))
4552+
44974553(define basic% (basic-mixin (editor:basic-mixin text%)))
44984554(define line-spacing% (line-spacing-mixin basic%))
44994555(define hide-caret/selection% (hide-caret/selection-mixin line-spacing%))
0 commit comments