Skip to content

fix(cli): only pad short responses to avoid pushing content off-screen - #4436

Closed
gnanam1990 wants to merge 1 commit into
NousResearch:mainfrom
gnanam1990:fix/cli-padding-issue-4421
Closed

fix(cli): only pad short responses to avoid pushing content off-screen#4436
gnanam1990 wants to merge 1 commit into
NousResearch:mainfrom
gnanam1990:fix/cli-padding-issue-4421

Conversation

@gnanam1990

@gnanam1990 gnanam1990 commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Summary

How it works

_terminal_lines = shutil.get_terminal_size().lines
_pad = _terminal_lines // 2
if _pad > 2:
    _resp_lines = _chat_response.count("\n") + 1 if isinstance(_chat_response, str) else 1
    if _resp_lines < _pad:
        _actual_pad = max(1, _pad - _resp_lines)
        _cprint("\n" * _actual_pad)
  • Short response → prompt is anchored near the bottom ✓
  • Long response → no padding, content stays on screen ✓

Fixes #4421

Test plan

  • Short response (e.g. "What is 2+2?") — blank padding appears after response, prompt sits near bottom
  • Long response (e.g. "Explain TCP/IP in detail") — no padding, response not pushed off-screen
  • python3 -m py_compile cli.py passes with no errors

🤖 Generated with Claude Code

Unconditional half-terminal-height padding after every response (added
in NousResearch#4359, removed in NousResearch#4412) caused long responses to be scrolled out of
view. Re-introduce the padding but gate it on response length: padding
is only applied when the response is shorter than half the terminal
height, and only enough lines are added to fill the remaining gap.

Fixes: NousResearch#4421

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@teknium1

teknium1 commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution @gnanam1990! This is a thoughtful approach to gating the padding on response length.

However, the underlying issue (#4421) was already resolved by PR #4412 (merged ~20 minutes before the issue was filed). That PR removed the per-response padding entirely and replaced it with a one-time startup scroll that pins the TUI to the bottom of the terminal. The padding code from #4359 that #4421 describes no longer exists on current main.

Closing as the root cause is already addressed. Appreciate you taking the time!

@teknium1 teknium1 closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): post-response padding newlines push content off-screen

2 participants