From 6362c217c5356b6df6e74fbec066fe756ed479bd Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 20 Apr 2008 23:34:07 +0200 Subject: [PATCH] Keep line graphics characters in a table initialized on startup ... and use ACS_VLINE instead of '|' for the revgraph. --- tig.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tig.c b/tig.c index cdf3cd7..ef8f6ca 100644 --- a/tig.c +++ b/tig.c @@ -77,7 +77,6 @@ static size_t utf8_length(const char *string, size_t max_width, int *trimmed, bo #define REVGRAPH_BRANCH '+' #define REVGRAPH_COMMIT '*' #define REVGRAPH_BOUND '^' -#define REVGRAPH_LINE '|' #define SIZEOF_REVGRAPH 19 /* Size of revision ancestry graphics. */ @@ -1458,6 +1457,15 @@ static struct view views[] = { #define view_is_displayed(view) \ (view == display[0] || view == display[1]) + +enum line_graphic { + LINE_GRAPHIC_VLINE, +}; + +static int line_graphics[] = { + /* LINE_GRAPHIC_VLINE: */ '|' +}; + static int draw_text(struct view *view, const char *string, int max_len, bool use_tilde, bool selected) @@ -1521,7 +1529,7 @@ draw_lineno(struct view *view, unsigned int lineno, int max, bool selected) if (col < max) { if (!selected) wattrset(view->win, A_NORMAL); - waddch(view->win, opt_line_graphics ? ACS_VLINE : '|'); + waddch(view->win, line_graphics[LINE_GRAPHIC_VLINE]); col++; } if (col < max) { @@ -4727,7 +4735,7 @@ draw_rev_graph(struct rev_graph *graph) }; enum { DEFAULT, RSHARP, RDIAG, LDIAG }; static struct rev_filler fillers[] = { - { ' ', REVGRAPH_LINE }, + { ' ', '|' }, { '`', '.' }, { '\'', ' ' }, { '/', ' ' }, @@ -4736,6 +4744,9 @@ draw_rev_graph(struct rev_graph *graph) struct rev_filler *filler; size_t i; + if (opt_line_graphics) + fillers[DEFAULT].line = line_graphics[LINE_GRAPHIC_VLINE]; + filler = &fillers[DEFAULT]; for (i = 0; i < graph->pos; i++) { @@ -5389,6 +5400,9 @@ init_display(void) wbkgdset(status_win, get_line_attr(LINE_STATUS)); TABSIZE = opt_tab_size; + if (opt_line_graphics) { + line_graphics[LINE_GRAPHIC_VLINE] = ACS_VLINE; + } } static char * -- 2.30.2