diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2020-01-15 00:57:02 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2020-01-15 00:57:02 +0530 |
commit | a9ebe7ed8857bcf0496c454bf9e10006dfb0b41c (patch) | |
tree | 527806fbc8f8ce43b1089155446674e7cee68af4 /src | |
parent | 1a728603bf219c9b9bd0e356d67289bf20d08819 (diff) | |
download | nnn-a9ebe7ed8857bcf0496c454bf9e10006dfb0b41c.tar.gz |
While drawing lines, set correct color
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -4327,26 +4327,38 @@ static int adjust_cols(int ncols) } else ncols -= 3; /* Preceding space, indicator, newline */ - attron(COLOR_PAIR(cfg.curctx + 1) | A_BOLD); - cfg.dircolor = 1; - return ncols; } static void draw_line(char *path, int ncols) { + bool dir = FALSE; + ncols = adjust_cols(ncols); + if (dents[last].flags & DIR_OR_LINK_TO_DIR) { + attron(COLOR_PAIR(cfg.curctx + 1) | A_BOLD); + dir = TRUE; + } move(2 + last - curscroll, 0); printptr(&dents[last], ncols, false); + + if (dents[cur].flags & DIR_OR_LINK_TO_DIR) { + if (!dir) {/* First file is not a directory */ + attron(COLOR_PAIR(cfg.curctx + 1) | A_BOLD); + dir = TRUE; + } + } else if (dir) { /* Second file is not a directory */ + attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD); + dir = FALSE; + } + move(2 + cur - curscroll, 0); printptr(&dents[cur], ncols, true); /* Must reset e.g. no files in dir */ - if (cfg.dircolor) { + if (dir) attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD); - cfg.dircolor = 0; - } statusbar(path); } @@ -4439,6 +4451,9 @@ static void redraw(char *path) ncols = adjust_cols(ncols); + attron(COLOR_PAIR(cfg.curctx + 1) | A_BOLD); + cfg.dircolor = 1; + /* Print listing */ for (i = curscroll; i < ndents && i < curscroll + onscreen; ++i) printptr(&dents[i], ncols, i == cur); |