Fix formatting

This commit is contained in:
Darren Burns
2022-01-18 12:59:59 +00:00
parent 466274cd4e
commit fae1663365
2 changed files with 13 additions and 4 deletions

View File

@@ -6,14 +6,18 @@ from rich.style import StyleType
class Blank:
def __init__(self, style: StyleType, width: int | None = None, height: int | None = None):
def __init__(
self, style: StyleType, width: int | None = None, height: int | None = None
):
self.style = style
self.width = width
self.height = height
def __rich_console__(self, console: Console, console_options: ConsoleOptions):
render_width = self.width or console_options.max_width
render_height = self.height or console_options.height or console_options.max_height
render_height = (
self.height or console_options.height or console_options.max_height
)
style = console.get_style(self.style)
for _ in range(render_height):
yield Segment(" " * render_width + "\n", style)

View File

@@ -177,14 +177,19 @@ class Widget(DOMNode):
)
if styles.has_border:
renderable = Border(renderable, styles.border, style=renderable_text_style)
renderable = Border(
renderable, styles.border, style=renderable_text_style
)
if styles.has_margin:
renderable = Padding(renderable, styles.margin, style=parent_text_style)
if styles.has_outline:
renderable = Border(
renderable, styles.outline, outline=True, style=renderable_text_style
renderable,
styles.outline,
outline=True,
style=renderable_text_style,
)
return renderable