editorF :: F EditCmd EditEvt data EditCmd = EditShowCursor Bool | EditMove EditStop IsSelect | EditReplace String | EditGetText | EditGetSelection | EditUndo | EditRedo data EditEvt = EditText String | EditCursor Rect instance Eq EditEvt instance Ord EditEvt selectall :: [EditCmd]
editorF is a multi-line text editor which supports simple
text editing. Key bindings are in an Emacs-like fashion. It also
supports cut/copy/paste of selections.
data EditCmd = EditShowCursor Bool | EditMove EditStop IsSelect | EditReplace String | EditGetText | EditGetSelection | EditUndo | EditRedo
data EditEvt = EditText String | EditCursor Rect
EditReplace r will replace the selected text in the editor with
r. The value selectall can be used to first select all
the text, thus making it possible to replace it with new text.
As a response to EditGetText, the editor will output
its content r as EditorText r. The other constructors can be used to control the
editor. (more documentation needed about this!)
The editor understands the following keys (in Emacs notation):
Cursor movements:
Arrow keys move the cursor one char, as well as C-p,C-n,C-f,C-v
M-Left,M-Right, M-f, M-b moves one word.
The cursor can also be moved with mouse button 1.
Selecting text:
By holding down Shift, the cursor movement keys will also select the text.
By Shift-clicking with mouse button 1, or dragging with mouse button 1, text is selected.
Inserting/deleting text:
By typing text, the selected text is replaced by the typed text. Pressing \key{DEL} will remove the selected text, or if no text is selected, remove the character to the left of the cursor. If no text is selected, M-\key{DEL} will delete the word to the left of the cursor.
Cut/Copy/Paste:
A menu with these commands will popup when mouse button 3 is pressed:
Cut: The selected text is made into the current selection (selection in the X Windows sense), and deleted.
Copy: The selected text is made into the current selection.
Paste: The selected text is replaced by the current selection.
Undo/Redo:
Undo: C-/. Redo: C-?
The undo buffer is by default infinite (thus producing a memory leak).
This can be changed by the command line argument -undodepth. By
specifying -undodepth 0, there is no undo available.