change the way the prompt testing works to only supply a port, instead of giving over the actual text object

This commit is contained in:
Robby Findler 2010-06-20 20:54:43 -05:00
parent ee57029a92
commit e8573d9478
2 changed files with 11 additions and 9 deletions

View File

@ -999,13 +999,13 @@ TODO
(let ([pred (let ([pred
(send lang get-language-info (send lang get-language-info
'drracket:submit-predicate 'drracket:submit-predicate
(λ (editor prompt-position) (λ (port only-whitespace-afterwards?)
(and (only-whitespace-after-insertion-point) (and only-whitespace-afterwards?
(submit-predicate this prompt-position))))]) (submit-predicate this prompt-position))))])
(pred (pred
;; no good! giving away the farm here. need to hand over a proxy that is limited to just read access ;; no good! giving away the farm here. need to hand over a proxy that is limited to just read access
this (open-input-text-editor this prompt-position)
prompt-position))] (only-whitespace-after-insertion-point)))]
[else [else
(and (only-whitespace-after-insertion-point) (and (only-whitespace-after-insertion-point)
(submit-predicate this prompt-position))]))))) (submit-predicate this prompt-position))])))))

View File

@ -473,12 +473,14 @@ if an expression in the interactions window is ready to be submitted
to the evaluator (when the user types return). to the evaluator (when the user types return).
The info procedure is passed @racket['drracket:submit-predicate] The info procedure is passed @racket['drracket:submit-predicate]
and should return a function with this contract: and should return a function with this contract:
@racketblock[(-> (is-a?/c text%) @racketblock[(-> input-port?
number? boolean?
boolean?)] boolean?)]
This function is called with the interactions window's editor object This function's first argument is a port that contains the interactions window's
the first position in the editor after the prompt and should return data, starting from the prompt position to the end of the editor.
a boolean indicating if the expression should be evaluated. The second argument is a boolean indicating if the insertion point is
followed only by whitespace. The results should be a
boolean indicating if the expression should be evaluated.
This function is called in sandbox, but with no filesystem or networking This function is called in sandbox, but with no filesystem or networking
limits. limits.