Re-format detailed view, show filename

This commit is contained in:
Arun Prakash Jana 2017-03-30 18:54:18 +05:30
parent 055439f23e
commit 6b169bbd86
No known key found for this signature in database
GPG key ID: A75979F35C080412
2 changed files with 35 additions and 26 deletions

View file

@ -48,8 +48,9 @@ I chose to fork noice because:
- file type - file type
- modification time - modification time
- human-readable file size - human-readable file size
- number of entries in current directory
- current item in reverse video - current item in reverse video
- number of items in current directory
- full name of currently selected file
- Case-insensitive alphabetic content listing instead of upper case first - Case-insensitive alphabetic content listing instead of upper case first
- Roll over at the first and last entries of a directory (with Up/Down keys) - Roll over at the first and last entries of a directory (with Up/Down keys)
- Sort entries by file size (largest to smallest) - Sort entries by file size (largest to smallest)
@ -121,14 +122,13 @@ The following abbreviations are used in the detail view:
| Symbol | File Type | | Symbol | File Type |
| --- | --- | | --- | --- |
| B | Block Device | | `/` | Directory |
| C | Character Device | | `*` | Executable |
| D | Directory | | `|` | Fifo |
| E | Executable | | `=` | Socket |
| F | Fifo | | `@` | Symbolic Link |
| L | Symbolic Link | | `b` | Block Device |
| R | Regular File | | `c` | Character Device |
| S | Socket |
### Help ### Help

41
noice.c
View file

@ -456,6 +456,7 @@ printent_long(struct entry *ent, int active)
{ {
static char buf[18]; static char buf[18];
const static struct tm *p; const static struct tm *p;
static char name[PATH_MAX + 2];
p = localtime(&ent->t); p = localtime(&ent->t);
strftime(buf, 18, "%b %d %H:%M %Y", p); strftime(buf, 18, "%b %d %H:%M %Y", p);
@ -463,23 +464,28 @@ printent_long(struct entry *ent, int active)
if (active) if (active)
attron(A_REVERSE); attron(A_REVERSE);
if (S_ISDIR(ent->mode)) if (S_ISDIR(ent->mode)) {
printw("%s%-32.32s D %-18.18s\n", cur(active), ent->name, buf); sprintf(name, "%s/", ent->name);
else if (S_ISLNK(ent->mode)) printw("%s%-32.32s %-18.18s\n", cur(active), name, buf);
printw("%s%-32.32s L %-18.18s\n", cur(active), ent->name, buf); } else if (S_ISLNK(ent->mode)) {
else if (S_ISSOCK(ent->mode)) sprintf(name, "%s@", ent->name);
printw("%s%-32.32s S %-18.18s\n", cur(active), ent->name, buf); printw("%s%-32.32s %-18.18s\n", cur(active), name, buf);
else if (S_ISFIFO(ent->mode)) } else if (S_ISSOCK(ent->mode)) {
printw("%s%-32.32s F %-18.18s\n", cur(active), ent->name, buf); sprintf(name, "%s=", ent->name);
else if (S_ISBLK(ent->mode)) printw("%s%-32.32s %-18.18s\n", cur(active), name, buf);
printw("%s%-32.32s B %-18.18s\n", cur(active), ent->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);
else if (S_ISCHR(ent->mode)) else if (S_ISCHR(ent->mode))
printw("%s%-32.32s C %-18.18s\n", cur(active), ent->name, buf); printw("%s%-32.32s c %-18.18s\n", cur(active), ent->name, buf);
else if (ent->mode & S_IXUSR) else if (ent->mode & S_IXUSR) {
printw("%s%-32.32s E %-18.18s %s\n", cur(active), ent->name, sprintf(name, "%s*", ent->name);
printw("%s%-32.32s %-18.18s %s\n", cur(active), name,
buf, coolsize(ent->size)); buf, coolsize(ent->size));
else } else
printw("%s%-32.32s R %-18.18s %s\n", cur(active), ent->name, printw("%s%-32.32s %-18.18s %s\n", cur(active), ent->name,
buf, coolsize(ent->size)); buf, coolsize(ent->size));
if (active) if (active)
@ -632,8 +638,11 @@ redraw(char *path)
} }
if (showdetail) { if (showdetail) {
sprintf(cwd, "%d items", ndents); if (ndents) {
sprintf(cwd, "%d items [%s]", ndents, dents[cur].name);
printmsg(cwd); printmsg(cwd);
} else
printmsg("0 items");
} }
} }