Added text:get-port-name to framework, and used text:lookup-port-name to get at the editor in DrScheme error highlighting.
svn: r10494 original commit: a506cefeac7dad39876fb763c9ca2670a4ff57f7
This commit is contained in:
parent
2a12b0323b
commit
78b446852d
|
@ -85,6 +85,13 @@
|
||||||
symbols are meant to be module paths. If @scheme[manuals] is false,
|
symbols are meant to be module paths. If @scheme[manuals] is false,
|
||||||
then all of the documented names are used.})
|
then all of the documented names are used.})
|
||||||
|
|
||||||
|
(proc-doc/names
|
||||||
|
text:lookup-port-name
|
||||||
|
(-> symbol? (or/c (is-a?/c editor:basic<%>) false/c))
|
||||||
|
(manuals)
|
||||||
|
@{Returns the editor instance whose port-name matches the given symbol. If no
|
||||||
|
editor can be found, then returns @scheme[false].})
|
||||||
|
|
||||||
(proc-doc/names
|
(proc-doc/names
|
||||||
number-snip:make-repeating-decimal-snip
|
number-snip:make-repeating-decimal-snip
|
||||||
(number? boolean? . -> . (is-a?/c snip%))
|
(number? boolean? . -> . (is-a?/c snip%))
|
||||||
|
|
|
@ -207,7 +207,8 @@
|
||||||
(define-signature text^ extends text-class^
|
(define-signature text^ extends text-class^
|
||||||
(autocomplete-append-after
|
(autocomplete-append-after
|
||||||
autocomplete-limit
|
autocomplete-limit
|
||||||
get-completions/manuals))
|
get-completions/manuals
|
||||||
|
lookup-port-name))
|
||||||
|
|
||||||
(define-signature canvas-class^
|
(define-signature canvas-class^
|
||||||
(basic<%>
|
(basic<%>
|
||||||
|
|
|
@ -49,6 +49,30 @@ WARNING: printf is rebound in the body of the unit to always
|
||||||
(define-struct range (start end b/w-bitmap color caret-space?))
|
(define-struct range (start end b/w-bitmap color caret-space?))
|
||||||
(define-struct rectangle (left top right bottom b/w-bitmap color))
|
(define-struct rectangle (left top right bottom b/w-bitmap color))
|
||||||
|
|
||||||
|
|
||||||
|
(define-values (register-port-name! lookup-port-name)
|
||||||
|
;; port-name->editor-ht: (hashof symbol (weakboxof editor:basic<%>))
|
||||||
|
;; Maintains a mapping from port names back to their respective editors.
|
||||||
|
(let ([port-name->editor-ht (make-weak-hasheq)])
|
||||||
|
|
||||||
|
;; register-port-name-to-editor!: symbol editor<%> -> void
|
||||||
|
;; Registers the editor's port name.
|
||||||
|
(define (register-port-name! a-port-name an-editor)
|
||||||
|
(hash-set! port-name->editor-ht a-port-name (make-weak-box an-editor)))
|
||||||
|
|
||||||
|
;; lookup-port-name: symbol -> (or/c editor:basic<%> #f)
|
||||||
|
;; Given a port name, tries to get the editor with that name.
|
||||||
|
(define (lookup-port-name a-port-name)
|
||||||
|
(let ([a-weak-box (hash-ref port-name->editor-ht a-port-name #f)])
|
||||||
|
(cond
|
||||||
|
[(not a-weak-box)
|
||||||
|
#f]
|
||||||
|
[else
|
||||||
|
(weak-box-value a-weak-box)])))
|
||||||
|
|
||||||
|
(values register-port-name! lookup-port-name)))
|
||||||
|
|
||||||
|
|
||||||
;; wx: `default-wrapping?', add as the initial value for auto-wrap bitmap,
|
;; wx: `default-wrapping?', add as the initial value for auto-wrap bitmap,
|
||||||
;; unless matthew makes it primitive
|
;; unless matthew makes it primitive
|
||||||
|
|
||||||
|
@ -82,7 +106,8 @@ WARNING: printf is rebound in the body of the unit to always
|
||||||
(cond
|
(cond
|
||||||
[(or (unbox b) (not n))
|
[(or (unbox b) (not n))
|
||||||
(unless port-name-identifier
|
(unless port-name-identifier
|
||||||
(set! port-name-identifier (gensym 'unsaved-editor)))
|
(set! port-name-identifier (gensym 'unsaved-editor))
|
||||||
|
(register-port-name! port-name-identifier this))
|
||||||
port-name-identifier]
|
port-name-identifier]
|
||||||
[else n])))
|
[else n])))
|
||||||
(define/public (port-name-matches? id)
|
(define/public (port-name-matches? id)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user