diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d8985ca13..b76b11513 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -91,3 +91,4 @@ The following people have contributed to the development of Rich: - [L. Yeung](https://github.com/lewis-yeung) - [chthollyphile](https://github.com/chthollyphile) - [Jonathan Helmus](https://github.com/jjhelmus) +- [Benjamin Ben Rachmiel](https://github.com/BenRachmiel) diff --git a/rich/containers.py b/rich/containers.py index 901ff8ba6..1e3120f46 100644 --- a/rich/containers.py +++ b/rich/containers.py @@ -76,12 +76,10 @@ def __iter__(self) -> Iterator["Text"]: return iter(self._lines) @overload - def __getitem__(self, index: int) -> "Text": - ... + def __getitem__(self, index: int) -> "Text": ... @overload - def __getitem__(self, index: slice) -> List["Text"]: - ... + def __getitem__(self, index: slice) -> List["Text"]: ... def __getitem__(self, index: Union[slice, int]) -> Union["Text", List["Text"]]: return self._lines[index] @@ -137,7 +135,7 @@ def justify( line.pad_right(width - cell_len(line.plain)) elif justify == "right": for line in self._lines: - line.rstrip() + line[:-1].rstrip() if line[-1] == Text(" ") else line.rstrip() line.truncate(width, overflow=overflow) line.pad_left(width - cell_len(line.plain)) elif justify == "full":