Pull line editor out of contrib and into main.
This commit is contained in:
parent
eddb5dadf5
commit
89a39a8481
4 changed files with 20 additions and 10 deletions
|
|
@ -1,9 +1,6 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Evennia Line Editor
|
Evennia Line Editor
|
||||||
|
|
||||||
Contribution - Griatch 2011
|
|
||||||
|
|
||||||
This implements an advanced line editor for editing longer texts
|
This implements an advanced line editor for editing longer texts
|
||||||
in-game. The editor mimics the command mechanisms of the VI editor as
|
in-game. The editor mimics the command mechanisms of the VI editor as
|
||||||
far as possible.
|
far as possible.
|
||||||
|
|
@ -20,7 +17,6 @@ Whereas the editor is intended to be called from other commands that
|
||||||
requires more elaborate text editing of data, there is also a
|
requires more elaborate text editing of data, there is also a
|
||||||
stand-alone editor command for editing Attributes at the end of this
|
stand-alone editor command for editing Attributes at the end of this
|
||||||
module. To use it just import and add it to your default `cmdset`.
|
module. To use it just import and add it to your default `cmdset`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
@ -684,8 +680,10 @@ class CmdEditor(Command):
|
||||||
|
|
||||||
editor_key = "%s/%s" % (self.objname, self.attrname)
|
editor_key = "%s/%s" % (self.objname, self.attrname)
|
||||||
# start editor, it will handle things from here.
|
# start editor, it will handle things from here.
|
||||||
self.editor = LineEditor(self.caller,
|
self.editor = utils.get_line_editor()(
|
||||||
loadfunc=load_attr,
|
self.caller,
|
||||||
savefunc=save_attr,
|
loadfunc=load_attr,
|
||||||
quitfunc=quit_hook,
|
savefunc=save_attr,
|
||||||
key=editor_key)
|
quitfunc=quit_hook,
|
||||||
|
key=editor_key
|
||||||
|
)
|
||||||
|
|
@ -9,5 +9,5 @@ See README.md for more info.
|
||||||
import evennia
|
import evennia
|
||||||
evennia._init()
|
evennia._init()
|
||||||
import barter, dice, extended_room, menu_login, talking_npc
|
import barter, dice, extended_room, menu_login, talking_npc
|
||||||
import chargen, email_login, gendersub, lineeditor, menusystem, slow_exit
|
import chargen, email_login, gendersub, menusystem, slow_exit
|
||||||
import tutorial_world, tutorial_examples
|
import tutorial_world, tutorial_examples
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,11 @@ CMDSET_PLAYER = "commands.default_cmdsets.PlayerCmdSet"
|
||||||
# Location to search for cmdsets if full path not given
|
# Location to search for cmdsets if full path not given
|
||||||
CMDSET_PATHS = ["commands"]
|
CMDSET_PATHS = ["commands"]
|
||||||
|
|
||||||
|
# Line editor path. Points to a line editor class that commands may use to give
|
||||||
|
# users extended editing control. See the default path for a reference implementation
|
||||||
|
# and usage.
|
||||||
|
LINE_EDITOR = 'evennia.commands.default.lineeditor.LineEditor'
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Typeclasses and other paths
|
# Typeclasses and other paths
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
|
||||||
|
|
@ -1257,3 +1257,10 @@ def m_len(target):
|
||||||
if inherits_from(target, basestring):
|
if inherits_from(target, basestring):
|
||||||
return len(ANSI_PARSER.strip_mxp(target))
|
return len(ANSI_PARSER.strip_mxp(target))
|
||||||
return len(target)
|
return len(target)
|
||||||
|
|
||||||
|
|
||||||
|
def get_line_editor():
|
||||||
|
"""
|
||||||
|
Get the line editor for this game.
|
||||||
|
"""
|
||||||
|
return variable_from_module(*settings.LINE_EDITOR.rsplit('.', 1))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue