From 45eaab276eae6db59bd8121f9d42a35940899b48 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Mon, 26 Nov 2012 16:36:10 -0600 Subject: [PATCH] make unhighlight-range remove only the first matching range, not all of the matching ranges original commit: 6d56491e8db5a7c2a4c735155ff1547014c4d371 --- collects/framework/private/text.rkt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/collects/framework/private/text.rkt b/collects/framework/private/text.rkt index 1a9643e2..8d48f6fe 100644 --- a/collects/framework/private/text.rkt +++ b/collects/framework/private/text.rkt @@ -320,13 +320,19 @@ (define color (if (is-a? in-color color%) in-color (send the-color-database find-color in-color))) + (define found-one? #f) (unhighlight-ranges (λ (r-start r-end r-color r-caret-space? r-style) - (and (equal? start r-start) - (equal? end r-end) - (equal? color r-color) - (equal? caret-space? r-caret-space?) - (equal? style r-style))))) + (cond + [found-one? #f] + [(and (equal? start r-start) + (equal? end r-end) + (equal? color r-color) + (equal? caret-space? r-caret-space?) + (equal? style r-style)) + (set! found-one? #t) + #t] + [else #f])))) (define/public (unhighlight-ranges pred) (define left #f)