about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichal Mazurek <akfaew@jasminek.net>2012-02-17 20:05:11 +0100
committerMichal Mazurek <akfaew@jasminek.net>2012-02-17 20:51:54 +0100
commit85bd5c585c15179974cf88044930f177c6e25a27 (patch)
treea9872162c773434ea96638b1c4158d3c473895c6
parent0e246426103279289b8bdf71f8c1c4f3c7b714a0 (diff)
downloadxombrero-85bd5c585c15179974cf88044930f177c6e25a27.tar.gz
make the 'gu' buffer command always strip the last '/' to fix paths
ending in '/'.
-rw-r--r--xxxterm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xxxterm.c b/xxxterm.c
index 6b40fe7..7a8a860 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -5025,6 +5025,7 @@ int
 go_up(struct tab *t, struct karg *args)
 {
 	int		levels;
+	int		lastidx;
 	char		*uri;
 	char		*tmp;
 	char		*p;
@@ -5045,6 +5046,13 @@ go_up(struct tab *t, struct karg *args)
 	if (tmp[0] == '/')
 		tmp++;
 
+	/* it makes no sense to strip the last slash from ".../dir/", skip it */
+	lastidx = strlen(tmp) - 1;
+	if (lastidx >= 0) {
+		if (tmp[lastidx] == '/')
+			tmp[lastidx] = '\0';
+	}
+
 	while (levels--) {
 		p = strrchr(tmp, '/');
 		if (p != NULL)