]> Sergey Matveev's repositories - nnn.git/commitdiff
Remove bold fonts
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 27 Jul 2019 16:55:00 +0000 (22:25 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 27 Jul 2019 17:19:16 +0000 (22:49 +0530)
This reverts commit d0c2e9da298c1f6042d775deaae33f9b9d70b6e1.

Remove bold fonts

src/nnn.c

index 88f7eb8e2bcfd3e1f6b8a9e4668bc1364005c862..50aa07b443da5c77d307832401e909403e54c96c 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -930,6 +930,7 @@ static void resetcpind(void)
 static bool initcurses(void)
 {
        short i;
+       uchar mask = 8; /* Use bright colors */
 
        if (cfg.picker) {
                if (!newterm(NULL, stderr, stdin)) {
@@ -961,9 +962,13 @@ static bool initcurses(void)
        start_color();
        use_default_colors();
 
+       /* Handle 8-bit color terms */
+       if (COLOR_PAIRS != 256)
+               mask = 0;
+
        /* Initialize default colors */
        for (i = 0; i <  CTX_MAX; ++i)
-               init_pair(i + 1, g_ctx[i].color, -1);
+               init_pair(i + 1, g_ctx[i].color | mask, -1);
 
        settimeout(); /* One second */
        set_escdelay(25);
@@ -2162,7 +2167,7 @@ static char *get_bm_loc(char *buf, int key)
 static inline void resetdircolor(int flags)
 {
        if (cfg.dircolor && !(flags & DIR_OR_LINK_TO_DIR)) {
-               attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
+               attroff(COLOR_PAIR(cfg.curctx + 1));
                cfg.dircolor = 0;
        }
 }
@@ -3198,14 +3203,14 @@ static void redraw(char *path)
                if (!g_ctx[i].c_cfg.ctxactive)
                        printw("%d ", i + 1);
                else if (cfg.curctx != i) {
-                       attrs = COLOR_PAIR(i + 1) | A_BOLD | A_UNDERLINE;
+                       attrs = COLOR_PAIR(i + 1) | A_UNDERLINE;
                        attron(attrs);
                        printw("%d", i + 1);
                        attroff(attrs);
                        printw(" ");
                } else {
                        /* Print current context in reverse */
-                       attrs = COLOR_PAIR(i + 1) | A_BOLD | A_REVERSE;
+                       attrs = COLOR_PAIR(i + 1) | A_REVERSE;
                        attron(attrs);
                        printw("%d", i + 1);
                        attroff(attrs);
@@ -3236,7 +3241,7 @@ static void redraw(char *path)
                ncols -= 5;
 
        if (!cfg.wild) {
-               attron(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
+               attron(COLOR_PAIR(cfg.curctx + 1));
                cfg.dircolor = 1;
        }
 
@@ -3247,7 +3252,7 @@ static void redraw(char *path)
 
        /* Must reset e.g. no files in dir */
        if (cfg.dircolor) {
-               attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
+               attroff(COLOR_PAIR(cfg.curctx + 1));
                cfg.dircolor = 0;
        }
 
@@ -4682,6 +4687,7 @@ int main(int argc, char *argv[])
        /* Get the context colors; copier used as tmp var */
        copier = xgetenv(env_cfg[NNN_CONTEXT_COLORS], "4444");
        opt = 0;
+
        while (opt < CTX_MAX) {
                if (*copier) {
                        if (*copier < '0' || *copier > '7') {
@@ -4689,7 +4695,7 @@ int main(int argc, char *argv[])
                                return _FAILURE;
                        }
 
-                       g_ctx[opt].color = *copier - '0';
+                       g_ctx[opt].color = (*copier - '0');
                        ++copier;
                } else
                        g_ctx[opt].color = 4;