diff --git a/weasyprint/tests/test_layout.py b/weasyprint/tests/test_layout.py index fe315592..5cbc3f59 100644 --- a/weasyprint/tests/test_layout.py +++ b/weasyprint/tests/test_layout.py @@ -738,7 +738,7 @@ def test_breaking_linebox(): assert line3.children[0].children[0].text == 'c' assert line3.children[1].text == 'd' - # Regression test #1 for https://github.com/Kozea/WeasyPrint/issues/580 + # Regression test for https://github.com/Kozea/WeasyPrint/issues/580 page, = parse( '
' 'aaaa aaaa a a abc') @@ -752,6 +752,17 @@ def test_breaking_linebox(): assert line4.children[0].children[0].text == 'a' assert line4.children[1].children[0].text == 'bc' + # Regression test for https://github.com/Kozea/WeasyPrint/issues/586 + page, = parse( + '
' + 'a a /ccc') + html, = page.children + body, = html.children + div, = body.children + line1, line2 = div.children + assert line1.children[0].text == 'a a' + assert line2.children[0].children[0].text == '/ccc' + @assert_no_logs def test_linebox_text(): diff --git a/weasyprint/text.py b/weasyprint/text.py index 6e8a7c97..6a65743b 100644 --- a/weasyprint/text.py +++ b/weasyprint/text.py @@ -1001,8 +1001,6 @@ def split_first_line(text, style, context, max_width, justification_spacing, if second_line is None and first_line_text: # The next word fits in the first line, keep the layout resume_at = len(new_first_line_text.encode('utf-8')) + 1 - if resume_at == len(text.encode('utf-8')): - resume_at = None return first_line_metrics( first_line, text, layout, resume_at, space_collapse, style) elif second_line: