mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
Use lighter function to print character
This commit is contained in:
parent
6ea75cfd8d
commit
0fbd68ab48
|
@ -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.
|
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.
|
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.
|
||||||
|
|
||||||
|
|
26
src/nnn.c
26
src/nnn.c
|
@ -2330,32 +2330,30 @@ static void printent(const struct entry *ent, int sel, uint namecols)
|
||||||
{
|
{
|
||||||
wchar_t *wstr;
|
wchar_t *wstr;
|
||||||
unescape(ent->name, namecols, &wstr);
|
unescape(ent->name, namecols, &wstr);
|
||||||
const char cp = (ent->flags & FILE_COPIED) ? '+' : ' ';
|
char ind = '\0';
|
||||||
char ind[2] = {'\0', '\0'};
|
|
||||||
mode_t mode = ent->mode;
|
|
||||||
|
|
||||||
switch (mode & S_IFMT) {
|
switch (ent->mode & S_IFMT) {
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
if (mode & 0100)
|
if (ent->mode & 0100)
|
||||||
ind[0] = '*';
|
ind = '*';
|
||||||
break;
|
break;
|
||||||
case S_IFDIR:
|
case S_IFDIR:
|
||||||
ind[0] = '/';
|
ind = '/';
|
||||||
break;
|
break;
|
||||||
case S_IFLNK:
|
case S_IFLNK:
|
||||||
ind[0] = '@';
|
ind = '@';
|
||||||
break;
|
break;
|
||||||
case S_IFSOCK:
|
case S_IFSOCK:
|
||||||
ind[0] = '=';
|
ind = '=';
|
||||||
break;
|
break;
|
||||||
case S_IFIFO:
|
case S_IFIFO:
|
||||||
ind[0] = '|';
|
ind = '|';
|
||||||
break;
|
break;
|
||||||
case S_IFBLK: // fallthrough
|
case S_IFBLK: // fallthrough
|
||||||
case S_IFCHR:
|
case S_IFCHR:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ind[0] = '?';
|
ind = '?';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2365,9 +2363,11 @@ static void printent(const struct entry *ent, int sel, uint namecols)
|
||||||
if (sel)
|
if (sel)
|
||||||
attron(A_REVERSE);
|
attron(A_REVERSE);
|
||||||
|
|
||||||
printw("%c", cp);
|
addch((ent->flags & FILE_COPIED) ? '+' : ' ');
|
||||||
addwstr(wstr);
|
addwstr(wstr);
|
||||||
printw("%s\n", ind);
|
if (ind)
|
||||||
|
addch(ind);
|
||||||
|
addch('\n');
|
||||||
|
|
||||||
if (sel)
|
if (sel)
|
||||||
attroff(A_REVERSE);
|
attroff(A_REVERSE);
|
||||||
|
|
Loading…
Reference in a new issue