Skip to content

Commit

Permalink
assert cut
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Oct 22, 2024
1 parent 68e1b63 commit db2e3e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rich/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,14 @@ def split_cells(self, cut: int) -> Tuple["Segment", "Segment"]:
If the cut point falls in the middle of a 2-cell wide character then it is replaced
by two spaces, to preserve the display width of the parent segment.
Args:
cut (int): Offset within the segment to cut.
Returns:
Tuple[Segment, Segment]: Two segments.
"""
text, style, control = self
assert cut >= 0

if _is_single_cell_widths(text):
# Fast path with all 1 cell characters
Expand Down

0 comments on commit db2e3e8

Please sign in to comment.