@@ -500,6 +500,11 @@ def __init__(
500500 self ._cursor_offset = (0 , 0 )
501501 """The virtual offset of the cursor (not screen-space offset)."""
502502
503+ self .set_reactive (TextArea .soft_wrap , soft_wrap )
504+ self .set_reactive (TextArea .read_only , read_only )
505+ self .set_reactive (TextArea .show_line_numbers , show_line_numbers )
506+ self .set_reactive (TextArea .line_number_start , line_number_start )
507+
503508 self ._set_document (text , language )
504509
505510 self .language = language
@@ -510,11 +515,6 @@ def __init__(
510515 reactive is set as a string, the watcher will update this attribute to the
511516 corresponding `TextAreaTheme` object."""
512517
513- self .set_reactive (TextArea .soft_wrap , soft_wrap )
514- self .set_reactive (TextArea .read_only , read_only )
515- self .set_reactive (TextArea .show_line_numbers , show_line_numbers )
516- self .set_reactive (TextArea .line_number_start , line_number_start )
517-
518518 self .tab_behavior = tab_behavior
519519
520520 if tooltip is not None :
@@ -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