     [ drop dup extend-selection dup mark>> click-loc ]
     [ select-elt ] if ;
 
+: delete-previous-character ( editor -- ) 
+    char-elt editor-backspace ;
+
 : delete-next-character ( editor -- ) 
     char-elt editor-delete ;
 
-: delete-previous-character ( editor -- ) 
-    char-elt editor-backspace ;
-
 : delete-previous-word ( editor -- ) 
+    word-elt editor-backspace ;
+
+: delete-next-word ( editor -- ) 
     word-elt editor-delete ;
 
-: delete-next-word ( editor -- ) 
-    word-elt editor-backspace ;
-
 : delete-to-start-of-line ( editor -- ) 
+    one-line-elt editor-backspace ;
+
+: delete-to-end-of-line ( editor -- ) 
     one-line-elt editor-delete ;
-
-: delete-to-end-of-line ( editor -- ) 
-    one-line-elt editor-backspace ;
 
 : com-undo ( editor -- ) model>> undo ;
 

    { T{ key-down f f "DELETE" } delete-next-character }
    { T{ key-down f f "BACKSPACE" } delete-previous-character }
    { T{ key-down f { S+ } "BACKSPACE" } delete-previous-character }
    { T{ key-down f { C+ } "DELETE" } delete-previous-word }
    { T{ key-down f { C+ } "BACKSPACE" } delete-next-word }
    { T{ key-down f { A+ } "DELETE" } delete-to-start-of-line }
    { T{ key-down f { A+ } "BACKSPACE" } delete-to-end-of-line }
} define-command-map

: com-paste ( editor -- ) clipboard get paste-clipboard ;

! Copyright (C) 2006, 2011 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
USING: accessors timers arrays assocs calendar colors.constants
combinators combinators.short-circuit documents
