     dup graft-state>> second [
         [
             [ caret-loc ] [ caret-dim { 2 1 } v+ ] bi <rect>
-        ] keep scroll>rect
+        ] [ scroll>rect ] bi
     ] [ drop ] if ;
 
 : draw-caret? ( editor -- ? )
-    [ focused?>> ] [ blink>> ] bi and ;
+    { [ focused?>> ] [ blink>> ] } 1&& ;
 
 : draw-caret ( editor -- )
     dup draw-caret? [


: this-line-and-next ( document line -- start end )
    [ nip 0 swap 2array ]
    [ [ nip 1 + ] [ 1 + swap doc-line length ] 2bi 2array ]
    2bi ;

: last-line? ( document line -- ? )

    ] [ drop ] if ;

M: editor graft*
    [ dup caret>> activate-editor-model ]
    [ dup mark>> activate-editor-model ] bi ;

M: editor ungraft*
    [ stop-blinking ]
    [ dup caret>> deactivate-editor-model ]
    [ dup mark>> deactivate-editor-model ] tri ;

: editor-caret ( editor -- loc ) caret>> value>> ;

