Add automatic escaping of color codes in the EvEditor
This commit is contained in:
parent
7010f998f1
commit
7ddcae9d32
1 changed files with 5 additions and 4 deletions
|
|
@ -49,6 +49,7 @@ import re
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia import Command, CmdSet
|
from evennia import Command, CmdSet
|
||||||
from evennia.utils import is_iter, fill, dedent, logger, justify, to_str
|
from evennia.utils import is_iter, fill, dedent, logger, justify, to_str
|
||||||
|
from evennia.utils.ansi import raw
|
||||||
from evennia.commands import cmdhandler
|
from evennia.commands import cmdhandler
|
||||||
|
|
||||||
# we use cmdhandler instead of evennia.syscmdkeys to
|
# we use cmdhandler instead of evennia.syscmdkeys to
|
||||||
|
|
@ -377,9 +378,9 @@ class CmdLineInput(CmdEditorBase):
|
||||||
indent = "off"
|
indent = "off"
|
||||||
|
|
||||||
self.caller.msg("|b%02i|||n (|g%s|n) %s" % (
|
self.caller.msg("|b%02i|||n (|g%s|n) %s" % (
|
||||||
cline, indent, line))
|
cline, indent, raw(line)))
|
||||||
else:
|
else:
|
||||||
self.caller.msg("|b%02i|||n %s" % (cline, self.args))
|
self.caller.msg("|b%02i|||n %s" % (cline, raw(self.args)))
|
||||||
|
|
||||||
|
|
||||||
class CmdEditorGroup(CmdEditorBase):
|
class CmdEditorGroup(CmdEditorBase):
|
||||||
|
|
@ -932,9 +933,9 @@ class EvEditor(object):
|
||||||
footer = "|n" + sep * 10 +\
|
footer = "|n" + sep * 10 +\
|
||||||
"[l:%02i w:%03i c:%04i]" % (nlines, nwords, nchars) + sep * 12 + "(:h for help)" + sep * 28
|
"[l:%02i w:%03i c:%04i]" % (nlines, nwords, nchars) + sep * 12 + "(:h for help)" + sep * 28
|
||||||
if linenums:
|
if linenums:
|
||||||
main = "\n".join("|b%02i|||n %s" % (iline + 1 + offset, line) for iline, line in enumerate(lines))
|
main = "\n".join("|b%02i|||n %s" % (iline + 1 + offset, raw(line)) for iline, line in enumerate(lines))
|
||||||
else:
|
else:
|
||||||
main = "\n".join(lines)
|
main = "\n".join([raw(line) for line in lines])
|
||||||
string = "%s\n%s\n%s" % (header, main, footer)
|
string = "%s\n%s\n%s" % (header, main, footer)
|
||||||
self._caller.msg(string, options=options)
|
self._caller.msg(string, options=options)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue