aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-06-21 23:34:44 +0200
committerOmar Polo <op@omarpolo.com>2021-06-21 23:34:44 +0200
commit33fc3a8ff681ef26cc5e94e35ff82260586c3af2 (patch)
tree7099809bfcd955d8947c13927f021a5f8126e271
parent160abe04e511cb46485ec3588f99c51f40140137 (diff)
downloadtelescope-33fc3a8ff681ef26cc5e94e35ff82260586c3af2.tar.gz
telescope-33fc3a8ff681ef26cc5e94e35ff82260586c3af2.tar.bz2
use term default color by default for every line type
-rw-r--r--defaults.c31
-rw-r--r--telescope.h1
-rw-r--r--ui.c1
3 files changed, 23 insertions, 10 deletions
diff --git a/defaults.c b/defaults.c
index e5ac2c2..7dce021 100644
--- a/defaults.c
+++ b/defaults.c
@@ -27,7 +27,6 @@ int olivetti_mode = 0;
int enable_colors = 1;
static struct lineface_descr {
- int used;
int pp, p, tp;
int prfx_bg, bg, trail_bg;
int prfx_fg, fg, trail_fg;
@@ -119,6 +118,21 @@ mapping_by_name(const char *name)
return NULL;
}
+void
+config_init(void)
+{
+ struct lineface_descr *d;
+ size_t i, len;
+
+ len = sizeof(linefaces_descr)/sizeof(linefaces_descr[0]);
+ for (i = 0; i < len; ++i) {
+ d = &linefaces_descr[i];
+
+ d->prfx_bg = d->bg = d->trail_bg = -1;
+ d->prfx_fg = d->fg = d->trail_fg = -1;
+ }
+}
+
int
config_setprfx(const char *name, const char *prfx, const char *cont)
{
@@ -182,7 +196,6 @@ config_setcolor(int bg, const char *name, int prfx, int line, int trail)
d = &linefaces_descr[m->linetype];
- d->used = 1;
if (bg) {
d->prfx_bg = prfx;
d->bg = line;
@@ -221,16 +234,14 @@ config_apply_colors(void)
d = &linefaces_descr[i];
f = &line_faces[i];
- if (d->used) {
- init_pair(d->pp, d->prfx_fg, d->prfx_bg);
- f->prefix_prop = COLOR_PAIR(d->pp);
+ init_pair(d->pp, d->prfx_fg, d->prfx_bg);
+ f->prefix_prop = COLOR_PAIR(d->pp);
- init_pair(d->p, d->fg, d->bg);
- f->text_prop = COLOR_PAIR(d->p);
+ init_pair(d->p, d->fg, d->bg);
+ f->text_prop = COLOR_PAIR(d->p);
- init_pair(d->tp, d->trail_fg, d->trail_bg);
- f->trail_prop = COLOR_PAIR(d->tp);
- }
+ init_pair(d->tp, d->trail_fg, d->trail_bg);
+ f->trail_prop = COLOR_PAIR(d->tp);
}
init_pair(PBODY, body_face.fg, body_face.bg);
diff --git a/telescope.h b/telescope.h
index d41084e..7547d79 100644
--- a/telescope.h
+++ b/telescope.h
@@ -255,6 +255,7 @@ struct keymap {
};
/* defaults.c */
+void config_init(void);
int config_setprfx(const char *, const char *, const char *);
int config_setvari(const char *, int);
int config_setvars(const char *, char *);
diff --git a/ui.c b/ui.c
index da79dfa..b7b531e 100644
--- a/ui.c
+++ b/ui.c
@@ -1371,6 +1371,7 @@ ui_init(int argc, char * const *argv)
argc -= optind;
argv += optind;
+ config_init();
parseconfig(path, fonf);
if (configtest){
puts("config OK");