blob: 829a1fe86252ad79d31f4cef146c6937e2d9b015 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
|