failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich
(not found in data/tasks.jsonl)
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Change SVG export to create a simpler SVG
+- Fix render_lines crash when render height was negative https://github.com/Textualize/rich/pull/2246
## [12.3.0] - 2022-04-26
--- a/rich/console.py
+++ b/rich/console.py
@@ -1327,6 +1327,11 @@ class Console:
_rendered = self.render(renderable, render_options)
if style:
_rendered = Segment.apply_style(_rendered, style)
+
+ render_height = render_options.height
+ if render_height is not None:
+ render_height = max(0, render_height)
+
lines = list(
islice(
Segment.split_and_crop_lines(
@@ -1336,7 +1341,7 @@ class Console:
pad=pad,
),
None,
- render_options.height,
+ render_height,
)
)
if render_options.height is not None:
...................F
=================================== FAILURES ===================================
_______________________________ test_print_json ________________________________
def test_print_json():
console = Console(file=io.StringIO(), color_system="truecolor")
console.print_json('[false, true, null, "foo"]', indent=4)
result = console.file.getvalue()
print(repr(result))
expected = '\x1b[1m[\x1b[0m\n \x1b[3;91mfalse\x1b[0m,\n \x1b[3;92mtrue\x1b[0m,\n \x1b[3;35mnull\x1b[0m,\n \x1b[32m"foo"\x1b[0m\n\x1b[1m]\x1b[0m\n'
> assert result == expected
E AssertionError: assert '\x1b[1m[\x1b...[1m]\x1b[0m\n' == '\x1b[1m[\x1b...[1m]\x1b[0m\n'
E
E [1m[[0m
E - [3;91mfalse[0m,
E ? ---
E + [3mfalse[0m,
E - [3;92mtrue[0m,
E ? ---...
E
E ...Full output truncated (7 lines hidden), use '-vv' to show
tests/test_console.py:205: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[1m[\x1b[0m\n \x1b[3mfalse\x1b[0m,\n \x1b[3mtrue\x1b[0m,\n \x1b[3mnull\x1b[0m,\n "foo"\n\x1b[1m]\x1b[0m\n'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 19 passed in 0.18s