commit 160abe04e511cb46485ec3588f99c51f40140137 from: Omar Polo date: Mon Jun 21 21:28:31 2021 UTC allow customizing left and right padding + use_default_colors commit - b598590d2dbf0d1b76146745953273eddf6eb126 commit + 160abe04e511cb46485ec3588f99c51f40140137 blob - d78e6517abf11005a6342c7a5ca976f4aa37c878 blob + e5ac2c2f5a755f8406993a5e5dadb3d68ba0c52f --- defaults.c +++ defaults.c @@ -77,8 +77,9 @@ struct tab_face tab_face = { }; struct body_face body_face = { - .bg = 0, - .fg = 0, + .lbg = -1, .lfg = -1, + .bg = -1, .fg = -1, + .rbg = -1, .rfg = -1, }; struct modeline_face modeline_face = { @@ -192,10 +193,15 @@ config_setcolor(int bg, const char *name, int prfx, in d->trail_fg = trail; } } else if (!strcmp(name, "line")) { - if (bg) - body_face.bg = prfx; - else + if (bg) { + body_face.lbg = prfx; + body_face.bg = line; + body_face.rbg = trail; + } else { body_face.fg = prfx; + body_face.fg = line; + body_face.fg = trail; + } } else { return 0; } @@ -229,4 +235,10 @@ config_apply_colors(void) init_pair(PBODY, body_face.fg, body_face.bg); body_face.body = COLOR_PAIR(PBODY); + + init_pair(PBLEFT, body_face.lfg, body_face.lbg); + body_face.left = COLOR_PAIR(PBLEFT); + + init_pair(PBRIGHT, body_face.rfg, body_face.rbg); + body_face.right = COLOR_PAIR(PBRIGHT); } blob - 5f153261cf432466072d1a785a2d8b551cfac474 blob + 4b5457b1155e472fc8c488d049d49832c52afa35 --- parse.y +++ parse.y @@ -319,7 +319,7 @@ colorname(const char *name) const char *name; short val; } *i, colors[] = { - { "default", 0 }, + { "default", -1 }, { "black", COLOR_BLACK }, { "red", COLOR_RED }, { "green", COLOR_GREEN }, @@ -347,10 +347,9 @@ setcolor(const char *prfx, const char *line, const cha assert(current_style != NULL); - if ((p = colorname(prfx)) == -1 || - (l = colorname(line)) == -1 || - (t = colorname(trail)) == -1) - return; + p = colorname(prfx); + l = colorname(line); + t = colorname(trail); if (!config_setcolor(color_type == TBG, current_style, p, l, t)) yyerror("invalid style %s", current_style); blob - 8657e1ef7c6d1e24194542c4dd5282c498b1b046 blob + d41084e400fefa008ee76a0537d801c89e9968ed --- telescope.h +++ telescope.h @@ -82,8 +82,11 @@ struct tab_face { extern struct tab_face tab_face; struct body_face { + int lbg, lfg; int bg, fg; - int body; + int rbg, rfg; + + int left, body, right; }; extern struct body_face body_face; @@ -333,6 +336,9 @@ extern int in_minibuffer; enum pairs { PBODY = 1, + PBLEFT, + PBRIGHT, + PT, PT_PRFX, PT_TRAIL, blob - 18c979be6d705af4666a27085d2cf6104983ca45 blob + da79dfa78f24b1adb5d5d3123750811c61ecafc6 --- ui.c +++ ui.c @@ -767,8 +767,10 @@ print_vline(int off, int width, WINDOW *window, struct if (text == NULL) text = ""; + wattron(window, body_face.left); for (i = 0; i < off; i++) waddch(window, ' '); + wattroff(window, body_face.left); wattron(window, prefix_face); wprintw(window, "%s", prfx); @@ -786,6 +788,11 @@ print_vline(int off, int width, WINDOW *window, struct for (i = 0; i < left - off - 1; ++i) waddch(window, ' '); wattroff(window, trail_face); + + wattron(window, body_face.right); + for (i = 0; i < off; i++) + waddch(window, ' '); + wattroff(window, body_face.right); } @@ -1400,6 +1407,7 @@ ui_init(int argc, char * const *argv) if (enable_colors) { if (has_colors()) { start_color(); + use_default_colors(); config_apply_colors(); } else enable_colors = 0;