Path 1: 23 calls (0.66)

4 (5) 2 (4) 3 (4) 1 (3) 6 (2) 5 (1) 7 (1) 8 (1) 9 (1) 10 (1)

tuple (23)

1def split_cells(self, cut: int) -> Tuple["Segment", "Segment"]:
2        """Split segment in to two segments at the specified column.
3
4        If the cut point falls in the middle of a 2-cell wide character then it is replaced
5        by two spaces, to preserve the display width of the parent segment.
6
7        Returns:
8            Tuple[Segment, Segment]: Two segments.
9        """
10        text, style, control = self
11
12        if _is_single_cell_widths(text):
13            # Fast path with all 1 cell characters
14            if cut >= len(text):
15                return self, Segment("", style, control)
16            return (
17                Segment(text[:cut], style, control),
18                Segment(text[cut:], style, control),
19            )
20
21        return self._split_cells(self, cut)
            

Path 2: 10 calls (0.29)

1 (7) 4 (2) 5 (1)

tuple (10)

1def split_cells(self, cut: int) -> Tuple["Segment", "Segment"]:
2        """Split segment in to two segments at the specified column.
3
4        If the cut point falls in the middle of a 2-cell wide character then it is replaced
5        by two spaces, to preserve the display width of the parent segment.
6
7        Returns:
8            Tuple[Segment, Segment]: Two segments.
9        """
10        text, style, control = self
11
12        if _is_single_cell_widths(text):
13            # Fast path with all 1 cell characters
14            if cut >= len(text):
15                return self, Segment("", style, control)
16            return (
17                Segment(text[:cut], style, control),
18                Segment(text[cut:], style, control),
19            )
20
21        return self._split_cells(self, cut)
            

Path 3: 2 calls (0.06)

4 (1) 1 (1)

tuple (2)

1def split_cells(self, cut: int) -> Tuple["Segment", "Segment"]:
2        """Split segment in to two segments at the specified column.
3
4        If the cut point falls in the middle of a 2-cell wide character then it is replaced
5        by two spaces, to preserve the display width of the parent segment.
6
7        Returns:
8            Tuple[Segment, Segment]: Two segments.
9        """
10        text, style, control = self
11
12        if _is_single_cell_widths(text):
13            # Fast path with all 1 cell characters
14            if cut >= len(text):
15                return self, Segment("", style, control)
16            return (
17                Segment(text[:cut], style, control),
18                Segment(text[cut:], style, control),
19            )
20
21        return self._split_cells(self, cut)