mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Combine checks
This commit is contained in:
parent
4885b5fc2f
commit
879beb70cf
21
src/nnn.c
21
src/nnn.c
|
@ -2741,9 +2741,9 @@ static void populate(char *path, char *lastname)
|
||||||
|
|
||||||
static void redraw(char *path)
|
static void redraw(char *path)
|
||||||
{
|
{
|
||||||
static char buf[NAME_MAX + 65] __attribute__ ((aligned));
|
char buf[NAME_MAX + 65];
|
||||||
char c;
|
char c;
|
||||||
size_t ncols = COLS;
|
size_t ncols = (COLS <= PATH_MAX) ? COLS : PATH_MAX;
|
||||||
int nlines = MIN(LINES - 4, ndents), i, attrs;
|
int nlines = MIN(LINES - 4, ndents), i, attrs;
|
||||||
|
|
||||||
/* Clear screen */
|
/* Clear screen */
|
||||||
|
@ -2758,7 +2758,7 @@ static void redraw(char *path)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Fail redraw if < than 11 columns, context info prints 10 chars */
|
/* Fail redraw if < than 11 columns, context info prints 10 chars */
|
||||||
if (COLS < 11) {
|
if (ncols < 11) {
|
||||||
printmsg("too few columns!");
|
printmsg("too few columns!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2766,9 +2766,6 @@ static void redraw(char *path)
|
||||||
DPRINTF_D(cur);
|
DPRINTF_D(cur);
|
||||||
DPRINTF_S(path);
|
DPRINTF_S(path);
|
||||||
|
|
||||||
if (ncols > PATH_MAX)
|
|
||||||
ncols = PATH_MAX;
|
|
||||||
|
|
||||||
printw("[");
|
printw("[");
|
||||||
for (i = 0; i < CTX_MAX; ++i) {
|
for (i = 0; i < CTX_MAX; ++i) {
|
||||||
if (!g_ctx[i].c_cfg.ctxactive)
|
if (!g_ctx[i].c_cfg.ctxactive)
|
||||||
|
@ -2799,16 +2796,16 @@ static void redraw(char *path)
|
||||||
attroff(A_UNDERLINE);
|
attroff(A_UNDERLINE);
|
||||||
path[ncols - 11] = c;
|
path[ncols - 11] = c;
|
||||||
|
|
||||||
|
/* Calculate the number of cols available to print entry name */
|
||||||
|
if (cfg.showdetail) {
|
||||||
/* Fallback to light mode if less than 35 columns */
|
/* Fallback to light mode if less than 35 columns */
|
||||||
if (ncols < 35 && cfg.showdetail) {
|
if (ncols < 36) {
|
||||||
cfg.showdetail ^= 1;
|
cfg.showdetail ^= 1;
|
||||||
printptr = &printent;
|
printptr = &printent;
|
||||||
}
|
ncols -= 5;
|
||||||
|
} else
|
||||||
/* Calculate the number of cols available to print entry name */
|
|
||||||
if (cfg.showdetail)
|
|
||||||
ncols -= 35;
|
ncols -= 35;
|
||||||
else
|
} else
|
||||||
ncols -= 5;
|
ncols -= 5;
|
||||||
|
|
||||||
if (!cfg.wild) {
|
if (!cfg.wild) {
|
||||||
|
|
Loading…
Reference in a new issue