]> Sergey Matveev's repositories - nnn.git/commitdiff
Use lighter function to print character
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 21 Aug 2019 15:00:04 +0000 (20:30 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 23 Aug 2019 03:00:44 +0000 (08:30 +0530)
README.md
src/nnn.c

index b187b2717ea3c47d45eb94d80e624309bdd2aa40..733615ad6d037aa648c25c1fde24388d7b45b9f5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -345,7 +345,7 @@ Selected files are visually indicated by a `+` before the entries.
 
 The selection can now be listed, copied, moved, removed, archived or linked.
 
-Navigate to a target directory then use <kbd>V</kbd> (move) or <kbd>P</kbd> (copy) to have the selected files moved or copied.
+Navigate to a target directory then use <kbd>P</kbd> (cp) or <kbd>V</kbd> (mv) to copy or move the selected files.
 
 Absolute paths of the selected files are copied to the temporary file `.selection` in the config directory. The path is shown in the help and configuration screen. If `$NNN_COPIER` is set the file paths are also copied to the system clipboard.
 
index 1fe6a61b811658fab0f8bdb8538185f3e1e6246b..1bc0908efce78d903c3dcd8b28ebee117eb1b99c 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -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);