Documents
Factor handbook > UI framework > Building user interfaces > Pre-made UI gadgets > Editor gadgets

Prev:<action-field> ( quot: ( string -- ) -- gadget )


The documents vocabulary implements documents, which are models storing a passage of text as a sequence of lines. Operations are defined for operating on subranges of the text, and Editor gadgets can display these models.
document

<document> ( -- document )


Getting and setting the contents of the entire document:
doc-string ( document -- str )

set-doc-string ( string document -- )

clear-doc ( document -- )


Getting and setting subranges:
doc-line ( n document -- string )

doc-lines ( from to document -- slice )

doc-range ( from to document -- string )

set-doc-range ( string from to document -- )

remove-doc-range ( from to document -- )


A combinator:
each-line ( ... from to quot: ( ... line -- ... ) -- ... )


More info:
Document locations
Document elements

See also
Editor gadgets