Skip to content

Commit 6e36e9e

Browse files
committed
fix(text area): fix initial flicker in rendering
Fix initial flicker in the `TextArea`, where for a brief moment each character is rendered on a new line before the size is settled. The width for the `WrappedDocument` is _slightly_ confusing where zero means no wrapping, but the current negative wrap width looks like the bug. Fixes #5841
1 parent a3f7b98 commit 6e36e9e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/textual/widgets/_text_area.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ def wrap_width(self) -> int:
10211021
width, _ = self.scrollable_content_region.size
10221022
cursor_width = 1
10231023
if self.soft_wrap:
1024-
return width - self.gutter_width - cursor_width
1024+
return max(0, width - self.gutter_width - cursor_width)
10251025
return 0
10261026

10271027
def _rewrap_and_refresh_virtual_size(self) -> None:

0 commit comments

Comments
 (0)