de-dupe color controls in wttr

This commit is contained in:
Gordon Shumway 2019-04-25 19:31:36 -04:00 committed by GitHub
parent c4cd777b5e
commit bc114af113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -794,6 +794,10 @@ class ASCII(callbacks.Plugin):
output = output.replace('\x1b[0m', '\x0F')
output = re.sub('\x1b|\x9b|\[\d+m', '', output)
output = output.replace('\x0F\x03', '\x03')
for i in range(0, 99):
if i < 17:
i = '%02d' % i
output = re.sub('(?<=\x03{0}.)\x03{0}'.format(i), '', output)
paste = ""
for line in output.splitlines():
line = line.strip('\x0F')