fix close paren correction code

This commit is contained in:
Robby Findler 2013-01-31 15:06:45 -06:00
parent 9d10a33e43
commit 219f9dc358
2 changed files with 14 additions and 2 deletions

View File

@ -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))))

View File

@ -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))