aboutsummaryrefslogtreecommitdiffstats
path: root/src/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-27 14:38:19 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-27 14:38:19 +0530
commitd47be4e89b57398e0964e3cdbe76cab4f3e44a17 (patch)
treef49b50534117fb0e094701ee93480e487b24aff8 /src/nnn.c
parentbc6295e7a7d2c0f5c53bc895dbde921c4ed0d569 (diff)
downloadnnn-d47be4e89b57398e0964e3cdbe76cab4f3e44a17.tar.gz
Code reformat
Diffstat (limited to 'src/nnn.c')
-rw-r--r--src/nnn.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/nnn.c b/src/nnn.c
index d9b7a50..6f27339 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2253,6 +2253,9 @@ static bool handle_archive(char *fpath, char *arg, char *dir)
*/
static bool show_help(char *path)
{
+ int i = 0, fd;
+ char *start, *end;
+
if (g_tmpfpath[0])
xstrlcpy(g_tmpfpath + g_tmpfplen - 1, messages[STR_TMPFILE],
HOME_LEN_MAX - g_tmpfplen);
@@ -2261,8 +2264,7 @@ static bool show_help(char *path)
return FALSE;
}
- int i = 0, fd = mkstemp(g_tmpfpath);
- char *start, *end;
+ fd = mkstemp(g_tmpfpath);
static char helpstr[] = {
"0\n"
@@ -2633,27 +2635,28 @@ static void redraw(char *path)
printw("[");
for (i = 0; i < CTX_MAX; ++i) {
- /* Print current context in reverse */
- if (cfg.curctx == i) {
+ if (!g_ctx[i].c_cfg.ctxactive)
+ printw("%d ", i + 1);
+ else if (cfg.curctx != i) {
if (cfg.showcolor)
- attrs = COLOR_PAIR(i + 1) | A_BOLD | A_REVERSE;
+ attrs = COLOR_PAIR(i + 1) | A_BOLD | A_UNDERLINE;
else
- attrs = A_REVERSE;
+ attrs = A_UNDERLINE;
attron(attrs);
printw("%d", i + 1);
attroff(attrs);
printw(" ");
- } else if (g_ctx[i].c_cfg.ctxactive) {
+ } else {
+ /* Print current context in reverse */
if (cfg.showcolor)
- attrs = COLOR_PAIR(i + 1) | A_BOLD | A_UNDERLINE;
+ attrs = COLOR_PAIR(i + 1) | A_BOLD | A_REVERSE;
else
- attrs = A_UNDERLINE;
+ attrs = A_REVERSE;
attron(attrs);
printw("%d", i + 1);
attroff(attrs);
printw(" ");
- } else
- printw("%d ", i + 1);
+ }
}
printw("\b] "); /* 10 chars printed in total for contexts - "[1 2 3 4] " */