aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-03-31 21:17:50 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-03-31 21:30:00 +0530
commit8563ec5cb28f43060eacac0d7b0f27ecee78c9fc (patch)
tree7f6e8e0428771ab16fc88caa5201994924cfd28a
parenteb12354ce4453fb1c6f1dd106edbc0967896a590 (diff)
downloadnnn-8563ec5cb28f43060eacac0d7b0f27ecee78c9fc.tar.gz
Revamp detail mode
If a filename has Unicode chars, the alignment is broken. Hence moving name to the last column. This also makes the view compact. Moving block and char dev indicators in the space for size.
-rw-r--r--nnn.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/nnn.c b/nnn.c
index b4415ab..7234af8 100644
--- a/nnn.c
+++ b/nnn.c
@@ -458,7 +458,6 @@ printent_long(struct entry *ent, int active)
{
static char buf[18];
const static struct tm *p;
- static char name[PATH_MAX + 2];
p = localtime(&ent->t);
strftime(buf, 18, "%b %d %H:%M %Y", p);
@@ -466,29 +465,22 @@ printent_long(struct entry *ent, int active)
if (active)
attron(A_REVERSE);
- if (S_ISDIR(ent->mode)) {
- sprintf(name, "%s/", ent->name);
- printw("%s%-32.32s %-18.18s\n", cur(active), name, buf);
- } else if (S_ISLNK(ent->mode)) {
- sprintf(name, "%s@", ent->name);
- printw("%s%-32.32s %-18.18s\n", cur(active), name, buf);
- } else if (S_ISSOCK(ent->mode)) {
- sprintf(name, "%s=", ent->name);
- printw("%s%-32.32s %-18.18s\n", cur(active), name, buf);
- } else if (S_ISFIFO(ent->mode)) {
- sprintf(name, "%s|", ent->name);
- printw("%s%-32.32s %-18.18s\n", cur(active), name, buf);
- } else if (S_ISBLK(ent->mode))
- printw("%s%-32.32s b %-18.18s\n", cur(active), ent->name, buf);
+ if (S_ISDIR(ent->mode))
+ printw("%s%-17.17s %s/\n", cur(active), buf, ent->name);
+ else if (S_ISLNK(ent->mode))
+ printw("%s%-17.17s %s@\n", cur(active), buf, ent->name);
+ else if (S_ISSOCK(ent->mode))
+ printw("%s%-17.17s %s=\n", cur(active), buf, ent->name);
+ else if (S_ISFIFO(ent->mode))
+ printw("%s%-17.17s %s|\n", cur(active), buf, ent->name);
+ else if (S_ISBLK(ent->mode))
+ printw("%s%-17.17s b %s\n", cur(active), buf, ent->name);
else if (S_ISCHR(ent->mode))
- printw("%s%-32.32s c %-18.18s\n", cur(active), ent->name, buf);
- else if (ent->mode & S_IXUSR) {
- sprintf(name, "%s*", ent->name);
- printw("%s%-32.32s %-18.18s %s\n", cur(active), name,
- buf, coolsize(ent->size));
- } else
- printw("%s%-32.32s %-18.18s %s\n", cur(active), ent->name,
- buf, coolsize(ent->size));
+ printw("%s%-17.17s c %s\n", cur(active), buf, ent->name);
+ else if (ent->mode & S_IXUSR)
+ printw("%s%-17.17s %8.8s %s*\n", cur(active), buf, coolsize(ent->size), ent->name);
+ else
+ printw("%s%-17.17s %8.8s %s\n", cur(active), buf, coolsize(ent->size), ent->name);
if (active)
attroff(A_REVERSE);