Skip to content

Commit

Permalink
fix: ensure alt screen switch always clears terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
knz authored and muesli committed Oct 4, 2022
1 parent 6e10658 commit 5d1a726
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions standard_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,17 @@ func (r *standardRenderer) enterAltScreen() {
defer r.mtx.Unlock()

r.altScreenActive = true

r.out.AltScreen()

// Ensure that the terminal is cleared, even when it doesn't support
// alt screen (or alt screen support is disabled, like GNU screen by
// default).
//
// Note: we can't use r.clearScreen() here because the mutex is already
// locked.
r.out.ClearScreen()
r.out.MoveCursor(1, 1)

r.repaint()
}

Expand All @@ -273,8 +281,8 @@ func (r *standardRenderer) exitAltScreen() {
defer r.mtx.Unlock()

r.altScreenActive = false

r.out.ExitAltScreen()

r.repaint()
}

Expand Down

0 comments on commit 5d1a726

Please sign in to comment.