Speedup for m_len to not do the regex when not needed

This commit is contained in:
Simon Vermeersch 2016-12-11 20:29:34 +01:00
parent f2fda4b1bd
commit 336002fc7f

View file

@ -1667,7 +1667,8 @@ def m_len(target):
# Would create circular import if in module root.
from evennia.utils.ansi import ANSI_PARSER
if inherits_from(target, basestring):
return len(ANSI_PARSER.strip_mxp(target))
if "|lt" in target:
return len(ANSI_PARSER.strip_mxp(target))
return len(target)
#------------------------------------------------------------------