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
(send lang get-language-info
'drracket:submit-predicate
(λ (editor prompt-position)
(and (only-whitespace-after-insertion-point)
(λ (port only-whitespace-afterwards?)
(and only-whitespace-afterwards?
(submit-predicate this prompt-position))))])
(pred
;; no good! giving away the farm here. need to hand over a proxy that is limited to just read access
this
prompt-position))]
(open-input-text-editor this prompt-position)
(only-whitespace-after-insertion-point)))]
[else
(and (only-whitespace-after-insertion-point)
(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).
The info procedure is passed @racket['drracket:submit-predicate]
and should return a function with this contract:
@racketblock[(-> (is-a?/c text%)
number?
@racketblock[(-> input-port?
boolean?
boolean?)]
This function is called with the interactions window's editor object
the first position in the editor after the prompt and should return
a boolean indicating if the expression should be evaluated.
This function's first argument is a port that contains the interactions window's
data, starting from the prompt position to the end of the editor.
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
limits.