summaryrefslogtreecommitdiff
path: root/patches/latexrun-force-colors
diff options
context:
space:
mode:
Diffstat (limited to 'patches/latexrun-force-colors')
-rw-r--r--patches/latexrun-force-colors28
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
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback