tools: Fix screen corruption from TextWidgets containing line breaks.
This commit is contained in:
parent
9b47e07cf6
commit
b41c86afac
19 changed files with 28 additions and 41 deletions
|
|
@ -1 +1 @@
|
|||
hello
|
||||
hello
|
||||
|
|
@ -1 +1 @@
|
|||
input/hi.py:4: error: Missing parentheses in call to 'print'. Did you mean print("hi")?
|
||||
input/hi.py:4: error: Missing parentheses in call to 'print'. Did you mean print("hi")?
|
||||
|
|
@ -1 +1 @@
|
|||
00000000 D _LIB_VERSION
|
||||
00000000 D _LIB_VERSION
|
||||
|
|
@ -1 +1 @@
|
|||
nm: ./input/libpcprofile.so: no symbols
|
||||
nm: ./input/libpcprofile.so: no symbols
|
||||
|
|
@ -1 +1 @@
|
|||
./input/perl.pl syntax OK
|
||||
./input/perl.pl syntax OK
|
||||
|
|
@ -1 +1 @@
|
|||
No documentation found for "./input/perl.pl".
|
||||
No documentation found for "./input/perl.pl".
|
||||
|
|
@ -1 +1 @@
|
|||
No syntax errors detected in ./input/root.php
|
||||
No syntax errors detected in ./input/root.php
|
||||
|
|
@ -1 +1 @@
|
|||
No config file found, using default configuration
|
||||
No config file found, using default configuration
|
||||
|
|
@ -1 +1 @@
|
|||
No config file found, using default configuration
|
||||
No config file found, using default configuration
|
||||
|
|
@ -1,2 +1 @@
|
|||
(B[m[38;2;106;184;37m[48;2;32;32;32m[1mdef(B[m[38;2;208;208;208m[48;2;32;32;32m (B[m[38;2;68;127;207m[48;2;32;32;32mhi(B[m[38;2;208;208;208m[48;2;32;32;32m():
|
||||
(B[m
|
||||
(B[m[38;2;106;184;37m[48;2;32;32;32m[1mdef(B[m[38;2;208;208;208m[48;2;32;32;32m (B[m[38;2;68;127;207m[48;2;32;32;32mhi(B[m[38;2;208;208;208m[48;2;32;32;32m():(B[m
|
||||
|
|
@ -1,2 +1 @@
|
|||
(B[m[38;2;106;184;37m[48;2;32;32;32m[1mdef(B[m[38;2;208;208;208m[48;2;32;32;32m (B[m[38;2;68;127;207m[48;2;32;32;32mhi(B[m[38;2;208;208;208m[48;2;32;32;32m():
|
||||
(B[m
|
||||
(B[m[38;2;106;184;37m[48;2;32;32;32m[1mdef(B[m[38;2;208;208;208m[48;2;32;32;32m (B[m[38;2;68;127;207m[48;2;32;32;32mhi(B[m[38;2;208;208;208m[48;2;32;32;32m():(B[m
|
||||
|
|
@ -1 +1 @@
|
|||
3:0: 'hi' 1
|
||||
3:0: 'hi' 1
|
||||
|
|
@ -1 +1 @@
|
|||
("3:0: 'hi'", 1)
|
||||
("3:0: 'hi'", 1)
|
||||
|
|
@ -1 +1 @@
|
|||
-rw-rw-r-- ahamilton/ahamilton 27 2016-02-09 21:50 hi.py
|
||||
-rw-rw-r-- ahamilton/ahamilton 27 2016-02-09 21:50 hi.py
|
||||
|
|
@ -1 +1 @@
|
|||
-rw-rw-r-- ahamilton/ahamilton 27 2016-02-09 21:50 hi.py
|
||||
-rw-rw-r-- ahamilton/ahamilton 27 2016-02-09 21:50 hi.py
|
||||
|
|
@ -1 +1 @@
|
|||
-rw-rw-r-- ahamilton/ahamilton 27 2016-02-09 21:50 hi.py
|
||||
-rw-rw-r-- ahamilton/ahamilton 27 2016-02-09 21:50 hi.py
|
||||
|
|
@ -1,2 +1 @@
|
|||
(B[m[38;2;208;208;208m[48;2;32;32;32m
|
||||
(B[m
|
||||
|
|
@ -341,7 +341,7 @@ class Text:
|
|||
if len(lines) == 0:
|
||||
self.text = []
|
||||
elif len(lines) == 1:
|
||||
self.text = [text]
|
||||
self.text = [lines[0]]
|
||||
else:
|
||||
max_width = max(len(line) for line in lines)
|
||||
height = len(lines)
|
||||
|
|
|
|||
|
|
@ -157,21 +157,6 @@ def _syntax_highlight_using_path(text, path):
|
|||
return _syntax_highlight(text, lexer, style)
|
||||
|
||||
|
||||
def pygments_(path):
|
||||
with open(path) as file_:
|
||||
try:
|
||||
text = file_.read()
|
||||
except UnicodeDecodeError:
|
||||
return Status.not_applicable, fill3.Text("Not unicode")
|
||||
else:
|
||||
try:
|
||||
source_widget = _syntax_highlight_using_path(_fix_input(text),
|
||||
path)
|
||||
except pygments.util.ClassNotFound:
|
||||
return Status.normal, fill3.Text(text)
|
||||
return Status.normal, source_widget
|
||||
|
||||
|
||||
def linguist(path):
|
||||
# Dep: ruby?, ruby-dev, libicu-dev, cmake, "gem install github-linguist"
|
||||
return _run_command(["linguist", path], Status.normal)
|
||||
|
|
@ -252,12 +237,17 @@ def metadata(path):
|
|||
|
||||
@deps(deps={"python3-pygments"}, url="python3-pygments")
|
||||
def contents(path):
|
||||
root, ext = splitext(path)
|
||||
if ext == "":
|
||||
with open(path) as file_:
|
||||
return Status.normal, fill3.Text(_fix_input(file_.read()))
|
||||
else:
|
||||
return pygments_(path)
|
||||
with open(path) as file_:
|
||||
try:
|
||||
text = file_.read()
|
||||
except UnicodeDecodeError:
|
||||
return Status.not_applicable, fill3.Text("Not unicode")
|
||||
text = _fix_input(text)
|
||||
try:
|
||||
text_widget = _syntax_highlight_using_path(text, path)
|
||||
except pygments.util.ClassNotFound:
|
||||
text_widget = fill3.Text(text)
|
||||
return Status.normal, text_widget
|
||||
|
||||
|
||||
def _is_python_syntax_correct(path, python_version):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue