Skip to content

fix(display): use newline instead of CUD to scroll at terminal bottom#95

Open
liamg wants to merge 1 commit intoreeflective:masterfrom
liamg:fix/refresh-clear-at-bottom
Open

fix(display): use newline instead of CUD to scroll at terminal bottom#95
liamg wants to merge 1 commit intoreeflective:masterfrom
liamg:fix/refresh-clear-at-bottom

Conversation

@liamg
Copy link
Contributor

@liamg liamg commented Feb 22, 2026

MoveCursorDown (CUD / \x1b[1B) is a no-op when the cursor is on the last line of the terminal. This caused ClearScreenBelow to erase the prompt/input line instead of clearing below it, making the prompt invisible whenever the input line was at the bottom of the screen.

Replace MoveCursorDown(1) with NewlineReturn ("\r\n") in Refresh and simplify renderHelpers. Unlike CUD, \r\n scrolls the terminal when at the bottom, ensuring the cursor always advances to a new line before clearing.

I've tested this on a few terminals and it seems to work well.

MoveCursorDown (CUD / \x1b[1B) is a no-op when the cursor is on the
last line of the terminal. This caused ClearScreenBelow to erase the
prompt/input line instead of clearing below it, making the prompt
invisible whenever the input line was at the bottom of the screen.

Replace MoveCursorDown(1) with NewlineReturn ("\r\n") in Refresh and
renderHelpers. Unlike CUD, \r\n scrolls the terminal when at the
bottom, ensuring the cursor always advances to a new line before
clearing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 32.55%. Comparing base (0637db4) to head (d70163f).
⚠️ Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
internal/display/refresh.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #95      +/-   ##
==========================================
- Coverage   33.03%   32.55%   -0.48%     
==========================================
  Files          57       58       +1     
  Lines        9109     9203      +94     
==========================================
- Hits         3009     2996      -13     
- Misses       6062     6169     +107     
  Partials       38       38              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maxlandon
Copy link
Member

Hello !

Thanks for this.
Can you tell me if the behavior in Vim mode + multi-line input lines is still working correctly ?
Thanks a lot

@liamg
Copy link
Contributor Author

liamg commented Feb 23, 2026

@maxlandon Yep, that's the main way I'm using it atm and it seems ok 👍

@maxlandon
Copy link
Member

Okay give me a few days and I will merge it. Very very busy at the moment...

@liamg
Copy link
Contributor Author

liamg commented Feb 25, 2026

No rush at all, thank you!

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.

2 participants