fix(renderer): don't trim final newline (because it can be intentional) - #1798
fix(renderer): don't trim final newline (because it can be intentional)#1798meowgorithm wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1798 +/- ##
==========================================
+ Coverage 57.81% 57.91% +0.09%
==========================================
Files 25 25
Lines 1337 1340 +3
==========================================
+ Hits 773 776 +3
Misses 474 474
Partials 90 90 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
andrinoff
left a comment
There was a problem hiding this comment.
There's also a pre-existing bug that a view without a trailing newline loses its last line on exit. close moves to the last buffer row and erases below it, so the shell prompt overwrites that line. Maybe worth fixing here too
| // than on its last visible line. Frames taller than the screen | ||
| // have their top rows dropped, so their last visible row is the | ||
| // screen's. | ||
| y := frameArea.Dy() - 1 |
There was a problem hiding this comment.
parking at the frame's last row is correct, but for frames taller than the screen this now aligns the frame with the top of the terminal, and the existing per-frame full redraw then floods scrollback in tmux
|
|
||
| // Frames taller than the screen drop their top rows, so the parked cursor | ||
| // must land on the screen's last visible row, not beyond it. | ||
| func TestCursedRenderer_trailingBlankLinesTallFrame(t *testing.T) { |
There was a problem hiding this comment.
this checks the parked position but not that a second unchanged flush is a no-op. that's why the regression above was missed
This revision maintains trailing newlines, because trailing blank lines can be a design choice. Prior to this change it was nearly impossible to keep them.
Worth testing this one thoroughly, per the removed comment in the code.