From d003d0a0a14d8c98bd58551d27ba71cf0a13a7d0 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Fri, 5 Mar 2021 13:52:41 +0300 Subject: [PATCH] switch back to ca mode after suspend/resume Suspend call currently exits ca mode. So after the first suspend/resume the program does not use the alternate screen anymore. Therefore Resume needs to enter ca mode again. --- tscreen.go | 5 ----- tscreen_unix.go | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tscreen.go b/tscreen.go index 8af337d..3ee78b3 100644 --- a/tscreen.go +++ b/tscreen.go @@ -168,11 +168,6 @@ func (t *tScreen) Init() error { t.colors[Color(i)|ColorValid] = Color(i) | ColorValid } - t.TPuts(ti.EnterCA) - t.TPuts(ti.HideCursor) - t.TPuts(ti.EnableAcs) - t.TPuts(ti.Clear) - t.quit = make(chan struct{}) t.Lock() diff --git a/tscreen_unix.go b/tscreen_unix.go index bc8d984..60bbcfd 100644 --- a/tscreen_unix.go +++ b/tscreen_unix.go @@ -47,6 +47,12 @@ func (t *tScreen) engage() error { t.enablePasting(t.pasteEnabled) signal.Notify(t.sigwinch, syscall.SIGWINCH) + ti := t.ti + t.TPuts(ti.EnterCA) + t.TPuts(ti.HideCursor) + t.TPuts(ti.EnableAcs) + t.TPuts(ti.Clear) + t.wg.Add(2) go t.inputLoop(stopQ) go t.mainLoop(stopQ)