adjusted f1 in drracket so that it uses the syntax colorer
(this fixes hitting f1 on things like the "racket" in @racket[...])
This commit is contained in:
parent
71ecf83d63
commit
3abfb8ce91
|
@ -232,6 +232,23 @@ module browser threading seems wrong.
|
||||||
;; find-symbol : number -> string
|
;; find-symbol : number -> string
|
||||||
;; finds the symbol around the position `pos' (approx)
|
;; finds the symbol around the position `pos' (approx)
|
||||||
(define (find-symbol text pos)
|
(define (find-symbol text pos)
|
||||||
|
(cond
|
||||||
|
[(is-a? text scheme:text<%>)
|
||||||
|
(let* ([before (send text get-backward-sexp pos)]
|
||||||
|
[before+ (and before (send text get-forward-sexp before))]
|
||||||
|
[after (send text get-forward-sexp pos)]
|
||||||
|
[after- (and after (send text get-backward-sexp after))])
|
||||||
|
(cond
|
||||||
|
[(and before before+
|
||||||
|
(<= before pos before+)
|
||||||
|
(eq? 'symbol (send text classify-position before)))
|
||||||
|
(send text get-text before before+)]
|
||||||
|
[(and after after-
|
||||||
|
(<= after- pos after)
|
||||||
|
(eq? 'symbol (send text classify-position after-)))
|
||||||
|
(send text get-text after- after)]
|
||||||
|
[else ""]))]
|
||||||
|
[else
|
||||||
(send text split-snip pos)
|
(send text split-snip pos)
|
||||||
(send text split-snip (+ pos 1))
|
(send text split-snip (+ pos 1))
|
||||||
(let ([snip (send text find-snip pos 'after)])
|
(let ([snip (send text find-snip pos 'after)])
|
||||||
|
@ -255,7 +272,7 @@ module browser threading seems wrong.
|
||||||
(cons char (loop (+ i 1)))))
|
(cons char (loop (+ i 1)))))
|
||||||
null))])
|
null))])
|
||||||
(apply string (append before after)))
|
(apply string (append before after)))
|
||||||
"")))
|
""))]))
|
||||||
|
|
||||||
;; non-letter? : char -> boolean
|
;; non-letter? : char -> boolean
|
||||||
;; returns #t if the character belongs in a symbol (approx) and #f it is
|
;; returns #t if the character belongs in a symbol (approx) and #f it is
|
||||||
|
|
Loading…
Reference in New Issue
Block a user