Simple line editor.
Allows simple line editing of files. Supports addition of
lines, insertion of lines, deletion of lines, replacement
of lines, viewing of lines and line ranges, saving, and
quitting.
Methods
|
|
__init__ editFile editText processInput prompt setMethodOnExit
|
|
__init__
|
__init__ ( self )
Constructor: performs some initialization |
|
editFile
|
editFile ( self, filename )
Load the given file for editing, or create if none exists.
arguments:
-
filename
- (string) the name of the file to edit.
|
|
editText
|
editText ( self )
Sets up the mudlib.mind.Mind to us the editor's processInput. |
|
processInput
|
processInput ( self, input )
Where most of the editing functionality exists
This method is invoked each time a line is typed by the interactive.
It checks if the line is a special editor command (which always
start with %) and, if so, processes it appropriately. If it's not
an editor command, then the line is appended to the buffer.
arguments:
-
input
- (string) input from the player
|
|
prompt
|
prompt ( self )
Invoked by the player's mind after each input line is processed. |
|
setMethodOnExit
|
setMethodOnExit (
self,
methodToInvokeOnExit,
optionalParam=None,
)
Sets a method to be invoked when this editor exits normally.
The method invoked upon normal exit and will be passed a string
containing the contents of the input buffer and, if provided,
the optional parameter. Note that if the user chooses to abort
(%Q), this method will not be invoked.
arguments:
-
methodToInvokeOnExit
- (function) the function to call when
the editor exits
-
optionalParam=None
- (list of args) the arguments to pass
to the method upon exit
|
|