     break-detector find-last-from drop ?1+ ;
 
 : (next-word) ( col str ? -- col )
-    [ break-detector find-from drop ] [ drop length ] 2bi or ;
+    { [ break-detector find-from drop ] [ drop length ] } 2|| ;
 
 PRIVATE>
 


<PRIVATE

: (prev-char) ( loc document quot -- loc )
    {
        { [ pick { 0 0 } = ] [ 2drop ] }
        { [ pick second zero? ] [ drop [ first 1- ] dip line-end ] }
        [ call ]
    } cond ; inline

: (next-char) ( loc document quot -- loc )
    {
        { [ 2over doc-end = ] [ 2drop ] }
        { [ 2over line-end? ] [ 2drop first 1+ 0 2array ] }

PRIVATE>

M: char-elt prev-elt
    drop [ drop -1 +col ] prev ;

M: char-elt next-elt
    drop [ drop 1 +col ] next ;

SINGLETON: one-char-elt

