forked from Mirrors/bubbletea
fix: ensure alt screen switch always clears terminal
This commit is contained in:
parent
6e1065830a
commit
5d1a7264c5
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue