Remove escape codes from output to stop garbling the interface.
This commit is contained in:
parent
9dddc8ce8c
commit
99fa974b56
4 changed files with 15 additions and 9 deletions
|
|
@ -1,3 +1,3 @@
|
||||||
Cover Page
|
Cover Page
|
||||||
|
|
||||||
|
#
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[31m===[0mSORRY![31m===[0m
|
#[31m===#[0mSORRY!#[31m===#[0m
|
||||||
Two terms in a row across lines (missing semicolon or comma?)
|
Two terms in a row across lines (missing semicolon or comma?)
|
||||||
at /tmp/vigil/golden-files/./input/perl6.p6:30
|
at /tmp/vigil/golden-files/./input/perl6.p6:30
|
||||||
------> [32msay 'Hello from Perl 6!'[33m⏏[31m<EOL>[0m
|
------> #[32msay 'Hello from Perl 6!'#[33m⏏#[31m<EOL>#[0m
|
||||||
expecting any of:
|
expecting any of:
|
||||||
infix
|
infix
|
||||||
infix stopper
|
infix stopper
|
||||||
|
|
@ -12,5 +12,5 @@ at /tmp/vigil/golden-files/./input/perl6.p6:30
|
||||||
Other potential difficulties:
|
Other potential difficulties:
|
||||||
Useless declaration of a has-scoped method in mainline (did you mean 'my regex http-verb'?)
|
Useless declaration of a has-scoped method in mainline (did you mean 'my regex http-verb'?)
|
||||||
at /tmp/vigil/golden-files/./input/perl6.p6:11
|
at /tmp/vigil/golden-files/./input/perl6.p6:11
|
||||||
------> [32mregex [33m⏏[31mhttp-verb {[0m
|
------> #[32mregex #[33m⏏#[31mhttp-verb {#[0m
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[31m===[0mSORRY![31m===[0m
|
#[31m===#[0mSORRY!#[31m===#[0m
|
||||||
Two terms in a row across lines (missing semicolon or comma?)
|
Two terms in a row across lines (missing semicolon or comma?)
|
||||||
at /tmp/vigil/golden-files/./input/perl6.pl:30
|
at /tmp/vigil/golden-files/./input/perl6.pl:30
|
||||||
------> [32msay 'Hello from Perl 6!'[33m⏏[31m<EOL>[0m
|
------> #[32msay 'Hello from Perl 6!'#[33m⏏#[31m<EOL>#[0m
|
||||||
expecting any of:
|
expecting any of:
|
||||||
infix
|
infix
|
||||||
infix stopper
|
infix stopper
|
||||||
|
|
@ -12,5 +12,5 @@ at /tmp/vigil/golden-files/./input/perl6.pl:30
|
||||||
Other potential difficulties:
|
Other potential difficulties:
|
||||||
Useless declaration of a has-scoped method in mainline (did you mean 'my regex http-verb'?)
|
Useless declaration of a has-scoped method in mainline (did you mean 'my regex http-verb'?)
|
||||||
at /tmp/vigil/golden-files/./input/perl6.pl:11
|
at /tmp/vigil/golden-files/./input/perl6.pl:11
|
||||||
------> [32mregex [33m⏏[31mhttp-verb {[0m
|
------> #[32mregex #[33m⏏#[31mhttp-verb {#[0m
|
||||||
|
|
||||||
10
tools.py
10
tools.py
|
|
@ -18,6 +18,7 @@ import os.path
|
||||||
import pickle
|
import pickle
|
||||||
import pwd
|
import pwd
|
||||||
import stat
|
import stat
|
||||||
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
|
@ -84,9 +85,14 @@ _LS_COLOR_CODES = get_ls_color_codes()
|
||||||
TIMEOUT = 60
|
TIMEOUT = 60
|
||||||
|
|
||||||
|
|
||||||
|
def _printable(text):
|
||||||
|
return "".join(char if ord(char) > 31 or char in ["\n", "\t"] else "#"
|
||||||
|
for char in text)
|
||||||
|
|
||||||
|
|
||||||
def _fix_input(input_):
|
def _fix_input(input_):
|
||||||
input_str = input_.decode("utf-8") if isinstance(input_, bytes) else input_
|
input_str = input_.decode("utf-8") if isinstance(input_, bytes) else input_
|
||||||
return input_str.expandtabs(tabsize=4)
|
return _printable(input_str).expandtabs(tabsize=4)
|
||||||
|
|
||||||
|
|
||||||
def _do_command(command, timeout=None, **kwargs):
|
def _do_command(command, timeout=None, **kwargs):
|
||||||
|
|
@ -248,7 +254,7 @@ def contents(path):
|
||||||
root, ext = splitext(path)
|
root, ext = splitext(path)
|
||||||
if ext == "":
|
if ext == "":
|
||||||
with open(path) as file_:
|
with open(path) as file_:
|
||||||
return Status.normal, fill3.Text(file_.read())
|
return Status.normal, fill3.Text(_fix_input(file_.read()))
|
||||||
else:
|
else:
|
||||||
return pygments_(path)
|
return pygments_(path)
|
||||||
contents.dependencies = {"python3-pygments"}
|
contents.dependencies = {"python3-pygments"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue