Воркед
This commit is contained in:
1 parent
ac32c55ab9
commit
ee94d8e529
1138 files changed
+55771
-77901
No files matched your search
@@ -9,6 +9,7 @@ from .text import Text
|
||||
|
||||
re_ansi = re.compile(
|
||||
r"""
|
||||
(?:\x1b[0-?])|
|
||||
(?:\x1b\](.*?)\x1b\\)|
|
||||
(?:\x1b([(@-Z\\-_]|\[[0-?]*[ -/]*[@-~]))
|
||||
""",
|
||||
@@ -43,6 +44,9 @@ def _ansi_tokenize(ansi_text: str) -> Iterable[_AnsiToken]:
|
||||
if start > position:
|
||||
yield _AnsiToken(ansi_text[position:start])
|
||||
if sgr:
|
||||
if sgr == "(":
|
||||
position = end + 1
|
||||
continue
|
||||
if sgr.endswith("m"):
|
||||
yield _AnsiToken("", sgr[1:-1], osc)
|
||||
else:
|
||||
@@ -120,7 +124,7 @@ class AnsiDecoder:
|
||||
self.style = Style.null()
|
||||
|
||||
def decode(self, terminal_text: str) -> Iterable[Text]:
|
||||
"""Decode ANSI codes in an interable of lines.
|
||||
"""Decode ANSI codes in an iterable of lines.
|
||||
|
||||
Args:
|
||||
lines (Iterable[str]): An iterable of lines of terminal output.
|
||||
|
||||
Reference in new issue
Block a user