mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Minor refactor
This commit is contained in:
parent
0b66191dd5
commit
2115d75ac6
24
src/nnn.c
24
src/nnn.c
|
@ -5000,7 +5000,7 @@ static void redraw(char *path)
|
||||||
|
|
||||||
int ncols = (xcols <= PATH_MAX) ? xcols : PATH_MAX;
|
int ncols = (xcols <= PATH_MAX) ? xcols : PATH_MAX;
|
||||||
int onscreen = xlines - 4;
|
int onscreen = xlines - 4;
|
||||||
int i, attrs;
|
int i;
|
||||||
char *ptr = path;
|
char *ptr = path;
|
||||||
|
|
||||||
// Fast redraw
|
// Fast redraw
|
||||||
|
@ -5031,16 +5031,12 @@ static void redraw(char *path)
|
||||||
|
|
||||||
addch('[');
|
addch('[');
|
||||||
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)
|
||||||
addch(i + '1');
|
addch(i + '1');
|
||||||
} else {
|
else
|
||||||
attrs = COLOR_PAIR(i + 1) | A_BOLD
|
addch((i + '1') | (COLOR_PAIR(i + 1) | A_BOLD
|
||||||
/* active: underline, current: reverse */
|
/* active: underline, current: reverse */
|
||||||
| ((cfg.curctx != i) ? A_UNDERLINE : A_REVERSE );
|
| ((cfg.curctx != i) ? A_UNDERLINE : A_REVERSE)));
|
||||||
attron(attrs);
|
|
||||||
addch(i + '1');
|
|
||||||
attroff(attrs);
|
|
||||||
}
|
|
||||||
addch(' ');
|
addch(' ');
|
||||||
}
|
}
|
||||||
addstr("\b] "); /* 10 chars printed for contexts - "[1 2 3 4] " */
|
addstr("\b] "); /* 10 chars printed for contexts - "[1 2 3 4] " */
|
||||||
|
@ -5052,13 +5048,11 @@ static void redraw(char *path)
|
||||||
if ((i + MIN_DISPLAY_COLS) <= ncols)
|
if ((i + MIN_DISPLAY_COLS) <= ncols)
|
||||||
addnstr(path, ncols - MIN_DISPLAY_COLS);
|
addnstr(path, ncols - MIN_DISPLAY_COLS);
|
||||||
else {
|
else {
|
||||||
char *base = xmemrchr((uchar *)path, '/', i);;
|
char *base = xmemrchr((uchar *)path, '/', i);
|
||||||
|
|
||||||
if ((base - ptr) <= 1)
|
|
||||||
addnstr(path, ncols - MIN_DISPLAY_COLS);
|
|
||||||
else {
|
|
||||||
i = 0;
|
i = 0;
|
||||||
--base;
|
|
||||||
|
if (base != ptr) {
|
||||||
while (ptr < base) {
|
while (ptr < base) {
|
||||||
if (*ptr == '/') {
|
if (*ptr == '/') {
|
||||||
i += 2; /* 2 characters added */
|
i += 2; /* 2 characters added */
|
||||||
|
@ -5072,10 +5066,10 @@ static void redraw(char *path)
|
||||||
}
|
}
|
||||||
++ptr;
|
++ptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addnstr(base, ncols - (MIN_DISPLAY_COLS + i));
|
addnstr(base, ncols - (MIN_DISPLAY_COLS + i));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
attroff(A_UNDERLINE);
|
attroff(A_UNDERLINE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue