mirror of
https://github.com/evennia/evennia.git
synced 2026-04-03 14:37:17 +02:00
Speedup for m_len to not do the regex when not needed
This commit is contained in:
parent
f2fda4b1bd
commit
336002fc7f
1 changed files with 2 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
#------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue