diff --git a/collects/framework/private/color.rkt b/collects/framework/private/color.rkt index 0dcf771b28..d9b5349276 100644 --- a/collects/framework/private/color.rkt +++ b/collects/framework/private/color.rkt @@ -869,7 +869,12 @@ added get-regions (let loop ((cur-pos position)) (let ((p (internal-backward-match cur-pos cutoff))) (cond - ((eq? 'open p) cur-pos) + ((eq? 'open p) + ;; Should this function skip + ;; backwards past whitespace? + ;; the docs seem to indicate it + ;; does, but it doesn't really + cur-pos) ((not p) #f) (else (loop p)))))) @@ -1070,7 +1075,8 @@ added get-regions (define-values (a b) (get-token-range pos)) (cond [(or (= a pos) (= b pos)) - (define bcs (backward-containing-sexp pos 0)) + (define raw-bcs (backward-containing-sexp pos 0)) + (define bcs (skip-whitespace raw-bcs 'backward #t)) (cond [(and bcs (> bcs 0)) (define a (assoc (string->symbol (string (get-character (- bcs 1)))) diff --git a/collects/tests/framework/racket.rkt b/collects/tests/framework/racket.rkt index 9f948a47dc..97c10901b7 100644 --- a/collects/tests/framework/racket.rkt +++ b/collects/tests/framework/racket.rkt @@ -321,6 +321,12 @@ '(["#| (123 abc|" "|# def 456)"] ["#| (123 abc|#" " def 456)"])) +(test-parens-behavior/full 'close-adjusts-properly-when-space-follows-paren + "( x" "" "" + #\] + '(["( x)" "" ""] + ["( x)" "" ""])) + #| for these, the key-event with meta-down doesn't seem to work... maybe a Mac OS issue; and may cause problems with these tests on another platform? .nah. |# (when (equal? 'macosx (system-type))