Update more documentation

db4
Slava Pestov 2009-01-28 14:54:13 -06:00
parent 0c22751674
commit 50ba37bdbe
3 changed files with 10 additions and 0 deletions

View File

@ -92,6 +92,7 @@ HELP: clear-doc
{ $side-effects "document" } ;
ARTICLE: "documents" "Documents"
"The " { $vocab-link "documents" } " vocabulary implements " { $emphasis "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 " { $link "gadgets-editors" } " can display these models."
{ $subsection document }
{ $subsection <document> }
"Getting and setting the contents of the entire document:"

View File

@ -18,6 +18,8 @@ GENERIC: next-elt ( loc document elt -- newloc )
SINGLETON: char-elt
<PRIVATE
: (prev-char) ( loc document quot -- loc )
{
{ [ pick { 0 0 } = ] [ 2drop ] }
@ -32,6 +34,8 @@ SINGLETON: char-elt
[ call ]
} cond ; inline
PRIVATE>
M: char-elt prev-elt
drop [ drop -1 +col ] (prev-char) ;
@ -44,6 +48,8 @@ M: one-char-elt prev-elt 2drop ;
M: one-char-elt next-elt 2drop ;
<PRIVATE
: (word-elt) ( loc document quot -- loc )
pick [
[ [ first2 swap ] dip doc-line ] dip call
@ -62,6 +68,8 @@ M: one-char-elt next-elt 2drop ;
[ rot break-detector find-from drop ] keep
over not [ nip length ] [ drop ] if ;
PRIVATE>
SINGLETON: one-word-elt
M: one-word-elt prev-elt

View File

@ -105,6 +105,7 @@ ARTICLE: "gadgets-editors" "Editor gadgets"
"Fields:"
{ $subsection <model-field> }
{ $subsection <action-field> }
"Editors edit " { $emphasis "documents" } ":"
{ $subsection "documents" } ;
ABOUT: "gadgets-editors"