Implement ANSIString.strip() .lstrip() and .rstrip() as tag-aware methods. This handles the last prblem with #1117.

This commit is contained in:
Griatch 2016-11-17 00:21:05 +01:00
parent 596bfff35a
commit f00fbb9d88
3 changed files with 118 additions and 24 deletions

View file

@ -576,7 +576,8 @@ class EvCell(object):
hfill_char = self.hfill_char
width = self.width
if align == "l":
return [(line.lstrip(" ") + " " if line.startswith(" ") and not line.startswith(" ") else line) + hfill_char * (width - m_len(line)) for line in data]
lines= [(line.lstrip(" ") + " " if line.startswith(" ") and not line.startswith(" ") else line) + hfill_char * (width - m_len(line)) for line in data]
return lines
elif align == "r":
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'