fixed some bugs in the yellow highlighting
svn: r11750
This commit is contained in:
parent
c870eadf03
commit
bd954710f6
|
@ -986,7 +986,6 @@ WARNING: printf is rebound in the body of the unit to always
|
||||||
(define/augment (on-insert start len)
|
(define/augment (on-insert start len)
|
||||||
(begin-edit-sequence)
|
(begin-edit-sequence)
|
||||||
(clear-all-regions)
|
(clear-all-regions)
|
||||||
(update-yellow)
|
|
||||||
(inner (void) on-insert start len))
|
(inner (void) on-insert start len))
|
||||||
(define/augment (after-insert start len)
|
(define/augment (after-insert start len)
|
||||||
(unless updating-search?
|
(unless updating-search?
|
||||||
|
@ -1001,7 +1000,6 @@ WARNING: printf is rebound in the body of the unit to always
|
||||||
(define/augment (after-delete start len)
|
(define/augment (after-delete start len)
|
||||||
(unless updating-search?
|
(unless updating-search?
|
||||||
(content-changed))
|
(content-changed))
|
||||||
(update-yellow)
|
|
||||||
(inner (void) after-delete start len)
|
(inner (void) after-delete start len)
|
||||||
(end-edit-sequence))
|
(end-edit-sequence))
|
||||||
|
|
||||||
|
@ -1033,17 +1031,16 @@ WARNING: printf is rebound in the body of the unit to always
|
||||||
(define/override (on-focus on?)
|
(define/override (on-focus on?)
|
||||||
(let ([f (get-top-level-window)])
|
(let ([f (get-top-level-window)])
|
||||||
(when (is-a? f frame:searchable<%>)
|
(when (is-a? f frame:searchable<%>)
|
||||||
(when on?
|
(set! has-focus? on?)
|
||||||
(send f set-text-to-search this)
|
(cond
|
||||||
(clear-yellow)
|
[on?
|
||||||
(set! clear-yellow void))
|
;; this triggers a call to update-yellow
|
||||||
(set! do-yellow?
|
(send f set-text-to-search this)]
|
||||||
(and (not on?)
|
[else
|
||||||
(eq? (send f get-text-to-search) this)))
|
(update-yellow)])))
|
||||||
(update-yellow)))
|
|
||||||
(super on-focus on?))
|
(super on-focus on?))
|
||||||
|
|
||||||
(define do-yellow? #f)
|
(define has-focus? #f)
|
||||||
(define clear-yellow void)
|
(define clear-yellow void)
|
||||||
(define/augment (after-set-position)
|
(define/augment (after-set-position)
|
||||||
(update-yellow)
|
(update-yellow)
|
||||||
|
@ -1077,17 +1074,29 @@ WARNING: printf is rebound in the body of the unit to always
|
||||||
(send tlw search-hits-changed)))))
|
(send tlw search-hits-changed)))))
|
||||||
|
|
||||||
(define/private (update-yellow)
|
(define/private (update-yellow)
|
||||||
(when do-yellow?
|
(cond
|
||||||
|
[has-focus?
|
||||||
|
(unless (eq? clear-yellow void)
|
||||||
|
(clear-yellow)
|
||||||
|
(set! clear-yellow void))]
|
||||||
|
[searching-str
|
||||||
(let ([start (get-start-position)]
|
(let ([start (get-start-position)]
|
||||||
[end (get-end-position)])
|
[end (get-end-position)])
|
||||||
(unless (= start end)
|
(cond
|
||||||
|
[(= start end)
|
||||||
|
(clear-yellow)
|
||||||
|
(set! clear-yellow void)]
|
||||||
|
[else
|
||||||
(begin-edit-sequence)
|
(begin-edit-sequence)
|
||||||
(clear-yellow)
|
(clear-yellow)
|
||||||
(set! clear-yellow void)
|
(set! clear-yellow void)
|
||||||
(when searching-str
|
(when (and searching-str (= (string-length searching-str) (- end start)))
|
||||||
(when (do-search searching-str start end)
|
(when (do-search searching-str start end)
|
||||||
(set! clear-yellow (highlight-range start end "khaki" #f 'low 'ellipse))))
|
(set! clear-yellow (highlight-range start end "khaki" #f 'low 'ellipse))))
|
||||||
(end-edit-sequence)))))
|
(end-edit-sequence)]))]
|
||||||
|
[else
|
||||||
|
(clear-yellow)
|
||||||
|
(set! clear-yellow void)]))
|
||||||
|
|
||||||
(define/public (get-search-bubbles)
|
(define/public (get-search-bubbles)
|
||||||
(sort (hash-map search-bubble-table
|
(sort (hash-map search-bubble-table
|
||||||
|
@ -1161,6 +1170,8 @@ WARNING: printf is rebound in the body of the unit to always
|
||||||
'hollow-ellipse)))))]
|
'hollow-ellipse)))))]
|
||||||
[else
|
[else
|
||||||
(invalidate-bitmap-cache)])
|
(invalidate-bitmap-cache)])
|
||||||
|
|
||||||
|
(update-yellow)
|
||||||
(end-edit-sequence)
|
(end-edit-sequence)
|
||||||
|
|
||||||
;; stopping the timer ensures that when there is both an edit to the buffer *and*
|
;; stopping the timer ensures that when there is both an edit to the buffer *and*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user