fix(warp): support newlines

This commit is contained in:
Jan De Dobbeleer 2022-12-08 11:00:02 +01:00 committed by Jan De Dobbeleer
parent 3dc8538136
commit 1e50107ff6
2 changed files with 13 additions and 1 deletions

View file

@ -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
}

View file

@ -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
}