diff options
Diffstat (limited to 'patches/latexrun-force-colors')
-rw-r--r-- | patches/latexrun-force-colors | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/patches/latexrun-force-colors b/patches/latexrun-force-colors new file mode 100644 index 0000000..829a1fe --- /dev/null +++ b/patches/latexrun-force-colors @@ -0,0 +1,28 @@ +--- latexrun ++++ latexrun +@@ -416,7 +416,24 @@ class _Terminfo: + else: + s = self.__ensure(cap) + sys.stdout.buffer.write(s) +-terminfo = _Terminfo() ++ ++class _BatchColorTerminfo: ++ def has(self, *caps): ++ for cap in caps: ++ if cap not in ['bold', 'setaf', 'sgr0']: ++ return False ++ return True ++ ++ def send(self, *caps): ++ sys.stdout.flush() ++ for cap in caps: ++ if cap == 'bold': ++ sys.stdout.buffer.write(b'\x1b[1m') ++ elif isinstance(cap, tuple) and cap[0] == 'setaf': ++ sys.stdout.buffer.write(b'\x1b[%dm' % (cap[1] + 30)) ++ elif cap == 'sgr0': ++ sys.stdout.buffer.write(b'\x1b[m') ++terminfo = _BatchColorTerminfo() + + class Progress: + _enabled = None |