From c69bd971e65f6774aaa0347df035c8f1f3f36275 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 29 Aug 2024 13:41:23 -0400 Subject: [PATCH] fix: we don't initialize the terminal when using a nilRenderer (#1120) Otherwise, a raw terminal will mess up the output. This is because a raw terminal disables termios OPOST mode which converts newlines to `\r\n` to reset the cursor to the beginning of the screen on new lines. --- tty.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tty.go b/tty.go index ed469ad43c..88aacabd51 100644 --- a/tty.go +++ b/tty.go @@ -23,6 +23,11 @@ func (p *Program) suspend() { } func (p *Program) initTerminal() error { + if _, ok := p.renderer.(*nilRenderer); ok { + // No need to initialize the terminal if we're not rendering + return nil + } + if err := p.initInput(); err != nil { return err }