summaryrefslogtreecommitdiff
path: root/internal/prompt
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2021-03-05 16:33:33 +0100
committerStefan Majewsky <majewsky@gmx.net>2021-03-05 16:33:33 +0100
commitb54666832935e263f93d61fb2db1d98c88e48ea9 (patch)
tree2522cb71511d4e51e354d04423b10f076499c94e /internal/prompt
parent9e587a8cc4add8958753e9e477c0646ec6cb62c7 (diff)
downloadgofu-b54666832935e263f93d61fb2db1d98c88e48ea9.tar.gz
prettyprompt: fix zsh line length computation
Diffstat (limited to 'internal/prompt')
-rw-r--r--internal/prompt/main.go6
1 files 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
}