UI listener
Factor handbook > UI developer tools

Prev:Definition icons
Next:UI browser


The graphical listener adds input history and word and vocabulary completion. A summary with any outstanding error conditions is displayed before every prompt (see UI error list tool for details).

See The listener for general information on the listener.

Toolbar commands
ShortcutCommandWordNotes
Restart Listenerrestart-listener
A+uAuto Usecom-auto-use
A+kClear Outputclear-output
S+A+kClear Stackclear-stack
C+dEndcom-end
F1Helpcom-help


Completion commands
ShortcutCommandWordNotes
TABCode Completion Popupcode-completion-popup
C+pRecall Previousrecall-previous
C+nRecall Nextrecall-next
C+rHistory Completion Popuphistory-completion-popup


Interactor commands
ShortcutCommandWordNotes
RETEvaluate Inputevaluate-input
C+kClear Editorclear-editor


Scrolling commands
The listener's scroller can be scrolled from the keyboard.
ShortcutCommandWordNotes
A+UPScroll Upcom-scroll-up
A+DOWNScroll Downcom-scroll-down
A+PAGE_UPPage Upcom-page-up
A+PAGE_DOWNPage Downcom-page-down


Multi Touch commands
ShortcutCommandWordNotes
Swipe upRefresh Allrefresh-all


Word commands
These words operate on the word at the cursor.
ShortcutCommandWordNotes
Inspectorinspector
Prettyprintcom-prettyprint
Pushcom-push
Unparsecom-unparse
C+eEditedit
Forgetcom-forget
C+hBrowsecom-browse
C+uUsageusage.
C+fFixfix
Watchwatch
Breakpointbreakpoint
Seesee
Speakspeak


Vocabulary commands
These words operate on the vocabulary at the cursor.
ShortcutCommandWordNotes
Inspectorinspector
Prettyprintcom-prettyprint
Pushcom-push
Unparsecom-unparse
C+eEditedit
Forgetcom-forget
C+hBrowsecom-browse
Watchwatch
Use Vocabcom-use-vocab
Runrun
Deploy Tooldeploy-tool


Quotation commands
These commands operate on the entire contents of the input area.
ShortcutCommandWordNotes
Inspectorinspector
Prettyprintcom-prettyprint
Pushcom-push
Unparsecom-unparse
Watchwatch
C+iStack Effectcom-stack-effect
C+wWalkwalk
C+tTimetime
C+mExpand Macroscom-expand-macros


Editing commands
The text editing commands are standard; see Editor gadget commands.

If you want to add support for Emacs-style text entry, specifically the following:

Ctrl-kDelete to end of line
Ctrl-aMove cursor to start of line
Ctrl-eMove cursor to end of line


Then you can run the following code, or add it to your Startup initialization file.

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 "interactor" interactor get-command-at [ [ drop T{ key-down f { C+ } "k" } = ] assoc-reject ] change-commands drop interactor update-gestures


Implementation
Listeners are instances of listener-gadget. The listener consists of an output area (instance of pane) and an input area (instance of interactor). Clickable presentations can also be printed to the listener; see Presentations in the UI.