Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Fixed issue where Segments with a style of `None` aren't rendered https://github.com/Textualize/textual/pull/6109
- Fixed visual glitches and crash when changing `DataTable.header_height` https://github.com/Textualize/textual/pull/6128
- Fixed `TextArea` rendering with a multi-line `placeholder` https://github.com/Textualize/textual/issues/6122

## [6.1.0] - 2025-08-01

Expand Down
19 changes: 12 additions & 7 deletions src/textual/widgets/_text_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,15 @@ def _has_cursor(self) -> bool:
"""Is there a usable cursor?"""
return not (self.read_only and not self.show_cursor)

@property
def _placeholder_lines(self) -> list[Content]:
content = (
Content(self.placeholder)
if isinstance(self.placeholder, str)
else self.placeholder
)
return content.split()

def get_line(self, line_index: int) -> Text:
"""Retrieve the line at the given line index.

Expand Down Expand Up @@ -1206,15 +1215,11 @@ def render_line(self, y: int) -> Strip:
Returns:
A rendered line.
"""
if y == 0 and not self.text and self.placeholder:
if not self.text and self.placeholder and y < len(self._placeholder_lines):
style = self.get_visual_style("text-area--placeholder")
content = (
Content(self.placeholder)
if isinstance(self.placeholder, str)
else self.placeholder
)
content = self._placeholder_lines[y]
content = content.stylize(style)
if self._draw_cursor:
if y == 0 and self._draw_cursor:
theme = self._theme
cursor_style = theme.cursor_style if theme else None
if cursor_style:
Expand Down
Loading
Loading