aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-09-08 15:13:44 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-09-08 15:28:31 +0530
commit7621078d52da266371483e45a2b79bb020cb50c0 (patch)
tree69d6c07271223859c2419bd4aacb0e3959ccc041 /src
parent84119b12382024fe2e95f6eb2f8797010fe54b67 (diff)
downloadnnn-7621078d52da266371483e45a2b79bb020cb50c0.tar.gz
Show path in short form
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 844a3a5..b820d0d 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3154,6 +3154,7 @@ static void redraw(char *path)
int i, attrs;
char buf[12];
char c;
+ char *ptr = path, *base = xbasename(path);
--lastln;
@@ -3206,7 +3207,23 @@ static void redraw(char *path)
/* No text wrapping in cwd line, store the truncating char in c */
c = path[ncols - 11];
path[ncols - 11] = '\0';
- printw("%s\n\n", path);
+
+ /* Print path */
+ if (base - ptr <= 1)
+ printw("%s\n\n", path);
+ else {
+ base = base - 1;
+ while (ptr < base) {
+ if (*ptr == '/') {
+ addch(*ptr);
+ addch(*(++ptr));
+ }
+ ++ptr;
+ }
+
+ printw("/%s\n\n", base + 1);
+ }
+
attroff(A_UNDERLINE);
path[ncols - 11] = c; /* Restore c */