ui.tools.listener: document emacs-style keybindings for now.

master
John Benediktsson 2020-06-06 16:28:40 -07:00
parent 4f51adf8bf
commit 02386eebcc
1 changed files with 15 additions and 7 deletions

View File

@ -54,6 +54,11 @@ $nl
"If you want to add support for Emacs-style text entry, specifically the following:"
$nl
{ $table
{ "Ctrl-b" "Move cursor to previous character" }
{ "Ctrl-f" "Move cursor to next character" }
{ "Ctrl-p" "Move cursor to previous line" }
{ "Ctrl-n" "Move cursor to next line" }
{ "Ctrl-u" "Delete to start of line" }
{ "Ctrl-k" "Delete to end of line" }
{ "Ctrl-a" "Move cursor to start of line" }
{ "Ctrl-e" "Move cursor to end of line" }
@ -65,13 +70,16 @@ $nl
"USING: accessors assocs kernel sequences sets ui.commands
ui.gadgets.editors ui.gestures ui.tools.listener ;
\"multiline\" multiline-editor get-command-at [
{
{ T{ key-down f { C+ } \"k\" } delete-to-end-of-line }
{ T{ key-down f { C+ } \"a\" } start-of-line }
{ T{ key-down f { C+ } \"e\" } end-of-line }
} append members
] change-commands drop multiline-editor update-gestures
editor \"emacs\" f {
{ T{ key-down f { C+ } \"b\" } previous-character }
{ T{ key-down f { C+ } \"f\" } next-character }
{ T{ key-down f { C+ } \"p\" } previous-line }
{ T{ key-down f { C+ } \"n\" } next-line }
{ 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+ } \"a\" } start-of-line }
{ T{ key-down f { C+ } \"e\" } end-of-line }
} define-command-map
\"interactor\" interactor get-command-at [
[ drop T{ key-down f { C+ } \"k\" } = ] assoc-reject