From 1510fff44d5963359238149fbc89dac98cc3c05b Mon Sep 17 00:00:00 2001 From: Will Daly Date: Sat, 16 Apr 2022 07:58:36 -0700 Subject: [PATCH] Send AttrOff when clearing the screen (#523) In tcell v2.4, the following calls would reset the screen to its default color: 1. SetContent() to change the bg color to maroon. 2. Clear() 3. Show() In tcell v2.5, the behavior changed to clear the screen to the last-used style passed to SetContent. This happens because commit 62f5502f set the dirty flag to false for all cells, on the assumption that sending ti.Clear would clear the cells anyway. Unlike the drawCell calls triggered by the dirty flag, however, clearScreen does not send AttrOff. This causes the screen to clear to the last-used background color. --- tscreen.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tscreen.go b/tscreen.go index 2ed73a2..f3d85cb 100644 --- a/tscreen.go +++ b/tscreen.go @@ -858,6 +858,7 @@ func (t *tScreen) Show() { } func (t *tScreen) clearScreen() { + t.TPuts(t.ti.AttrOff) fg, bg, _ := t.style.Decompose() t.sendFgBg(fg, bg) t.TPuts(t.ti.Clear)