Fix: shorten home path correctly (#2679)

This commit is contained in:
valoq authored and GitHub committed 2026-09-08 14:48:04 +02:00
1 parent 274b13df9e
commit 5962d8d9b7
1 file changed
+3 -2
+3 -2
View File
@@ -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)