From bc114af11382b74f9c38bcc06febebc03d3d6110 Mon Sep 17 00:00:00 2001 From: Gordon Shumway <39967334+oddluck@users.noreply.github.com> Date: Thu, 25 Apr 2019 19:31:36 -0400 Subject: [PATCH] de-dupe color controls in wttr --- ASCII/plugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ASCII/plugin.py b/ASCII/plugin.py index 76420cd..d49d500 100644 --- a/ASCII/plugin.py +++ b/ASCII/plugin.py @@ -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')