From 6c95e8dbb3814b7d426cc9e282e3b370f80977cf Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 2 Mar 2024 14:22:12 -0800 Subject: [PATCH] Try not to clear screen on Windows if TCELL_ALTSCREEN=disable --- console_win.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/console_win.go b/console_win.go index e8921ec..92ae4e5 100644 --- a/console_win.go +++ b/console_win.go @@ -336,19 +336,20 @@ func (s *cScreen) disengage() { if s.vten { s.emitVtString(vtCursorStyles[CursorStyleDefault]) s.emitVtString(vtEnableAm) + if !s.disableAlt { + s.emitVtString(vtExitCA) + } + } else if !s.disableAlt { + s.clearScreen(StyleDefault, s.vten) } s.setInMode(s.oimode) s.setOutMode(s.oomode) s.setBufferSize(int(s.oscreen.size.x), int(s.oscreen.size.y)) - s.clearScreen(StyleDefault, false) s.setCursorPos(0, 0, false) s.setCursorInfo(&s.ocursor) _, _, _ = procSetConsoleTextAttribute.Call( uintptr(s.out), uintptr(s.mapStyle(StyleDefault))) - if s.vten && !s.disableAlt { - s.emitVtString(vtExitCA) - } } func (s *cScreen) engage() error {