diff --git a/sandbox/auto_test.py b/sandbox/auto_test.py index c592a8155..594985a89 100644 --- a/sandbox/auto_test.py +++ b/sandbox/auto_test.py @@ -4,7 +4,7 @@ from textual.layout import Vertical from rich.text import Text -TEXT = Text.from_markup(" ".join(str(n) * 5 for n in range(10))) +TEXT = Text.from_markup(" ".join(str(n) * 5 for n in range(12))) class AutoApp(App): diff --git a/src/textual/_border.py b/src/textual/_border.py index 56dfa1277..139aca33f 100644 --- a/src/textual/_border.py +++ b/src/textual/_border.py @@ -211,7 +211,6 @@ class Border: render_options = options.update_dimensions(width, new_height) else: render_options = options.update_width(width) - # has_top = has_bottom = False lines = console.render_lines(self.renderable, render_options) diff --git a/src/textual/_layout.py b/src/textual/_layout.py index d8930dbe9..3f629d1e6 100644 --- a/src/textual/_layout.py +++ b/src/textual/_layout.py @@ -48,6 +48,16 @@ class Layout(ABC): """ def get_content_width(self, widget: Widget, container: Size, viewport: Size) -> int: + """Get the width of the content. + + Args: + widget (Widget): The container widget. + container (Size): The container size. + viewport (Size): The viewport size. + + Returns: + int: Width of the content. + """ width: int | None = None for child in widget.displayed_children: assert isinstance(child, Widget) @@ -61,6 +71,17 @@ class Layout(ABC): def get_content_height( self, widget: Widget, container: Size, viewport: Size, width: int ) -> int: + """Get the content height. + + Args: + widget (Widget): The container widget. + container (Size): The container size. + viewport (Size): The viewport. + width (int): The content width. + + Returns: + int: Content height (in lines). + """ if not widget.displayed_children: height = container.height else: diff --git a/src/textual/app.py b/src/textual/app.py index 67b43db0f..e25447365 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -408,8 +408,8 @@ class App(Generic[ReturnType], DOMNode): self.devtools.log( DevtoolsLog(output, caller=_textual_calling_frame) ) - except Exception: - self.console.bell() + except Exception as error: + self.on_exception(error) def action_screenshot(self, path: str | None = None) -> None: """Action to save a screenshot."""