Merge branch 'main' into content-text

This commit is contained in:
Will McGugan
2025-03-25 17:55:38 +00:00
committed by GitHub
3 changed files with 9 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed click selection not being disabled when allow_select was set to false https://github.com/Textualize/textual/issues/5627
- Fixed crash on clicking line API border https://github.com/Textualize/textual/pull/5641
- Fixed additional spaces after text-wrapping https://github.com/Textualize/textual/pull/5657
- Added missing `scroll_end` parameter to the `Log.write_line` method https://github.com/Textualize/textual/pull/5672
### Added

View File

@@ -51,7 +51,7 @@ This widget has no component classes.
## Additional Notes
- The spacing between the text and the edges of a button are _not_ due to padding. The default styling for a `Button` has the `height` set to 3 lines and a `min-width` of 16 columns. To create a button with zero visible padding, you will need to change these values and also remove the border with `border: none;`.
- The spacing between the text and the edges of a button are _not_ due to padding. The default styling for a `Button` includes borders and a `min-width` of 16 columns. To remove the spacing, set `border: none;` in your CSS and adjust the minimum width as needed.
---

View File

@@ -195,16 +195,21 @@ class Log(ScrollView, can_focus=True):
self.scroll_end(animate=False, immediate=True, x_axis=False)
return self
def write_line(self, line: str) -> Self:
def write_line(
self,
line: str,
scroll_end: bool | None = None,
) -> Self:
"""Write content on a new line.
Args:
line: String to write to the log.
scroll_end: Scroll to the end after writing, or `None` to use `self.auto_scroll`.
Returns:
The `Log` instance.
"""
self.write_lines([line])
self.write_lines([line], scroll_end)
return self
def write_lines(