This commit is contained in:
Carson Sievert 2025-06-24 08:56:32 -05:00 committed by GitHub
commit d90efc0e60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -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).
## [UNRELEASED]
### Added
- `Live()`'s `visible_overflow` argument gains a new option of `"crop_above"`
https://github.com/Textualize/rich/pull/3637
## [Unreleased]

View file

@ -8,7 +8,7 @@ from .segment import ControlType, Segment
from .style import StyleType
from .text import Text
VerticalOverflowMethod = Literal["crop", "ellipsis", "visible"]
VerticalOverflowMethod = Literal["crop", "crop_above", "ellipsis", "visible"]
class LiveRender:
@ -86,6 +86,9 @@ class LiveRender:
if self.vertical_overflow == "crop":
lines = lines[: options.size.height]
shape = Segment.get_shape(lines)
elif self.vertical_overflow == "crop_above":
lines = lines[-(options.size.height) :]
shape = Segment.get_shape(lines)
elif self.vertical_overflow == "ellipsis":
lines = lines[: (options.size.height - 1)]
overflow_text = Text(