From 8aa3e1d473d1cad32c93d698f00fe11a47ad0926 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 2 Feb 2013 09:09:36 -0600 Subject: [PATCH] another close-paren insertion repair (this one causes runtime errors, not bad behavior) --- collects/framework/private/color.rkt | 2 +- collects/tests/framework/racket.rkt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/collects/framework/private/color.rkt b/collects/framework/private/color.rkt index 5066dfa097..29a082cef2 100644 --- a/collects/framework/private/color.rkt +++ b/collects/framework/private/color.rkt @@ -1078,7 +1078,7 @@ added get-regions [(memq token '(string comment error)) #f] [(or (= a pos) (= b pos)) (define raw-bcs (backward-containing-sexp pos 0)) - (define bcs (skip-whitespace raw-bcs 'backward #t)) + (define bcs (and raw-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 0cd2376a01..28f805d77e 100644 --- a/collects/tests/framework/racket.rkt +++ b/collects/tests/framework/racket.rkt @@ -342,6 +342,12 @@ '(["[()\")" "" "\""] ["[()\")" "" "\""])) +(test-parens-behavior/full 'close-adjusts-properly-when-no-containing-sexp + ")" "" "" + #\] + '([")]" "" ""] + [")]" "" ""])) + #| 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))