From 8f3e7c056c260a161f2c29c94a89a08441ea25f4 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 30 Nov 2007 19:54:44 +0000 Subject: [PATCH] fixed a bug in new paren coloring behavior svn: r7872 original commit: 6913fab8f6122e7ca14b34bef78ea6708a75dd58 --- collects/framework/private/color.ss | 13 +++++++------ collects/framework/private/text.ss | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/collects/framework/private/color.ss b/collects/framework/private/color.ss index b45b2e9f..b1bd13f5 100644 --- a/collects/framework/private/color.ss +++ b/collects/framework/private/color.ss @@ -413,14 +413,15 @@ (define mismatch-color (make-object color% "PINK")) (define/private (get-match-color) (preferences:get 'framework:paren-match-color)) - ;; higlight : number number number (or/c #f #t color) - ;; if color is a boolean, then #t means the normal paren color and #f means an error color. - ;; Otherwise, color is a color + ;; higlight : number number number (or/c color any) + ;; if color is a color, then it uses that color to higlight + ;; Otherwise, it treats it like a boolean, where a true value + ;; means the normal paren color and #f means an error color. (define/private (highlight start end caret-pos color) (let ([off (highlight-range (+ start-pos start) (+ start-pos end) - (if (boolean? color) - (if color mismatch-color (get-match-color)) - color) + (if (is-a? color color%) + color + (if color mismatch-color (get-match-color))) (and (send (icon:get-paren-highlight-bitmap) ok?) (icon:get-paren-highlight-bitmap)) diff --git a/collects/framework/private/text.ss b/collects/framework/private/text.ss index 9d9afe6e..0097c509 100644 --- a/collects/framework/private/text.ss +++ b/collects/framework/private/text.ss @@ -261,6 +261,9 @@ WARNING: printf is rebound in the body of the unit to always (unless (or (eq? priority 'high) (eq? priority 'low)) (error 'highlight-range "expected last argument to be either 'high or 'low, got: ~e" priority)) + (unless (is-a? color color%) + (error 'highlight-range "expected a color for the third argument, got ~s" color)) + (let ([l (make-range start end bitmap color caret-space?)]) (invalidate-rectangles range-rectangles) (set! ranges (if (eq? priority 'high) (cons l ranges) (append ranges (list l))))