This commit is contained in:
Will McGugan 2021-01-23 14:47:35 +00:00
parent 5fa1bc4def
commit c1055cecda
2 changed files with 3 additions and 3 deletions

View File

@ -949,7 +949,7 @@ class Text(JupyterMixin):
append_span(line_span)
position -= 1
if position < 0 or not span_stack:
break
break # pragma: no cover
line._spans.sort(key=get_order)
return new_lines

View File

@ -307,12 +307,12 @@ def test_split():
def test_split_spans():
test = Text.from_markup("[red]Hello\nWorld")
test = Text.from_markup("[red]Hello\n[b]World")
lines = test.split("\n")
assert lines[0].plain == "Hello"
assert lines[1].plain == "World"
assert lines[0].spans == [Span(0, 5, "red")]
assert lines[1].spans == [Span(0, 5, "red")]
assert lines[1].spans == [Span(0, 5, "red"), Span(0, 5, "bold")]
def test_divide():