From 308bbb597c7c572e86c623507f4af79c128aac43 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Fri, 5 Mar 2021 16:33:48 +0100 Subject: prettyprompt: fix display of ~ in terminal title --- internal/prompt/pwd.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'internal') 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) -- cgit v1.3.1