     ] [ drop ] if ;
 
 M: editor graft*
-    dup
-    dup caret>> activate-editor-model
-    dup mark>> activate-editor-model ;
+    [ dup caret>> activate-editor-model ]
+    [ dup mark>> activate-editor-model ] bi ;
 
 M: editor ungraft*
-    dup
-    dup stop-blinking
-    dup caret>> deactivate-editor-model
-    dup mark>> deactivate-editor-model ;
+    [ stop-blinking ]
+    [ dup caret>> deactivate-editor-model ]
+    [ dup mark>> deactivate-editor-model ] tri ;
 
 : editor-caret ( editor -- loc ) caret>> value>> ;
 


: compute-selection ( editor -- assoc )
    dup gadget-selection? [
        [ selection-start/end [ [ first ] bi@ [a,b] ] 2keep ] keep model>>
        '[ [ _ _ ] keep _ start/end-on-line 2array ] H{ } map>assoc
    ] [ drop f ] if ;

:: draw-selection ( line pair editor -- )

M: field font>> editor>> font>> ;

M: field pref-dim*
    [ ]
    [ editor>> pref-dim ]
    [ [ line-gadget-width ] [ drop second ] 2bi 2array ]
    tri border-pref-dim ;

TUPLE: model-field < field field-model ;

: <model-field> ( model -- gadget )
    model-field new-field
        swap >>field-model ;

M: model-field graft*
    [ [ field-model>> value>> ] [ editor>> ] bi set-editor-string ]
