mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Removed kwarg, now have align check for whether there's only a single whitespace.
This commit is contained in:
parent
5f5ffe4324
commit
242fb0e747
1 changed files with 5 additions and 4 deletions
|
|
@ -427,7 +427,6 @@ class EvCell(object):
|
|||
# alignments
|
||||
self.align = kwargs.get("align", "l")
|
||||
self.valign = kwargs.get("valign", "c")
|
||||
self.justify = kwargs.get("justify", False)
|
||||
|
||||
#self.data = self._split_lines(unicode(data))
|
||||
self.data = self._split_lines(_to_ansi(data))
|
||||
|
|
@ -561,7 +560,9 @@ class EvCell(object):
|
|||
|
||||
def _align(self, data):
|
||||
"""
|
||||
Align list of rows of cell.
|
||||
Align list of rows of cell. Whitespace characters will be stripped
|
||||
if there is only one whitespace character - otherwise, it's assumed
|
||||
the caller may be trying some manual formatting in the text.
|
||||
|
||||
Args:
|
||||
data (str): Text to align.
|
||||
|
|
@ -574,9 +575,9 @@ class EvCell(object):
|
|||
hfill_char = self.hfill_char
|
||||
width = self.width
|
||||
if align == "l":
|
||||
return [(line.lstrip() if self.justify else line) + hfill_char * (width - m_len(line)) for line in data]
|
||||
return [(line.lstrip() if line.startswith(" ") and not line.startswith(" ") else line) + hfill_char * (width - m_len(line)) for line in data]
|
||||
elif align == "r":
|
||||
return [hfill_char * (width - m_len(line)) + (line.rstrip() if self.justify else line) for line in data]
|
||||
return [hfill_char * (width - m_len(line)) + (line.rstrip() if line.endswith(" ") and not line.endswith(" ") else line) for line in data]
|
||||
else: # center, 'c'
|
||||
return [self._center(line, self.width, self.hfill_char) for line in data]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue