fix magic-open-paren bug

also, replace some eq?s with equal?s.
This commit is contained in:
Robby Findler 2014-09-07 15:34:14 -05:00
parent df3c56fae2
commit f4d66ad4d1
2 changed files with 7 additions and 5 deletions

View File

@ -1787,7 +1787,7 @@
(if (and (send text get-overwrite-mode) (= start-pos end-pos))
(send text insert "[" start-pos (add1 start-pos) #f)
(send text insert "[" start-pos 'same #f))
(when (eq? (send text classify-position pos) 'parenthesis)
(when (equal? (send text classify-position pos) 'parenthesis)
(let* ([before-whitespace-pos (send text skip-whitespace pos 'backward #t)]
[keyword/distance (find-keyword-and-distance before-whitespace-pos text)])
(cond
@ -1852,9 +1852,10 @@
0)])
(cond
[(and second-backwards-match2
(eq? (send text classify-position second-backwards-match)
;;; otherwise, this isn't a `let loop', it is a regular let!
'symbol)
(member (send text classify-position second-backwards-match)
;;; otherwise, this isn't a `let loop',
;;; it is a regular let
'(symbol keyword))
(member "let" letrec-like-forms)
(text-between-equal? "let"
text
@ -1875,7 +1876,7 @@
[(and (preferences:get 'framework:automatic-parens)
(not (in-string/comment? text)))
(send text insert real-char start-pos start-pos)
(when (eq? (send text classify-position start-pos) 'parenthesis)
(when (equal? (send text classify-position start-pos) 'parenthesis)
(send text insert (case real-char
[(#\() #\)]
[(#\[) #\]]

View File

@ -81,6 +81,7 @@
(test-magic-square-bracket 'let2 "(let (" "(let ([")
(test-magic-square-bracket 'let3 "(let loop " "(let loop (")
(test-magic-square-bracket 'let3 "(let loop (" "(let loop ([")
(test-magic-square-bracket 'let4 "(let rec (" "(let rec ([")
(test-magic-square-bracket 'cond1 "(cond " "(cond [")
(test-magic-square-bracket 'cond2 "(cond [" "(cond [(")
(test-magic-square-bracket 'with-syntax1 "(syntax-case x " "(syntax-case x (")