fixed longstanding paren matching bug

original commit: e6181472fad95c9a7e51d4f5922f0c2e62265080
This commit is contained in:
Robby Findler 2001-09-24 19:56:35 +00:00
parent 0c136456f6
commit 769a63d8fb

View File

@ -135,21 +135,22 @@
(ormap (ormap
(lambda (comment-start) (lambda (comment-start)
(let loop ([f (find-string comment-start 'backward position)]) (let loop ([f (find-string comment-start 'backward position)])
(if f (cond
(cond [(not f)
[(= (position-line f) line) #f]
(let ([f-1 (- f 2)]) ;; -1 to go back one, -1 to be before char [(= (position-line f) line)
(cond (let ([f-1 (- f 2)]) ;; -1 to go back one, -1 to be before char
[(< f-1 0) (cond
#t] [(< f-1 0)
[(and (= (position-line f-1) line) #t]
(not (char=? (get-character f-1) #\\ ))) [(not (= (position-line f-1) line))
#t] #t]
[else [(not (char=? (get-character f-1) #\\ ))
(loop (find-string comment-start 'backward f-1))]))] #t]
[else [else
#f]) (loop (find-string comment-start 'backward f-1))]))]
#f))) [else
#f])))
(scheme-paren:get-comments)))) (scheme-paren:get-comments))))
@ -247,8 +248,7 @@
(let ([semi-pos (find-string ";" 'backward paren-pos)]) (let ([semi-pos (find-string ";" 'backward paren-pos)])
(cond (cond
[(or (not semi-pos) [(or (not semi-pos)
(< semi-pos (paragraph-start-position (semi-pos . < . (paragraph-start-position (position-paragraph paren-pos))))
(position-paragraph paren-pos))))
paren-pos] paren-pos]
[else (loop (- semi-pos 1))]))])))) [else (loop (- semi-pos 1))]))]))))