From 602f09acfd6bcf3882d3ec1ebcbfe8160b90d6a8 Mon Sep 17 00:00:00 2001 From: Gordon Shumway <39967334+oddluck@users.noreply.github.com> Date: Tue, 21 May 2019 16:10:54 -0400 Subject: [PATCH] img: fix space handling --- ASCII/plugin.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ASCII/plugin.py b/ASCII/plugin.py index a88a70f..ca8e834 100644 --- a/ASCII/plugin.py +++ b/ASCII/plugin.py @@ -597,17 +597,23 @@ class ASCII(callbacks.Plugin): color = self.getAverageC(colormap[j][i].tolist(), speed) old_color = color if 'bg' not in optlist: - if gsval.isdigit(): - color = "{:02d}".format(int(color)) - aimg[j] += "\x03{0}{1}".format(color, gsval) + if gsval != '\xa0': + if gsval.isdigit(): + color = "{:02d}".format(int(color)) + aimg[j] += "\x03{0}{1}".format(color, gsval) + else: + aimg[j] += "\x03{0}{1}".format(int(color), gsval) else: - aimg[j] += "\x03{0}{1}".format(int(color), gsval) + aimg[j] += "\x030,{0} ".format(int(color)) else: - if gsval.isdigit(): - newbg = "{:02d}".format(int(bg)) - aimg[j] += "\x03{0},{1}{2}".format(int(color), newbg, gsval) + if gsval != '\xa0': + if gsval.isdigit(): + newbg = "{:02d}".format(int(bg)) + aimg[j] += "\x03{0},{1}{2}".format(int(color), newbg, gsval) + else: + aimg[j] += "\x03{0},{1}{2}".format(int(color), int(bg), gsval) else: - aimg[j] += "\x03{0},{1}{2}".format(int(color), int(bg), gsval) + aimg[j] += "\x030,{0} ".format(int(color)) elif 'nocolor' not in optlist and gsval != ' ': color = self.getAverageC(colormap[j][i].tolist(), speed) if color != old_color: