diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-08-21 20:30:04 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-08-23 08:30:44 +0530 |
commit | 0fbd68ab48b38319f3f3d516ef4d04d7274db4ac (patch) | |
tree | 72b3e7f21908d56ac4b5e42b27a35a26152c279a /src | |
parent | 6ea75cfd8dda6af79b7f55a9af20ca99e8caf214 (diff) | |
download | nnn-0fbd68ab48b38319f3f3d516ef4d04d7274db4ac.tar.gz |
Use lighter function to print character
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -2330,32 +2330,30 @@ static void printent(const struct entry *ent, int sel, uint namecols) { wchar_t *wstr; unescape(ent->name, namecols, &wstr); - const char cp = (ent->flags & FILE_COPIED) ? '+' : ' '; - char ind[2] = {'\0', '\0'}; - mode_t mode = ent->mode; + char ind = '\0'; - switch (mode & S_IFMT) { + switch (ent->mode & S_IFMT) { case S_IFREG: - if (mode & 0100) - ind[0] = '*'; + if (ent->mode & 0100) + ind = '*'; break; case S_IFDIR: - ind[0] = '/'; + ind = '/'; break; case S_IFLNK: - ind[0] = '@'; + ind = '@'; break; case S_IFSOCK: - ind[0] = '='; + ind = '='; break; case S_IFIFO: - ind[0] = '|'; + ind = '|'; break; case S_IFBLK: // fallthrough case S_IFCHR: break; default: - ind[0] = '?'; + ind = '?'; break; } @@ -2365,9 +2363,11 @@ static void printent(const struct entry *ent, int sel, uint namecols) if (sel) attron(A_REVERSE); - printw("%c", cp); + addch((ent->flags & FILE_COPIED) ? '+' : ' '); addwstr(wstr); - printw("%s\n", ind); + if (ind) + addch(ind); + addch('\n'); if (sel) attroff(A_REVERSE); |