diff options
author | Matthew Sotoudeh <matthewsot@outlook.com> | 2020-04-13 08:40:01 -0700 |
---|---|---|
committer | Matthew Sotoudeh <matthewsot@outlook.com> | 2020-04-13 08:40:01 -0700 |
commit | 96e12c8a274ea3e08648116f3fb052e3de005560 (patch) | |
tree | cc419696e4e062fc7173876073598c98cae0aa63 /patches/latexrun-force-colors | |
parent | 229b0f318e0160013c9c5700a22cc13da37fdcd8 (diff) |
Initial code release
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 |