X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=basis%2Fdocuments%2Fdocuments.factor;h=b05c86c36556a7bdca5bff8e6d5aef42a5649099;hp=cc2466053b8718f80b1c382990f863c796186435;hb=3f3d57032bf29190e9bee12d168a4bce6d74653c;hpb=cd1bb8f4c8afba318249c7b756a45aa1c46ea51e diff --git a/basis/documents/documents.factor b/basis/documents/documents.factor index cc2466053b..b05c86c365 100644 --- a/basis/documents/documents.factor +++ b/basis/documents/documents.factor @@ -45,7 +45,7 @@ TUPLE: document < model locs undos redos inside-undo? ; [ drop ] [ doc-line length ] 2bi 2array ; : doc-lines ( from to document -- slice ) - [ 1+ ] [ value>> ] bi* ; + [ 1 + ] [ value>> ] bi* ; : start-on-line ( from line# document -- n1 ) drop over first = @@ -67,7 +67,7 @@ TUPLE: document < model locs undos redos inside-undo? ; [ start-on-line ] [ end-on-line ] bi-curry bi-curry bi* ; : last-line# ( document -- line ) - value>> length 1- ; + value>> length 1 - ; CONSTANT: doc-start { 0 0 } @@ -84,7 +84,7 @@ CONSTANT: doc-start { 0 0 } over length 1 = [ nip first2 ] [ - first swap length 1- + 0 + first swap length 1 - + 0 ] if ] dip last length + 2array ; @@ -92,7 +92,7 @@ CONSTANT: doc-start { 0 0 } 0 swap [ append ] change-nth ; : append-last ( str seq -- ) - [ length 1- ] keep [ prepend ] change-nth ; + [ length 1 - ] keep [ prepend ] change-nth ; : loc-col/str ( loc document -- str col ) [ first2 swap ] dip nth swap ; @@ -103,7 +103,7 @@ CONSTANT: doc-start { 0 0 } : (set-doc-range) ( doc-lines from to lines -- changed-lines ) [ prepare-insert ] 3keep - [ [ first ] bi@ 1+ ] dip + [ [ first ] bi@ 1 + ] dip replace-slice ; : entire-doc ( document -- start end document )