From db2e3e89307d30e4096686083f03ef5689572bdf Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Tue, 22 Oct 2024 15:43:33 +0100 Subject: [PATCH] assert cut --- rich/segment.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rich/segment.py b/rich/segment.py index 0f0676876..edcb52dd3 100644 --- a/rich/segment.py +++ b/rich/segment.py @@ -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