 action-field H{
     { T{ key-down f f "RET" } [ invoke-action-field ] }
 } set-gestures
+
+: readline-bindings ( editor-class -- )
+    "readline" f {
+        { T{ key-down f { C+ } "p" } previous-line }
+        { T{ key-down f { C+ } "n" } next-line }
+        { T{ key-down f { C+ } "b" } previous-character }
+        { T{ key-down f { C+ } "f" } next-character }
+        { T{ key-down f { C+ } "a" } start-of-line }
+        { T{ key-down f { C+ } "e" } end-of-line }
+        ! { T{ key-down f { C+ } "t" } transpose-character }
+        { T{ key-down f { C+ } "d" } delete-next-character }
+        { T{ key-down f { C+ } "h" } delete-previous-character }
+        { T{ key-down f { C+ } "u" } delete-to-start-of-line }
+        { T{ key-down f { C+ } "k" } delete-to-end-of-line }
+        { T{ key-down f { C+ } "w" } delete-previous-word }
+    } define-command-map ;

} os macosx? [ {
    { T{ key-down f { C+ } "DELETE" } delete-next-character }
    { T{ key-down f { C+ } "BACKSPACE" } delete-previous-character }
    ! { T{ key-down f { C+ } "t" } transpose-character }
    { T{ key-down f { C+ } "d" } delete-next-character }
    { T{ key-down f { C+ } "h" } delete-previous-character }
    { T{ key-down f { C+ } "u" } delete-to-start-of-line }
    { T{ key-down f { C+ } "k" } delete-to-end-of-line }
    { T{ key-down f { C+ } "w" } delete-previous-word }
} append ] when define-command-map

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

    { T{ key-down f { M+ } "DOWN" } end-of-paragraph }
    { T{ key-down f { M+ } "HOME" } start-of-document }
    { T{ key-down f { M+ } "END" } end-of-document }
} append ] when define-command-map

: clear-editor ( editor -- )
