From 75820c03cddd81c938b553823bf322fe1225186f Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 1 Dec 2012 14:50:19 -0600 Subject: [PATCH] another attempt to avoid building rectangles where the right edge is left of the left edge original commit: cc0a105e21c358290d1f92144c4a230801d5cdd0 --- collects/framework/private/text.rkt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/collects/framework/private/text.rkt b/collects/framework/private/text.rkt index 45fe22bf..5592618b 100644 --- a/collects/framework/private/text.rkt +++ b/collects/framework/private/text.rkt @@ -216,19 +216,21 @@ (define color (range-color range)) (define lp (last-position)) (define-values (start-eol? end-eol?) (if (= start end) (values #f #f) (values #f #t))) - (define-values (start-x top-start-y bottom-start-y) - (begin - (position-locations start b1 b2 #f b3 start-eol? #t) - (values (if (and caret-space? (not (= start end))) - (+ 1 (unbox b1)) - (unbox b1)) - (unbox b2) - (unbox b3)))) (define-values (end-x top-end-y bottom-end-y) (begin (position-locations end b1 b2 #f b3 end-eol? #t) (values (unbox b1) (unbox b2) (unbox b3)))) + (define-values (start-x top-start-y bottom-start-y) + (begin + (position-locations start b1 b2 #f b3 start-eol? #t) + (values (if (and caret-space? + (not (= start end)) + (<= (+ (unbox b1) 1) end-x)) + (+ 1 (unbox b1)) + (unbox b1)) + (unbox b2) + (unbox b3)))) (cond ;; the position-location values can be strange when ;; this condition is true, so we just bail out.