Core Help Root: Subsystems: Editor: Programming


Glosary

Server-side edit
The editor mode in which @edit command throws the user into the line editor built into the server.
Local edit
Editor mode in which @edit downloads the text to the user, returns the user to normal work, and processes the text upload as it arrives.
Callback
save command in the server edit, or upload in the local edit, will call a function that knows how to deal with the text. The function (and its extra arguments) are passed to the editor when it's started. Callback function expects two arguments, text and client_data, the first is the text upload, and the other is a list passed to the editor when it was run.

Editor objects

$editor_reference
A parent to $user, containing the invocation commands, a list of background editors and the foreground editor.
$editor_parser
Editor command parser. Added to the list of $user's parsers to switch the command context for server editting.
$editor_session
This object is spawned for each individual session. It contains all the data for the session: callback method and arguments, modification flag, cursor position and (for server edit) the text itself. It also runs the editor commands (for server edit). For the local edit, it main purpose is keeping track of the callbacks.
$editable
This is a generic parent that keeps track of the datatype that an object may hold (with @edit object +type=<something> command)

Calling the editor

The editor is called by running user.invoke_editor(callback_object, callback_method, initial_text, client_data), where callback_object and callback_method specify the callback, initial_text is the text to be edited, and client_data will be passed to the callback as additional arguments.

Extending @edit types

To add a new editable type to an object, first make sure that the object has $editable among its ancestors. Then do object.set_edit_type([ list of types ]). For each type, define object.edit_<type> method, and the callback for the method. You're done!


Invoking | Commands | Programming


the Cold Dark