fixed a bug
svn: r3197 original commit: 86f3f979e0915ca0d0eea00759a48c4346c3e70a
This commit is contained in:
parent
76953283b1
commit
d15b16628a
|
@ -1230,7 +1230,9 @@
|
||||||
(define (insert-paren text)
|
(define (insert-paren text)
|
||||||
(let* ([pos (send text get-start-position)]
|
(let* ([pos (send text get-start-position)]
|
||||||
[real-char #\[]
|
[real-char #\[]
|
||||||
[change-to (λ (c) (set! real-char c))]
|
[change-to (λ (i c)
|
||||||
|
;(printf "change-to, case ~a\n" i)
|
||||||
|
(set! real-char c))]
|
||||||
[start-pos (send text get-start-position)]
|
[start-pos (send text get-start-position)]
|
||||||
[end-pos (send text get-end-position)])
|
[end-pos (send text get-end-position)])
|
||||||
(send text begin-edit-sequence #f #f)
|
(send text begin-edit-sequence #f #f)
|
||||||
|
@ -1256,7 +1258,7 @@
|
||||||
(void)]
|
(void)]
|
||||||
[(member b-m-char '(#\( #\[ #\{))
|
[(member b-m-char '(#\( #\[ #\{))
|
||||||
;; found a "sibling" parenthesized sequence. use the parens it uses.
|
;; found a "sibling" parenthesized sequence. use the parens it uses.
|
||||||
(change-to b-m-char)]
|
(change-to 1 b-m-char)]
|
||||||
[else
|
[else
|
||||||
;; there is a sexp before this, but it isn't parenthesized.
|
;; there is a sexp before this, but it isn't parenthesized.
|
||||||
;; if it is the `cond' keyword, we get a square bracket. otherwise not.
|
;; if it is the `cond' keyword, we get a square bracket. otherwise not.
|
||||||
|
@ -1265,7 +1267,7 @@
|
||||||
(λ (x)
|
(λ (x)
|
||||||
(text-between-equal? x text backward-match before-whitespace-pos))
|
(text-between-equal? x text backward-match before-whitespace-pos))
|
||||||
'("cond" "field" "provide/contract")))
|
'("cond" "field" "provide/contract")))
|
||||||
(change-to #\())]))]
|
(change-to 2 #\())]))]
|
||||||
[(not (zero? before-whitespace-pos))
|
[(not (zero? before-whitespace-pos))
|
||||||
;; this is the first thing in the sequence
|
;; this is the first thing in the sequence
|
||||||
;; pop out one layer and look for a keyword.
|
;; pop out one layer and look for a keyword.
|
||||||
|
@ -1281,7 +1283,7 @@
|
||||||
0)])
|
0)])
|
||||||
(cond
|
(cond
|
||||||
[(not second-backwards-match)
|
[(not second-backwards-match)
|
||||||
(change-to #\()]
|
(change-to 3 #\()]
|
||||||
[(and (beginning-of-sequence? text second-backwards-match)
|
[(and (beginning-of-sequence? text second-backwards-match)
|
||||||
(ormap (λ (x) (text-between-equal? x
|
(ormap (λ (x) (text-between-equal? x
|
||||||
text
|
text
|
||||||
|
@ -1306,6 +1308,9 @@
|
||||||
0)])
|
0)])
|
||||||
(cond
|
(cond
|
||||||
[(and second-backwards-match2
|
[(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)
|
||||||
(ormap (λ (x)
|
(ormap (λ (x)
|
||||||
(text-between-equal? x
|
(text-between-equal? x
|
||||||
text
|
text
|
||||||
|
@ -1316,11 +1321,11 @@
|
||||||
(void)]
|
(void)]
|
||||||
[else
|
[else
|
||||||
;; otherwise, round.
|
;; otherwise, round.
|
||||||
(change-to #\()]))]))]
|
(change-to 4 #\()]))]))]
|
||||||
[else
|
[else
|
||||||
(change-to #\()]))]
|
(change-to 5 #\()]))]
|
||||||
[else
|
[else
|
||||||
(change-to #\()]))))
|
(change-to 6 #\()]))))
|
||||||
(send text delete pos (+ pos 1) #f)
|
(send text delete pos (+ pos 1) #f)
|
||||||
(send text end-edit-sequence)
|
(send text end-edit-sequence)
|
||||||
(send text insert real-char start-pos end-pos)))
|
(send text insert real-char start-pos end-pos)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user