Skip to content

Commit d15d807

Browse files
committed
fix(tui): refresh shell-mode footer budget and strengthen resize assertion
Shell-mode rendering never set _prompt_footer_row_budget, so _fit_toolbar_to_terminal clipped the bottom toolbar against a stale agent-mode value (or the initial 0, hiding the footer entirely in a pure shell session). Refresh it every shell render. Replace a trivially-true pyte row-count assertion in the resize e2e with a width-overflow check.
1 parent 9637154 commit d15d807

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/pythinker_code/ui/shell/prompt.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,6 +3127,11 @@ def _render_message(self) -> FormattedText:
31273127
def _render_shell_prompt_message(self) -> FormattedText:
31283128
frame = self._prompt_frame_for_render()
31293129
columns = frame.columns
3130+
# Shell mode has no running-prompt scene allocator, so the footer keeps
3131+
# its natural height within the terminal. Refresh the budget every render
3132+
# (not just on the agent path) so a mode switch or resize cannot leave
3133+
# _fit_toolbar_to_terminal clipping against a stale agent-mode value.
3134+
self._prompt_footer_row_budget = frame.terminal_rows
31303135
fragments: FormattedText = FormattedText()
31313136

31323137
if getattr(self, "_shortcut_help_open", False):

tests/e2e/test_shell_pty_prompt_layout_e2e.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,11 @@ def test_prompt_scene_survives_shrinking_terminal_heights(tmp_path: Path) -> Non
269269
assert shell.process.poll() is None, f"shell died after resize to {height} rows"
270270
post_resize = shell._raw_chunks[resize_chunk_start:]
271271
if post_resize:
272+
# pyte always yields exactly `height` lines, so assert observable
273+
# behavior instead: the redraw never wraps a row past the terminal
274+
# width and never fossilizes an input-card border above content.
272275
rows = _render_sized(post_resize, _COLS, height)
273-
assert len(rows) == height
276+
assert all(len(row) <= _COLS for row in rows)
274277
assert not _has_fossil_border_above_content(rows)
275278

276279
_set_window_size(shell.master_fd, columns=_COLS, lines=_ROWS)

0 commit comments

Comments
 (0)