return g_buf[0] ? g_buf : NULL;
}
+static void
+resetdircolor(mode_t mode)
+{
+ if (cfg.dircolor && !S_ISDIR(mode)) {
+ attroff(COLOR_PAIR(1) | A_BOLD);
+ cfg.dircolor = 0;
+ }
+}
+
/*
* Replace escape characters in a string with '?'
* Adjust string length to maxcols if > 0;
pname = unescape(ent->name, namecols);
+ /* Directories are always shown on top */
+ resetdircolor(ent->mode);
+
if (S_ISDIR(ent->mode))
printw("%s%s/\n", CURSYM(sel), pname);
else if (S_ISLNK(ent->mode))
printw("%s%s*\n", CURSYM(sel), pname);
else
printw("%s%s\n", CURSYM(sel), pname);
-
- /* Dirs are always shown on top */
- if (cfg.dircolor && !S_ISDIR(ent->mode)) {
- attroff(COLOR_PAIR(1) | A_BOLD);
- cfg.dircolor = 0;
- }
}
static char *
strftime(buf, 18, "%d-%m-%Y %H:%M", localtime(&ent->t));
pname = unescape(ent->name, namecols);
+ /* Directories are always shown on top */
+ resetdircolor(ent->mode);
+
if (sel)
attron(A_REVERSE);
printw("%s%-16.16s %8.8s %s\n", CURSYM(sel), buf, coolsize(ent->blocks << 9), pname);
}
- /* Dirs are always shown on top */
- if (cfg.dircolor && !S_ISDIR(ent->mode)) {
- attroff(COLOR_PAIR(1) | A_BOLD);
- cfg.dircolor = 0;
- }
-
if (sel)
attroff(A_REVERSE);
}