@@ -1784,7 +1784,7 @@ def _write_to_screen_at_index(
1784
1784
ui_content , write_position .width - total_margin_width , write_position .height
1785
1785
)
1786
1786
wrap_finder = self .wrap_finder or (
1787
- self ._whitespace_wrap_finder (ui_content ) if self .word_wrap () else None
1787
+ self ._whitespace_wrap_finder (ui_content . get_line ) if self .word_wrap () else None
1788
1788
)
1789
1789
1790
1790
# Erase background and fill with `char`.
@@ -1941,10 +1941,11 @@ def render_margin(m: Margin, width: int) -> UIContent:
1941
1941
# position.
1942
1942
screen .visible_windows_to_write_positions [self ] = write_position
1943
1943
1944
+ @classmethod
1944
1945
def _whitespace_wrap_finder (
1945
- self ,
1946
- ui_content : UIContent ,
1947
- sep : str | re .Pattern [str ] = r"\s" ,
1946
+ cls ,
1947
+ get_line : Callable [[ int ], StyleAndTextTuples ] ,
1948
+ sep : str | re .Pattern [str ] = r"[ \t]" , # Don’t include \xA0 by default (in \s)
1948
1949
split : str = "remove" ,
1949
1950
continuation : StyleAndTextTuples = [],
1950
1951
) -> WrapFinderCallable :
@@ -1968,7 +1969,7 @@ def _whitespace_wrap_finder(
1968
1969
def wrap_finder (
1969
1970
lineno : int , start : int , end : int
1970
1971
) -> tuple [int , int , AnyFormattedText ]:
1971
- line = explode_text_fragments (ui_content . get_line (lineno ))
1972
+ line = explode_text_fragments (get_line (lineno ))
1972
1973
cont_reserved = 0
1973
1974
while cont_reserved < cont_width :
1974
1975
style , char , * _ = line [end - 1 ]
0 commit comments