fix: ensure alt screen switch always clears terminal

This commit is contained in:
Raphael 'kena' Poss 2022-08-25 19:18:06 +02:00 committed by Christian Muehlhaeuser
parent 6e1065830a
commit 5d1a7264c5
1 changed files with 10 additions and 2 deletions

View File

@ -262,9 +262,17 @@ func (r *standardRenderer) enterAltScreen() {
defer r.mtx.Unlock() defer r.mtx.Unlock()
r.altScreenActive = true r.altScreenActive = true
r.out.AltScreen() 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.out.MoveCursor(1, 1)
r.repaint() r.repaint()
} }
@ -273,8 +281,8 @@ func (r *standardRenderer) exitAltScreen() {
defer r.mtx.Unlock() defer r.mtx.Unlock()
r.altScreenActive = false r.altScreenActive = false
r.out.ExitAltScreen() r.out.ExitAltScreen()
r.repaint() r.repaint()
} }