Skip to content

Commit

Permalink
fix: we don't initialize the terminal when using a nilRenderer (#1120)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aymanbagabas authored Aug 29, 2024
1 parent af7ec0e commit c69bd97
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c69bd97

Please sign in to comment.