From b43c3105c9c512d0425a87ef7ef022b75b9e6080 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 28 Aug 2024 15:47:07 -0400 Subject: [PATCH] fix: we don't initialize the terminal when using a nilRenderer 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 }