diff --git a/src/color/ansi.go b/src/color/ansi.go index f183a417..de706a50 100644 --- a/src/color/ansi.go +++ b/src/color/ansi.go @@ -354,3 +354,9 @@ func (a *Ansi) SaveCursorPosition() string { func (a *Ansi) RestoreCursorPosition() string { return a.restoreCursorPosition } + +func (a *Ansi) LineBreak() string { + cr := fmt.Sprintf(a.left, 1000) + lf := fmt.Sprintf(a.linechange, 1, "B") + return cr + lf +} diff --git a/src/engine/engine.go b/src/engine/engine.go index dc46a81d..3a1871a5 100644 --- a/src/engine/engine.go +++ b/src/engine/engine.go @@ -103,7 +103,13 @@ func (e *Engine) printPWD() { } func (e *Engine) newline() { - e.write("\n") + // WARP terminal will remove \n from the prompt, so we hack a newline in + if e.Env.Getenv("TERM_PROGRAM") == "WarpTerminal" { + // fmt.Println("TERM_PROGRAM") + e.write(e.Ansi.LineBreak()) + } else { + e.write("\n") + } e.currentLineLength = 0 }