Fix: shorten home path correctly (#2679)
This commit is contained in:
1 parent
274b13df9e
commit
5962d8d9b7
1 file changed
+3
-2
@@ -647,8 +647,9 @@ func (ui *ui) drawPromptLine(nav *nav) {
|
||||
dir := nav.currDir()
|
||||
pwd := sanitizeName(dir.path)
|
||||
|
||||
if after, ok := strings.CutPrefix(pwd, gUser.HomeDir); ok {
|
||||
pwd = filepath.Join("~", after)
|
||||
// shorten the home directory itself and paths inside
|
||||
if rel, err := filepath.Rel(gUser.HomeDir, pwd); err == nil && filepath.IsLocal(rel) {
|
||||
pwd = filepath.Join("~", rel)
|
||||
}
|
||||
|
||||
sep := string(filepath.Separator)
|
||||
|
||||
Reference in new issue
Block a user