mirror of https://github.com/Textualize/rich.git
fix issue splitting segments
This commit is contained in:
parent
d14b304aa4
commit
aa0929298b
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [13.0.1] - 2022-01-06
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue with Segment.split_cells for mixed single and double cell widths
|
||||
|
||||
## [13.0.0] - 2022-12-30
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -119,7 +119,7 @@ class Segment(NamedTuple):
|
|||
|
||||
cell_size = get_character_cell_size
|
||||
|
||||
pos = int((cut / cell_length) * len(text))
|
||||
pos = int((cut / cell_length) * (len(text) - 1))
|
||||
|
||||
before = text[:pos]
|
||||
cell_pos = cell_len(before)
|
||||
|
|
|
@ -273,6 +273,11 @@ def test_divide_edge_2():
|
|||
("💩X💩Y💩Z💩A💩", 4, (Segment("💩X "), Segment(" Y💩Z💩A💩"))),
|
||||
("XYZABC", 4, (Segment("XYZA"), Segment("BC"))),
|
||||
("XYZABC", 5, (Segment("XYZAB"), Segment("C"))),
|
||||
(
|
||||
"a1あ11bcdaef",
|
||||
9,
|
||||
(Segment("a1あ11b"), Segment("cdaef")),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_split_cells_emoji(text, split, result):
|
||||
|
|
Loading…
Reference in New Issue