fix: escape double quotes for zsh prompt

This commit is contained in:
lnu 2021-03-20 08:49:49 +01:00 committed by Jan De Dobbeleer
parent 494d3b2d20
commit cd3f8742ad

View file

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"strings"
"sync" "sync"
"time" "time"
) )
@ -247,7 +248,8 @@ func (e *engine) print() {
switch e.env.getShellName() { switch e.env.getShellName() {
case zsh: case zsh:
if *e.env.getArgs().Eval { 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) fmt.Printf("\nRPROMPT=\"%s\"", e.rprompt)
return return
} }