fix(transient): count newlines and not ;

relates to #807
This commit is contained in:
Jan De Dobbeleer 2021-06-26 20:16:00 +02:00 committed by Jan De Dobbeleer
parent f19460a0c5
commit 8cf85a370d

View file

@ -219,11 +219,8 @@ func (e *engine) renderTooltip(tip string) string {
}
func (e *engine) renderTransientPrompt(command string) string {
newlines := strings.Count(command, ";")
if strings.HasSuffix(command, ";") {
newlines--
}
command = strings.Replace(command, ";", fmt.Sprintf(";%s", e.ansi.newLine()), newlines)
newlines := strings.Count(command, "\n")
command = strings.Replace(command, "\n", e.ansi.newLine(), newlines)
promptTemplate := e.config.TransientPrompt.Template
if len(promptTemplate) == 0 {
promptTemplate = "{{ .Shell }}> <#f7dc66>{{ .Command }}</>"