Skip to content

Commit

Permalink
avoid moving cursor when lines rendered before alt screen is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
semihbkgr committed Nov 16, 2024
1 parent f809887 commit 42ff3f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion standard_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (r *standardRenderer) exitAltScreen() {
// to align with the previous normal screen position and clear any remaining lines.
r.execute(ansi.CursorUp(r.linesRenderedBeforeAltScreen - r.linesRendered))
r.execute(ansi.EraseScreenBelow)
} else if r.linesRendered > r.linesRenderedBeforeAltScreen {
} else if r.linesRendered > r.linesRenderedBeforeAltScreen && r.linesRenderedBeforeAltScreen > 0 {
// If more lines were rendered in the alternate screen, move the cursor down
// to align with the new position.
r.execute(ansi.CursorDown(r.linesRendered - r.linesRenderedBeforeAltScreen))
Expand Down

0 comments on commit 42ff3f2

Please sign in to comment.