From b54666832935e263f93d61fb2db1d98c88e48ea9 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Fri, 5 Mar 2021 16:33:33 +0100 Subject: prettyprompt: fix zsh line length computation --- internal/prompt/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/prompt/main.go b/internal/prompt/main.go index be5bb59..f403f6c 100644 --- a/internal/prompt/main.go +++ b/internal/prompt/main.go @@ -47,6 +47,10 @@ func Exec(args []string) int { fields = appendUnlessEmpty(fields, getExitCodeField(args[0])) } + //print terminal title first, otherwise it confuses zsh's line length + //computation and makes it misplace UI elements + tt.PrintTo(os.Stdout) + line := strings.Join(fields, " ") lineWidth := getPrintableLength(line) @@ -79,8 +83,6 @@ func Exec(args []string) int { } os.Stdout.Write([]byte(shellIdent + "$ ")) - tt.PrintTo(os.Stdout) - return 0 } -- cgit v1.3.1