From 5962d8d9b777040b372c9e2ac49690bbee65f658 Mon Sep 17 00:00:00 2001 From: valoq Date: Tue, 8 Sep 2026 14:48:04 +0200 Subject: [PATCH] Fix: shorten home path correctly (#2679) --- ui.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui.go b/ui.go index 547b009b..45b2562e 100644 --- a/ui.go +++ b/ui.go @@ -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)