open-input-text-editor in Editors
(open-input-text-editor-> input-porttext-editorstart-positionend-positionsnip-filterport-nameexpect-to-read-all?)
text-editor:text%object
start-position=0: exact non-negative integer
end-position=: exact non-negative integer or'end'end
snip-filter=: a procedure of one argument: a(lambda(s) s)snip%object
port-name=: valuetext-editor
expect-to-read-all?=#f: booleanCreates an input port that draws its content from
text-editor. The editor content between positionsstart-positionandend-positionis the content of the port. Ifend-positionis'end, the content runs until the end of the editor. If a snip that is not astring-snip%object spansstart-positionorend-position, the entire snip contributes to the port. If astring-snip%instance spansstart-position, only the part of the snip afterstart-positioncontributes, and if astring-snip%object spansend-position, only the part beforeend-positioncontributes.An instance of
string-snip%intext-editorgenerates a character sequence in the resulting port. All other kinds of snips are passed tosnip-filterto obtain a ``special'' value for the port. If a snip is returned as the first result fromsnip-filter, and if the snip is an instance ofreadable-snip<%>, the snip generates a special value for the port through theread-specialmethod. Ifsnip-filterreturns any other kind of snip, it is copied for the special result. Finally, a non-snip first result fromsnip-filteris used directly as the special result.The
port-nameargument is used for the input port's name. Theexpect-to-read-all?argument is a performance hint; use#tif the entire port's stream will be read.The result port must not be used if
text-editorchanges in any of the following ways: a snip is inserted (seeafter-insert), a snip is deleted (seeafter-delete), a snip is split (seeafter-split-snip), snips are merged (seeafter-merge-snips), or a snip changes its count (which is rare; seerecounted). Theget-revision-numbermethod can be used to detect any of these changes.