Use render instead of render_lines in Opacity, add tests

This commit is contained in:
Darren Burns
2022-02-09 11:33:01 +00:00
parent 3b0cab6f79
commit 7109ec0796
3 changed files with 62 additions and 42 deletions

View File

@@ -19,6 +19,7 @@ def render(renderable: RenderableType, no_wrap: bool = False) -> str:
console = Console(
width=100, file=io.StringIO(), color_system="truecolor", legacy_windows=False
)
console.print(renderable, no_wrap=no_wrap)
output = replace_link_ids(console.file.getvalue())
with console.capture() as capture:
console.print(renderable, no_wrap=no_wrap, end="")
output = replace_link_ids(capture.get())
return output