more close paren adjustment repairs

This commit is contained in:
Robby Findler 2013-01-31 20:58:20 -06:00
parent 6f99bfb801
commit 8aadc03719
2 changed files with 17 additions and 0 deletions

View File

@ -1073,7 +1073,9 @@ added get-regions
;; paren, in which case it returns #f. ;; paren, in which case it returns #f.
(define/private (get-close-paren pos) (define/private (get-close-paren pos)
(define-values (a b) (get-token-range pos)) (define-values (a b) (get-token-range pos))
(define token (classify-position pos))
(cond (cond
[(memq token '(string comment error)) #f]
[(or (= a pos) (= b pos)) [(or (= a pos) (= b pos))
(define raw-bcs (backward-containing-sexp pos 0)) (define raw-bcs (backward-containing-sexp pos 0))
(define bcs (skip-whitespace raw-bcs 'backward #t)) (define bcs (skip-whitespace raw-bcs 'backward #t))

View File

@ -326,6 +326,21 @@
#\] #\]
'(["( x)" "" ""] '(["( x)" "" ""]
["( x)" "" ""])) ["( x)" "" ""]))
(test-parens-behavior/full 'close-adjusts-properly-when-inside-a-comment
"[();" "" ""
#\)
'(["[();)" "" ""]
["[();)" "" ""]))
(test-parens-behavior/full 'close-adjusts-properly-when-inside-an-unclosed-string
"[()\"" "" ""
#\)
'(["[()\")" "" ""]
["[()\")" "" ""]))
(test-parens-behavior/full 'close-adjusts-properly-when-inside-a-string
"[()\"" "" "\""
#\)
'(["[()\")" "" "\""]
["[()\")" "" "\""]))
#| for these, the key-event with meta-down doesn't seem to work... maybe a Mac OS #| 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. |# issue; and may cause problems with these tests on another platform? .nah. |#