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)
#f]
[(= (position-line f) line) [(= (position-line f) line)
(let ([f-1 (- f 2)]) ;; -1 to go back one, -1 to be before char (let ([f-1 (- f 2)]) ;; -1 to go back one, -1 to be before char
(cond (cond
[(< f-1 0) [(< f-1 0)
#t] #t]
[(and (= (position-line f-1) line) [(not (= (position-line f-1) line))
(not (char=? (get-character f-1) #\\ ))) #t]
[(not (char=? (get-character f-1) #\\ ))
#t] #t]
[else [else
(loop (find-string comment-start 'backward f-1))]))] (loop (find-string comment-start 'backward f-1))]))]
[else [else
#f]) #f])))
#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))]))]))))