mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 23:17:17 +02:00
Cropped @batchcommand output better. Resolves issue 217.
This commit is contained in:
parent
5beee55149
commit
f46a9a1280
1 changed files with 3 additions and 4 deletions
|
|
@ -26,6 +26,7 @@ from django.conf import settings
|
|||
from src.utils.batchprocessors import BATCHCMD, BATCHCODE
|
||||
from src.commands.cmdset import CmdSet
|
||||
from src.commands.default.muxcommand import MuxCommand
|
||||
from src.utils import utils
|
||||
|
||||
HEADER_WIDTH = 70
|
||||
UTF8_ERROR = \
|
||||
|
|
@ -57,14 +58,12 @@ def format_header(caller, entry):
|
|||
"""
|
||||
width = HEADER_WIDTH - 10
|
||||
entry = entry.strip()
|
||||
header = entry[:min(width, min(len(entry), entry.find('\n')))]
|
||||
if len(entry) > width:
|
||||
header = "%s[...]" % header
|
||||
header = utils.crop(entry, width=width)
|
||||
ptr = caller.ndb.batch_stackptr + 1
|
||||
stacklen = len(caller.ndb.batch_stack)
|
||||
header = "{w%02i/%02i{G: %s{n" % (ptr, stacklen, header)
|
||||
# add extra space to the side for padding.
|
||||
header = "%s%s" % (header, " "*(width-len(header)))
|
||||
header = "%s%s" % (header, " "*(width - len(header)))
|
||||
header = header.replace('\n', '\\n')
|
||||
|
||||
return header
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue