From cd3f8742ad47d6f1218775dfe53837cc70503bdd Mon Sep 17 00:00:00 2001 From: lnu Date: Sat, 20 Mar 2021 08:49:49 +0100 Subject: [PATCH] fix: escape double quotes for zsh prompt --- src/engine.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/engine.go b/src/engine.go index 17e6ae3c..50f8f92f 100644 --- a/src/engine.go +++ b/src/engine.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "strings" "sync" "time" ) @@ -247,7 +248,8 @@ func (e *engine) print() { switch e.env.getShellName() { case zsh: if *e.env.getArgs().Eval { - fmt.Printf("PS1=\"%s\"", e.renderer.string()) + // escape double quotes contained in the prompt + fmt.Printf("PS1=\"%s\"", strings.ReplaceAll(e.renderer.string(), "\"", "\"\"")) fmt.Printf("\nRPROMPT=\"%s\"", e.rprompt) return }