     ] if ;
 
 : doc-string ( document -- str )
-    model-value "\n" join ;
+    value>> "\n" join ;
 
 : set-doc-string ( string document -- )
     >r string-lines V{ } like r> [ set-model ] keep

    >r >r >r "" r> r> r> set-doc-range ;

: last-line# ( document -- line )
    model-value length 1- ;

: validate-line ( line document -- line )
    last-line# min 0 max ;

: update-locs ( loc document -- )
    locs>> [ set-model ] with each ;

: doc-line ( n document -- string ) value>> nth ;

: doc-lines ( from to document -- slice )
    >r 1+ r> value>> <slice> ;

: start-on-line ( document from line# -- n1 )
    >r dup first r> = [ nip second ] [ 2drop 0 ] if ;
