From d66eb7349ddece93baf9ea1c18b72c985615b794 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sun, 2 Oct 2016 00:39:03 +0300 Subject: [PATCH] clean path before changing directory --- nav.go | 1 + ui.go | 1 + 2 files changed, 2 insertions(+) diff --git a/nav.go b/nav.go index 77f9c90..e40d2bc 100644 --- a/nav.go +++ b/nav.go @@ -326,6 +326,7 @@ func (nav *Nav) top() { func (nav *Nav) cd(wd string) error { wd = strings.Replace(wd, "~", envHome, -1) + wd = filepath.Clean(wd) if !filepath.IsAbs(wd) { wd = filepath.Join(nav.currDir().path, wd) diff --git a/ui.go b/ui.go index 7f06659..9e5ae6b 100644 --- a/ui.go +++ b/ui.go @@ -476,6 +476,7 @@ func (ui *UI) draw(nav *Nav) { dir := nav.currDir() path := strings.Replace(dir.path, envHome, "~", -1) + path = filepath.Clean(path) ui.pwdwin.printf(0, 0, termbox.AttrBold|termbox.ColorGreen, bg, "%s@%s", envUser, envHost) ui.pwdwin.printf(len(envUser)+len(envHost)+1, 0, fg, bg, ":")