aboutsummaryrefslogtreecommitdiff
path: root/internal/prompt
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2021-03-05 16:33:48 +0100
committerStefan Majewsky <majewsky@gmx.net>2021-03-05 16:33:48 +0100
commit308bbb597c7c572e86c623507f4af79c128aac43 (patch)
treeb47b6db68b495ff72258bc1363fd342eb1f3fc36 /internal/prompt
parentb54666832935e263f93d61fb2db1d98c88e48ea9 (diff)
downloadgofu-308bbb597c7c572e86c623507f4af79c128aac43.tar.gz
prettyprompt: fix display of ~ in terminal titlev2021.2
Diffstat (limited to 'internal/prompt')
-rw-r--r--internal/prompt/pwd.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/prompt/pwd.go b/internal/prompt/pwd.go
index 947606c..27fe84b 100644
--- a/internal/prompt/pwd.go
+++ b/internal/prompt/pwd.go
@@ -114,8 +114,11 @@ func (dir *Directory) stripHomeDirFromDisplay() {
if dir.InBuildTree || dir.InRepoTree {
return
}
- rel = ""
+ dir.DisplayPath = ""
+ dir.TitlePath = "~"
+ return
}
+
if !strings.HasPrefix(rel, "..") {
dir.DisplayPath = rel
dir.TitlePath = "~/" + rel
@@ -131,6 +134,7 @@ func findNearestAccessiblePath(path string) string {
}
func getDirectoryField(dir Directory, tt *TerminalTitle) string {
+ tt.Path = dir.TitlePath
if dir.DisplayPath == "" {
return ""
}
@@ -151,8 +155,6 @@ func getDirectoryField(dir Directory, tt *TerminalTitle) string {
txt = withColor("1;36", dir.NearestAccessiblePath+"/") + withColor("1;31", rel)
}
- tt.Path = dir.TitlePath
-
//apply tags
if dir.InRepoTree {
txt = withType("repo", txt)