mirror of
https://github.com/jarun/nnn.git
synced 2025-03-14 10:44:05 +00:00
Show path in short form
This commit is contained in:
parent
84119b1238
commit
7621078d52
1 changed files with 18 additions and 1 deletions
19
src/nnn.c
19
src/nnn.c
|
@ -3154,6 +3154,7 @@ static void redraw(char *path)
|
||||||
int i, attrs;
|
int i, attrs;
|
||||||
char buf[12];
|
char buf[12];
|
||||||
char c;
|
char c;
|
||||||
|
char *ptr = path, *base = xbasename(path);
|
||||||
|
|
||||||
--lastln;
|
--lastln;
|
||||||
|
|
||||||
|
@ -3206,7 +3207,23 @@ static void redraw(char *path)
|
||||||
/* No text wrapping in cwd line, store the truncating char in c */
|
/* No text wrapping in cwd line, store the truncating char in c */
|
||||||
c = path[ncols - 11];
|
c = path[ncols - 11];
|
||||||
path[ncols - 11] = '\0';
|
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);
|
attroff(A_UNDERLINE);
|
||||||
path[ncols - 11] = c; /* Restore c */
|
path[ncols - 11] = c; /* Restore c */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue